Skip to content

Commit

Permalink
Fixed test of test_cmd_memory_watch: no need for scanf, which mak…
Browse files Browse the repository at this point in the history
…es testing more hazardous
  • Loading branch information
hugsy committed Aug 22, 2021
1 parent 2fb1b10 commit 90d2c8c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Expand Up @@ -66,4 +66,4 @@ jobs:
- name: Run Tests
run: |
bash -c 'make test'
make test
5 changes: 3 additions & 2 deletions tests/binaries/memwatch.c
@@ -1,11 +1,12 @@
#include<stdio.h>
#include<stdlib.h>

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;
}
4 changes: 2 additions & 2 deletions tests/runtests.py
Expand Up @@ -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")
Expand Down

0 comments on commit 90d2c8c

Please sign in to comment.