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

Refactor of rz-test to use thread safe functions. #4506

Merged
merged 3 commits into from
May 22, 2024
Merged

Conversation

wargio
Copy link
Member

@wargio wargio commented May 22, 2024

do not squash

Your checklist for this pull request

  • I've read the guidelines for contributing to this repository
  • I made sure to follow the project's coding style
  • I've documented or updated the documentation of every function and struct this PR changes. If not so I've explained why.
  • I've added tests that prove my fix is effective or that my feature works (if possible)
  • I've updated the rizin book with the relevant information (if needed)

Detailed description

This uses the thread-safe functions and cleans up a bit the rz-test code.

Now we automatically detect the core number and use them all unless -j <n> is specified.

binrz/rz-test/rz-test.c Outdated Show resolved Hide resolved
Copy link
Member

@XVilka XVilka left a comment

Choose a reason for hiding this comment

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

Nice cleanup/modernization!

rz-bindgen returns error:

 [1/7] Generating bindgen_outputs with a custom command
FAILED: rizin.i 
/usr/bin/python3 ../src/main.py -o . --clang-path /usr/lib/llvm-14/lib --clang-args ' -resource-dir="/usr/lib/llvm-14/lib/clang/14.0.0"' --rizin-include-path /usr/include/librz --targets SWIG
Traceback (most recent call last):
  File "/home/runner/work/rizin/rizin/rz-bindgen/build/../src/main.py", line 51, in <module>
    bindings.run()
  File "/home/runner/work/rizin/rizin/rz-bindgen/src/bindings.py", line 43, in run
    builders = [HeaderBuilder(name) for name in threaded_headers]
  File "/home/runner/work/rizin/rizin/rz-bindgen/src/bindings.py", line 43, in <listcomp>
    builders = [HeaderBuilder(name) for name in threaded_headers]
  File "/home/runner/work/rizin/rizin/rz-bindgen/src/cparser_header.py", line 101, in __init__
    assert os.path.exists(filename)
AssertionError
[2/7] Generating plugin/swig_runtime with a custom command

The macOS unit test error is now clearer, nice:

>> MALLOC_PERTURB_=178 /private/var/folders/bc/yvvw2g2s4jlg9r8x7tf61xv800009d/T/woodpecker-local-2757858299/workspace/build/test/unit/test_core_task
――――――――――――――――――――――――――――――――――――― ✀  ―――――――――――――――――――――――――――――――――――――
Hello
this
is
the
main
task!
test_core_task ERR
[XX] Fail at line 44: fcn result: expected 1337, 0
1337, 1
1337, 2
1337, 3
1337, 4
, got (null).

test_core_task_finished_cb ERR
[XX] Fail at line 73: task joined: expected true, got false

binrz/rz-test/run.c Outdated Show resolved Hide resolved
binrz/rz-test/rz_test.h Outdated Show resolved Hide resolved
librz/util/subprocess.c Show resolved Hide resolved
librz/util/subprocess.c Show resolved Hide resolved
@wargio
Copy link
Member Author

wargio commented May 22, 2024

The unit tests fails are unrelated to this PR. check dev

@XVilka
Copy link
Member

XVilka commented May 22, 2024

The unit tests fails are unrelated to this PR. check dev

I know they are unrelated, I thought the error improved after this one, but it apparently happended in dev already. So yes, ignore that part of the comment.

@XVilka
Copy link
Member

XVilka commented May 22, 2024

I think having overall count is useful though, could you please also add a column with all tests ran?

Also maybe a final report, how many OK, BR, XX are at the end total?

@wargio
Copy link
Member Author

wargio commented May 22, 2024

I think having overall count is useful though, could you please also add a column with all tests ran?

i have removed it by mistake. i changed the code and now it prints it.

@wargio
Copy link
Member Author

wargio commented May 22, 2024

The issue with Bindgen is unrelated to this PR

AssertionError: File /usr/include/librz/sdb/ls.h does not exist

@XVilka
Copy link
Member

XVilka commented May 22, 2024

The issue with Bindgen is unrelated to this PR

AssertionError: File /usr/include/librz/sdb/ls.h does not exist

rizinorg/rz-bindgen#64

Copy link
Member

@XVilka XVilka left a comment

Choose a reason for hiding this comment

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

There is still room for improvement, e.g. make all XX red in the output if not zero, BR - yellow if not zero, etc. But this is for separate PR.

Copy link
Member

@kazarmy kazarmy left a comment

Choose a reason for hiding this comment

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

A running total would be nice -- I generally use it to see how far the build has progressed through the tests. Not sure whether it's strictly necessary, or how to integrate that info in a clean manner.

@wargio
Copy link
Member Author

wargio commented May 22, 2024

A running total would be nice -- I generally use it to see how far the build has progressed through the tests. Not sure whether it's strictly necessary, or how to integrate that info in a clean manner.

The running total is printed at the end when -L is used.

[21179/21179]    20129 OK      1016 BR        0 XX       34 FX

@wargio wargio merged commit bce7bd7 into dev May 22, 2024
46 of 49 checks passed
@wargio wargio deleted the fuzz-dist-refactor-test branch May 22, 2024 14:27
@kazarmy kazarmy mentioned this pull request May 27, 2024
5 tasks
kazarmy added a commit that referenced this pull request May 27, 2024
wargio added a commit that referenced this pull request May 28, 2024
This reverts commit 7b91fb6.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants