3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 01:19:23 +01:00

test-runner: Mark source directory as safe for git

Since we use git ls-files to produce the list of all tests for -A, if
the source directory is owned by somebody other than root one might
get:

fatal: unsafe repository ('/home/balrog/repos/iwd' is owned by someone else)
To add an exception for this directory, call:

	git config --global --add safe.directory /home/balrog/repos/iwd

Starting
/home/balrog/repos/iwd/tools/..//autotests/ threw an uncaught exception
Traceback (most recent call last):
  File "/home/balrog/repos/iwd/tools/run-tests", line 966, in run_auto_tests
    subtests = pre_test(ctx, test, copied)
  File "/home/balrog/repos/iwd/tools/run-tests", line 814, in pre_test
    raise Exception("No hw.conf found for %s" % test)
Exception: No hw.conf found for /home/balrog/repos/iwd/tools/..//autotests/

Mark args.testhome as a safe directory on every run.
This commit is contained in:
Andrew Zaborowski 2022-07-09 02:23:34 +02:00 committed by Denis Kenzior
parent d58e754344
commit 043a6959e0
2 changed files with 4 additions and 1 deletions

View File

@ -628,8 +628,10 @@ def build_test_list(args):
# Run all tests
if not args.autotests:
# Get list of all autotests (committed in git)
Process(['git', 'config', '--system', '--add', 'safe.directory',
os.path.normpath(args.testhome)]).wait()
tests = os.popen('git -C %s ls-files autotests/ | cut -f2 -d"/" \
| grep "test*" | uniq' % args.testhome).read() \
| grep "^test" | uniq' % args.testhome).read() \
.strip().split('\n')
tests = [test_root + '/' + t for t in tests]
else:

View File

@ -36,6 +36,7 @@ mounts_common = [
MountInfo('tmpfs', 'tmpfs', '/run', 'mode=0755',
MS_NOSUID|MS_NODEV|MS_STRICTATIME),
MountInfo('tmpfs', 'tmpfs', '/tmp', '', 0),
MountInfo('tmpfs', 'tmpfs', '/etc', '', 0),
MountInfo('tmpfs', 'tmpfs', '/usr/share/dbus-1', 'mode=0755',
MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_STRICTATIME),
]