-
Notifications
You must be signed in to change notification settings - Fork 383
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
[test] Port LD-logger tests to python #3153
[test] Port LD-logger tests to python #3153
Conversation
576cc56
to
4960ada
Compare
3018537
to
5f7ab80
Compare
5f7ab80
to
b8098d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't find some test cases which were available previously: test_backslashes
, test_vectical_tab
, test_carriage_return
, test_valid_json
codechecker/analyzer/tools/build-logger/test/test_logger.sh
Lines 161 to 199 in 2c49428
function test_backslashes { | |
bash -c "gcc -Wall -Wextra -DVARIABLE=\\\\\\\\\\\\\\\\built\\\\\\\\ages\\ \\\"ago\\\"\\\\\\\\ $source_file" | |
assert_json \ | |
"-Wall -Wextra -DVARIABLE=\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\built\\\\\\\\\\\\\\\\ages\\\\ \\\\\\\"ago\\\\\\\"\\\\\\\\\\\\\\\\ $source_file" \ | |
gcc \ | |
"$source_file" | |
# - - \ \ b u i l t \ a g e s " a g o " \ - - | |
assert_run_stdout_hexdump "2d 2d 5c 5c 62 75 69 6c 74 5c 61 67 65 73 20 22 61 67 6f 22 5c 2d 2d" ./a.out | |
} | |
function test_vectical_tab { | |
bash -c "gcc -Wall -Wextra -DVARIABLE=\\\\\\\\ZZ\\\\x0bYYYY\\\\\\\\ $source_file" | |
assert_json \ | |
"-Wall -Wextra -DVARIABLE=\\\\\\\\\\\\\\\\ZZ\\\\\\\\x0bYYYY\\\\\\\\\\\\\\\\ $source_file" \ | |
gcc \ | |
"$source_file" | |
# --\ZZ\vYYYY\-- as hex | |
# ^^ ---- vertical tab --------------vv | |
# - - \ Z Z \v Y Y Y Y \ - - | |
assert_run_stdout_hexdump "2d 2d 5c 5a 5a 0b 59 59 59 59 5c 2d 2d" ./a.out | |
} | |
function test_carriage_return { | |
bash -c "gcc -Wall -Wextra -DVARIABLE=\\\\\\\\ZZ\\\\x0dYYYY\\\\\\\\ $source_file" | |
assert_json \ | |
"-Wall -Wextra -DVARIABLE=\\\\\\\\\\\\\\\\ZZ\\\\\\\\x0dYYYY\\\\\\\\\\\\\\\\ $source_file" \ | |
gcc \ | |
"$source_file" | |
# --\ZZ\rYYYY\-- as hex | |
# ^^ ---- carriage return -----------vv | |
# - - \ Z Z \r Y Y Y Y \ - - | |
assert_run_stdout_hexdump "2d 2d 5c 5a 5a 0d 59 59 59 59 5c 2d 2d" ./a.out | |
} |
codechecker/analyzer/tools/build-logger/test/test_logger.sh
Lines 244 to 249 in 2c49428
function test_valid_json { | |
bash -c "gcc 2>/dev/null" | |
echo -ne "[\n]" > $reference_file | |
diff $reference_file $CC_LOGGER_FILE | |
} |
It would be good not to remove any test case with this patch.
Also adds some failing tests, documenting existing behavior.
b8098d8
to
ebc8213
Compare
Oh yes, I re-added this test case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Simply port the BASH tests to python 3.
Also adds a few other test-cases, one of which demonstrates a current limitation.
In the XFAIL test, the logger produces an invalid json.
Maybe we should set pylint for the tests as well.