Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix running tests #598

Merged
merged 2 commits into from
Feb 24, 2025
Merged

Fix running tests #598

merged 2 commits into from
Feb 24, 2025

Conversation

pmhahn
Copy link
Contributor

@pmhahn pmhahn commented Feb 24, 2025

While working on #514 I noticed two issues while running the test suite:

  1. testlog is used but not defined
  2. output is locale dependent and fails when running in non-English-locale

```console
$ cd test && python3 all_tests.py
Traceback (most recent call last):
  File "…/pyelftools/test/all_tests.py", line 29, in <module>
    sys.exit(main())
             ^^^^^^
  File "…/pyelftools/test/all_tests.py", line 21, in main
    testlog.error('Error: Please run me from the root dir of pyelftools!')
    ^^^^^^^
NameError: name 'testlog' is not defined
```

Signed-off-by: Philipp Hahn <[email protected]>
Otherwise the output of `readelf` might be translated and comparison
with the English output from `readelf.py` will fail.

```console
$ LC_ALL=de_DE.UTF-8 ./test/run_readelf_tests.py
Test file 'test/testfiles_for_readelf/aarch64-pac-bti.elf'
.......................FAIL
....for file test/testfiles_for_readelf/aarch64-pac-bti.elf
....for option "-e"
....Output eliben#1 is readelf, Output eliben#2 is pyelftools
@@ Mismatch on line #0:
>>elf-header:<<
>>elf header:<<
 ([('equal', 0, 3, 0, 3), ('replace', 3, 4, 3, 4), ('equal', 4, 11, 4, 11)])
```

Signed-off-by: Philipp Hahn <[email protected]>
Copy link
Owner

@eliben eliben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@eliben eliben merged commit aad8631 into eliben:main Feb 24, 2025
4 checks passed
@pmhahn pmhahn mentioned this pull request Feb 24, 2025
@pmhahn pmhahn deleted the testing branch February 25, 2025 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants