diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index 4a358edcd2..aa81017072 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -43,6 +43,7 @@ env = {} asan_options=None lsan_options=None ubsan_options=None +with_coverage=False running_units = [] @@ -305,6 +306,8 @@ def setUpModule(): drop_in += ['SystemCallFilter='] if use_valgrind or asan_options or lsan_options or ubsan_options: drop_in += ['MemoryDenyWriteExecute=no'] + if with_coverage: + drop_in += ['ProtectSystem=no'] os.makedirs('/run/systemd/system/systemd-networkd.service.d', exist_ok=True) with open('/run/systemd/system/systemd-networkd.service.d/00-override.conf', mode='w') as f: @@ -331,6 +334,8 @@ def setUpModule(): drop_in += ['SystemCallFilter='] if use_valgrind or asan_options or lsan_options or ubsan_options: drop_in += ['MemoryDenyWriteExecute=no'] + if with_coverage: + drop_in += ['ProtectSystem=no'] os.makedirs('/run/systemd/system/systemd-resolved.service.d', exist_ok=True) with open('/run/systemd/system/systemd-resolved.service.d/00-override.conf', mode='w') as f: @@ -5037,6 +5042,7 @@ if __name__ == '__main__': parser.add_argument('--asan-options', help='ASAN options', dest='asan_options') parser.add_argument('--lsan-options', help='LSAN options', dest='lsan_options') parser.add_argument('--ubsan-options', help='UBSAN options', dest='ubsan_options') + parser.add_argument('--with-coverage', help='Loosen certain sandbox restrictions to make gcov happy', dest='with_coverage', type=bool, nargs='?', const=True, default=with_coverage) ns, args = parser.parse_known_args(namespace=unittest) if ns.build_dir: @@ -5070,6 +5076,7 @@ if __name__ == '__main__': asan_options = ns.asan_options lsan_options = ns.lsan_options ubsan_options = ns.ubsan_options + with_coverage = ns.with_coverage if use_valgrind: networkctl_cmd = ['valgrind', '--track-origins=yes', '--leak-check=full', '--show-leak-kinds=all', networkctl_bin]