python: specify python2 as .py interpreter
On some distro the default python interpreter is Python 3,
which results in such errors:
> Running zdtm/static/socket-tcp-closed.hook(--post-start)
> make[1]: Nothing to be done for default.
> ./socket-tcp-closed --pidfile=socket-tcp-closed.pid --outfile=socket-tcp-closed.out
> File "zdtm/static/socket-tcp-closed.hook", line 16
> except OSError, e:
> ^
> SyntaxError: invalid syntax
> ######### Test zdtm/static/socket-tcp-closed FAIL at hook --post-start #########
> Running zdtm/static/socket-tcp-closed.hook(--clean)
> File "zdtm/static/socket-tcp-closed.hook", line 16
> except OSError, e:
> ^
> SyntaxError: invalid syntax
> Traceback (most recent call last):
> File "zdtm.py", line 1921, in <module>
> do_run_test(tinfo[0], tinfo[1], tinfo[2], tinfo[3])
> File "zdtm.py", line 1388, in do_run_test
> try_run_hook(t, ["--clean"])
> File "zdtm.py", line 1053, in try_run_hook
> raise test_fail_exc("hook " + " ".join(args))
> __main__.test_fail_exc: <__main__.test_fail_exc instance at 0x76294468>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-04-10 22:41:52 +03:00
|
|
|
#!/usr/bin/env python2
|
2016-04-28 17:46:00 +03:00
|
|
|
|
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
|
|
|
|
actions = set(['pre-dump', 'pre-restore', 'post-dump', 'setup-namespaces', \
|
|
|
|
'post-setup-namespaces', 'post-restore', 'post-resume', \
|
|
|
|
'network-lock', 'network-unlock' ])
|
|
|
|
errors = []
|
|
|
|
af = os.path.dirname(os.path.abspath(__file__)) + '/actions_called.txt'
|
|
|
|
|
|
|
|
for act in open(af):
|
|
|
|
act = act.strip().split()
|
|
|
|
act.append('EMPTY')
|
|
|
|
act.append('EMPTY')
|
|
|
|
|
|
|
|
if act[0] == 'EMPTY':
|
|
|
|
raise Exception("Error in test, bogus actions line")
|
|
|
|
|
|
|
|
if act[1] == 'EMPTY':
|
|
|
|
errors.append('Action %s misses CRTOOLS_IMAGE_DIR' % act[0])
|
|
|
|
|
|
|
|
if act[0] in ('post-dump', 'setup-namespaces', 'post-setup-namespaces', \
|
|
|
|
'post-restore', 'post-resume', 'network-lock', 'network-unlock'):
|
|
|
|
if act[2] == 'EMPTY':
|
|
|
|
errors.append('Action %s misses CRTOOLS_INIT_PID' % act[0])
|
|
|
|
elif not act[2].isdigit() or int(act[2]) == 0:
|
|
|
|
errors.append('Action %s PID is not number (%s)' % (act[0], act[2]))
|
|
|
|
|
|
|
|
actions -= set([act[0]])
|
|
|
|
|
|
|
|
if actions:
|
|
|
|
errors.append('Not all actions called: %r' % actions)
|
|
|
|
|
|
|
|
if errors:
|
|
|
|
for x in errors:
|
|
|
|
print x
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
print 'PASS'
|