diff --git a/tester.py b/tester.py index 6724ab8c8980477523622bbae9908f8accd7d149..650abef8da85a492263e71e54a02cd48f1765917 100755 --- a/tester.py +++ b/tester.py @@ -71,13 +71,14 @@ def raid_idle(): class Tester(): - USAGE = '''%s [-e] [-f] [-b] [-d] [-h] [msuser] + USAGE = '''%s [-e] [-f] [-b] [-n] [-d] [-h] [msuser] -e: send email with report. -f: send email with report only if at least one test failed. -b: run only basic tests (exclude mediaserver tests). + -n: do not update envsetup repository. -d: debug mode (can be started with non root users). -h: show this message.''' % __file__ - VALID_ARGS = ['-e', '-f', '-b', '-d', '-h'] + VALID_ARGS = ['-e', '-f', '-b', '-n', '-d', '-h'] MAX_LOG_FILES = 50 NO_MAIL_FAILURES_COUNT = 5 @@ -119,7 +120,14 @@ class Tester(): log('This script should be run as root user.') sys.exit(1) # Update envsetup files - subprocess.call(['python3', 'update_envsetup.py']) + if '-n' not in args: + tester_path = os.path.join(root_dir, os.path.basename(__file__)) + mtime = os.path.getmtime(tester_path) + subprocess.call(['python3', 'update_envsetup.py']) + if mtime != os.path.getmtime(tester_path): + log('The script has changed, restarting it...') + os.execl('/bin/python3', 'python3', tester_path, '-n', *args) + sys.exit(1) # not reachable # Load conf conf = utils.load_conf() if not conf: