Skip to content

Commit

Permalink
test: Skip test_executable_stack when ldd-failed
Browse files Browse the repository at this point in the history
ldd returns 'not a dynamic executable' for 'executable-stack' even in
X86_64 with different optimizations. This patch just skip these tests if
the ldd call don't work, so it doesn't fail.
  • Loading branch information
danigm committed Aug 3, 2023
1 parent 712fae9 commit b5c7ba2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions test/test_objdump_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,8 @@ def test_executable_stack_package(binariescheck):
run_elf_checks(test, FakePkg('fake'), pkgfile)
out = output.print_results(output.results)

if 'ldd-failed' in out:
pytest.skip("ldd failed, maybe it's a different architecture")

assert 'W: missing-mandatory-optflags a.out -fno-PIE -g -Ofast' in out
assert 'E: forbidden-optflags a.out -frounding-math' in out
7 changes: 6 additions & 1 deletion test/test_readelf_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,12 @@ def test_executable_stack(binariescheck):
with FakePkg('fake') as pkg:
pkgfile = pkg.add_file(get_full_path('executable-stack'), '/lib64/my/a.out')
run_elf_checks(test, pkg, pkgfile)
assert 'E: executable-stack /lib64/my/a.out' in output.results[0]
out = output.print_results(output.results)

if 'ldd-failed' in out:
pytest.skip("ldd failed, maybe it's a different architecture")

assert 'E: executable-stack /lib64/my/a.out' in out


def test_readelf_failure():
Expand Down

0 comments on commit b5c7ba2

Please sign in to comment.