-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Add usdt support for ARM64 #1414
Conversation
cc @palmtenor |
tests/cc/test_usdt_args.cc
Outdated
@@ -113,7 +121,7 @@ TEST_CASE("test usdt argument parsing", "[usdt]") { | |||
verify_register(parser, 2, 1097); | |||
verify_register(parser, 4, "gpr[30]", 108); | |||
verify_register(parser, -2, "gpr[31]", -4); | |||
#elif defined(__x86_64__) |
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.
why remove defined(x86_64) ?
Other than this nit it all looks good to me.
cc @goldshtn
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.
This is for consistency. In all other places, we have x86_64 as the default. So I changed a couple of places here to have x86_64 as the default.
The x86_64 as the default in the core source files makes build easier for not-fully-supported architectures. Although some tests/tools may not work as expected, at least build can go through without change.
@@ -54,9 +54,11 @@ static void verify_register(USDT::ArgumentParser &parser, int arg_size, | |||
|
|||
TEST_CASE("test usdt argument parsing", "[usdt]") { | |||
SECTION("parse failure") { | |||
#ifdef __powerpc64__ | |||
#ifdef __aarch64__ |
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.
Theoritically these tests doesn't rely on architecture. We just put in fake argument format strings, call specific parser, and see if it outputs correct results. It would be nice to always test all architectures all the time, right?
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.
Okay. I will add the arch guard back to the test.
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.
Theoritically these tests doesn't rely on architecture. We just put in fake argument format strings, call specific parser, and see if it outputs correct results. It would be nice to always test all architectures all the time, right?
The test input needs to be different for different architecture. That is why we have different "ifdef"s.
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.
It feels to me that, say, the code ArgumentParser_aarch64
itself, can also run on x86, is that right?
In that case, we can always invoke ArgumentParser_aarch64
on arm64 test inputs, USDT::ArgumentParser_powerpc64
on Power PC inputs, etc.?
Otherwise, since our testbot only runs on x86, we won't be able to catch regressions and breakage for other architectures at PR time?
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 still prefer that it is guarded by different architecture. The reason is usdt parsing code is arch specific. Even if we run some other arch inputs on x86, this still won't catch regression
on powerpc since powerpc parsing code is not exercised on x86.
There is a chance that illegal input in one arch is legal in a different one.
For example 4@4 is illegal on x86 but it is legal in aarch64. Mixing together
will prevent put 4@4 in negative test since it is legal in aarch64.
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.
After the second thought, I know what you mean. Yes, we could exercise non x86 parsing code on x86 host. I will make a revision to reflect that.
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.
Sorry, I cannot make the change because powerpc64 uses the regex library which old compiler likes gcc 4.8.5 does not have a good support (as I mentioned in my commit message as well).
....
REQUIRE( !parser.parse(&arg) )
due to unexpected exception with message:
regex_error
....
Therefore, let us stick to arch. specific usdt parser tests for now. Supposedly, each arch parser change should have run this test on their respective arch to catch all possible errors.
Specifically the following argument patterns will be supported: ``` [-]<size>@<value> [-]<size>@<reg> [-]<size>@[<reg>] [-]<size>@[<reg>,<offset>] ``` I did not use std regex library as the old gcc (e.g. 4.8.5) does not have a good support for it. Signed-off-by: Yonghong Song <yhs@fb.com>
5bb3b91
to
c2d9880
Compare
updated the patch to add "#elif x86_64" back to test_usdt_args.c. |
Just a little more information. The following is the output of
|
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.
That's unfortunate:( Makes sense to keep it how it is now, we can move this later when we have higher version of GCC
Specifically the following argument patterns will be
supported:
I did not use std regex library as the old gcc (e.g. 4.8.5)
does not have a good support for it.
Signed-off-by: Yonghong Song yhs@fb.com