-
Notifications
You must be signed in to change notification settings - Fork 277
Add check that gdb is on the path #4420
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
Conversation
unit/memory-analyzer/gdb_api.cpp
Outdated
@@ -104,94 +104,111 @@ void gdb_api_internals_test() | |||
TEST_CASE("gdb api internals test", "[core][memory-analyzer]") | |||
{ | |||
#ifdef RUN_GDB_API_TESTS | |||
gdb_api_internals_test(); | |||
int has_gdb = system("gdb --version"); |
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.
How about bool has_gdb = (system("gdb --version") == 0);
?
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.
Done.
65a30ea
to
b3c6c40
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.
This PR failed Diffblue compatibility checks (cbmc commit: 65a30ea).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/105460761
Status will be re-evaluated on next push.
Common spurious failures:
-
the cbmc commit has disappeared in the mean time (e.g. in a force-push)
-
the author is not in the list of contributors (e.g. first-time contributors).
-
the compatibility was already broken by an earlier merge.
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: b3c6c40).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/105462720
unit/memory-analyzer/gdb_api.cpp
Outdated
@@ -104,94 +104,111 @@ void gdb_api_internals_test() | |||
TEST_CASE("gdb api internals test", "[core][memory-analyzer]") | |||
{ | |||
#ifdef RUN_GDB_API_TESTS | |||
gdb_api_internals_test(); | |||
bool has_gdb = system("gdb --version") == 0; |
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.
const
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.
Added.
} | ||
catch(const gdb_interaction_exceptiont &e) | ||
{ | ||
std::cerr |
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.
Don't we use message handlers in unit tests?
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.
At least not consistently, I found a few other tests that call std:cerr
. Should I modify this one?
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.
@peterschrammel What value would the use of message handlers add here?
unit/memory-analyzer/gdb_api.cpp
Outdated
#endif | ||
} | ||
|
||
TEST_CASE("gdb api test", "[core][memory-analyzer]") | ||
{ | ||
#ifdef RUN_GDB_API_TESTS | ||
compile_test_file(); | ||
|
||
bool has_gdb = system("gdb --version") == 0; |
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.
const
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.
Added.
b3c6c40
to
2af9fff
Compare
unit/memory-analyzer/gdb_api.cpp
Outdated
@@ -104,94 +104,111 @@ void gdb_api_internals_test() | |||
TEST_CASE("gdb api internals test", "[core][memory-analyzer]") | |||
{ | |||
#ifdef RUN_GDB_API_TESTS | |||
gdb_api_internals_test(); | |||
const bool has_gdb = system("gdb --version") == 0; |
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 would prefer if run("gdb", {"gdb", "--version"})
(from util/run.{h,cpp}
) were used in place of system
(system
is really heavy-weight as it starts a shell). But I do acknowledge that we already use system
in this file, though I think that call should equally be replaced.
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.
Replaced. The other use was replaced in the next commit.
unit/memory-analyzer/gdb_api.cpp
Outdated
#endif | ||
} | ||
|
||
TEST_CASE("gdb api test", "[core][memory-analyzer]") | ||
{ | ||
#ifdef RUN_GDB_API_TESTS | ||
compile_test_file(); | ||
|
||
const bool has_gdb = system("gdb --version") == 0; |
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.
As above - or maybe even factor out this check (and the SECTION
) into a separate procedure.
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.
Done.
} | ||
catch(const gdb_interaction_exceptiont &e) | ||
{ | ||
std::cerr |
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.
@peterschrammel What value would the use of message handlers add here?
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 2af9fff).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/105533191
OK, so today I'm going to be that bell-end that uses a simple patch to complain about something only semi-related. Given that : why only gdb? I believe there are various other tools that implement compatable text annd / or protocol interfaces. Explicitly testing for gdb seems to tie us to that. ( Comment not review so you can (and I will not be even the slightest bit offended) ignore this. ) |
2af9fff
to
b20e39c
Compare
@martin-cs The context is that this particular unit-test hangs indefinitely if the system does not have |
@xbauch clang-format asks for reformatting two lines. |
b20e39c
to
3a1aa7c
Compare
@xbauch : thanks for the explanation. |
3a1aa7c
to
96e9646
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 96e9646).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/105574298
unit/memory-analyzer/gdb_api.cpp
Outdated
{ | ||
REQUIRE(has_gdb); | ||
} | ||
return false; |
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.
Doesn't this now always return false
, and thus effectively disable all the tests?
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.
@tautschnig sorry about this type: should be fixed now.
No functional change. Only wraps the test cases in an if-statements checking the presence of gdb.
96e9646
to
01da544
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 01da544).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/105588250
No functional change only wrapped the test-cases in if-statements checking
that gdb can be called. The rest is clang-formatting.