From 90d2c8cd563c38c0365e6addff68f42de0367424 Mon Sep 17 00:00:00 2001 From: hugsy Date: Sat, 21 Aug 2021 17:40:33 -0700 Subject: [PATCH] Fixed test of `test_cmd_memory_watch`: no need for `scanf`, which makes testing more hazardous --- .github/workflows/run-tests.yml | 2 +- tests/binaries/memwatch.c | 5 +++-- tests/runtests.py | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 8ae01edfd..a78e105dd 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -66,4 +66,4 @@ jobs: - name: Run Tests run: | - bash -c 'make test' + make test diff --git a/tests/binaries/memwatch.c b/tests/binaries/memwatch.c index a7d837369..e71bc2a5d 100644 --- a/tests/binaries/memwatch.c +++ b/tests/binaries/memwatch.c @@ -1,11 +1,12 @@ #include +#include int myglobal = 1; -int main() +int main(int argc, char** argv) { // breakpoints hardcoded for convenience - scanf("%d", &myglobal); + myglobal = strtoll(argv[1], NULL, 16); asm("int3"); return 0; } diff --git a/tests/runtests.py b/tests/runtests.py index 2cf76cb67..8ff34004e 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -278,14 +278,14 @@ def test_cmd_memory_watch(self): self.assertNoException(res) target = "/tmp/memwatch.out" res = gdb_start_silent_cmd("memory watch &myglobal", - before=["set args <<<$((0xdeadbeef))"], + before=["set args 0xdeadbeef",], after=["continue",], target=target, context='memory') self.assertIn("deadbeef", res) self.assertNotIn("cafebabe", res) res = gdb_start_silent_cmd("memory watch &myglobal", - before=["set args <<<$((0xcafebabe))",], + before=["set args 0xcafebabe",], after=["continue", ], target=target, context="memory")