blob: d68bbf866ade4193046bd116ca7e0560b7f790df [file] [log] [blame]
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +02001import sys
2import time
Neels Hofmeyr417a03d2017-05-04 14:48:49 +02003import os
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +02004
5import _prep
6
Pau Espin Pedrole8bbcbf2020-04-10 19:51:31 +02007from osmo_gsm_tester.core.util import FileLock, touch_file
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +02008
Neels Hofmeyr417a03d2017-05-04 14:48:49 +02009testdir, name = sys.argv[1:]
10stop_signalling_file = os.path.join(testdir, name)
Neels Hofmeyr936a81e2017-09-14 01:31:41 +020011if not os.path.isfile(stop_signalling_file):
12 print('expected a stop-file %r' % stop_signalling_file)
13 exit(1)
Neels Hofmeyr417a03d2017-05-04 14:48:49 +020014
15lockfile_path = os.path.join(testdir, 'lock_test')
16fl = FileLock(lockfile_path, name)
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +020017
Neels Hofmeyr936a81e2017-09-14 01:31:41 +020018touch_file(stop_signalling_file + '.ready')
19
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +020020with fl:
Neels Hofmeyr417a03d2017-05-04 14:48:49 +020021 while os.path.exists(stop_signalling_file):
22 time.sleep(.1)
Neels Hofmeyr417a03d2017-05-04 14:48:49 +020023touch_file(stop_signalling_file + '.done')
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +020024
25# vim: expandtab tabstop=4 shiftwidth=4