test-gdb: bring back to life

Well factored with ./test-baremetal, allowing for target selection.
This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-05-27 00:00:05 +00:00
parent 24b75f92d8
commit cc1d8d08d0
6 changed files with 40 additions and 44 deletions

View File

@@ -0,0 +1 @@
https://github.com/cirosantilli/linux-kernel-module-cheat#gdb-tests

13
userland/gdb_tests/add.c Normal file
View File

@@ -0,0 +1,13 @@
#include <assert.h>
int main(void) {
int i, j, k;
i = 1;
/* test-gdb-op1 */
j = 2;
/* test-gdb-op2 */
k = i + j;
/* test-gdb-result */
if (k != 3)
assert(0);
}

View File

@@ -0,0 +1,9 @@
def test(self):
self.sendline('tbreak main')
self.sendline('continue')
self.continue_to('op1')
assert self.get_int('i') == 1
self.continue_to('op2')
assert self.get_int('j') == 2
self.continue_to('result')
assert self.get_int('k') == 3