Skip to content

Commit

Permalink
tests: Add --no-ptrace, to skip compiled tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonKagstrom committed Jul 17, 2024
1 parent 6e50ca5 commit 3b8f8c7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
distro: ubuntu22.04
run: |
.github/workflows/generic-build.sh ${{ matrix.arch }}
.github/workflows/ci-run-tests.sh --no-ptrace
build-osx:
name: Build OSX executable (macos-latest)
Expand Down
21 changes: 16 additions & 5 deletions tests/tools/libkcov/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def to_fnmatch(pattern):
return pattern


def addTests(config, patterns):
def addTests(config, args, patterns):
"""Add all the kcov test modules.
Discovery is not possible, since some modules need to be excluded,
Expand All @@ -100,15 +100,18 @@ def addTests(config, patterns):
test_loader = TestLoader(config, patterns)

test_loader.add_tests_from_module("test_basic")
test_loader.add_tests_from_module("test_compiled_basic")
if not args.no_ptrace:
test_loader.add_tests_from_module("test_compiled_basic")

if platform.machine() in ["x86_64", "i386", "i686"]:
test_loader.add_tests_from_module("test_compiled")
if not args.no_ptrace:
test_loader.add_tests_from_module("test_compiled")
if sys.platform.startswith("linux"):
test_loader.add_tests_from_module("test_bash_linux_only")

if platform.machine() in ["x86_64", "i386", "i686"]:
test_loader.add_tests_from_module("test_system_mode")
if not args.no_ptrace:
test_loader.add_tests_from_module("test_system_mode")

test_loader.add_tests_from_module("test_accumulate")
test_loader.add_tests_from_module("test_bash")
Expand Down Expand Up @@ -189,6 +192,14 @@ def parse_args():
help="Randomize the execution order of tests",
)

parser.add_argument(
"--no-ptrace",
dest="no_ptrace",
action="store_true",
help="Don't run tests which require ptrace",
)


# TODO: The --duration argument was added in 3.12.

# kcov test runner custom options
Expand All @@ -205,7 +216,7 @@ def main():

# Loads and configure tests
config = Config(args.kcov, args.outbase, args.binaries, args.sources)
tests = addTests(config, args.patterns)
tests = addTests(config, args, args.patterns)

if args.shuffle:
random.shuffle(tests)
Expand Down

0 comments on commit 3b8f8c7

Please sign in to comment.