Skip to content

Commit 2c1ae70

Browse files
committed
Test info recording against inferior in GDB
1 parent 214b84b commit 2c1ae70

4 files changed

Lines changed: 34 additions & 0 deletions

File tree

‎CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,6 +1605,7 @@ set(TESTS_WITH_PROGRAM
16051605
ignored_sigsegv
16061606
ignore_nested
16071607
immediate_restart
1608+
info_recording
16081609
x86/int3_ok
16091610
interrupt
16101611
intr_ptrace_decline

‎src/test/info_recording.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* -*- Mode: C; tab-width: 8; c-basic-offset: 2; indent-tabs-mode: nil; -*- */
2+
3+
#include "util.h"
4+
5+
int main(int argc, char *argv[]) {
6+
if (argc <= 1) {
7+
atomic_puts("Hi");
8+
} else {
9+
atomic_puts(argv[1]);
10+
}
11+
return 0;
12+
}

‎src/test/info_recording.py‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from util import *
2+
3+
import re
4+
import json
5+
6+
send_gdb('info recording')
7+
expect_gdb(re.compile(r'(?<=Path of Recording: ).*'))
8+
path_jsonstr = last_match().group(0)
9+
path_pystr = json.loads(path_jsonstr)
10+
11+
if len(path_pystr) < 6:
12+
failed("ERROR ... Unreasonably short path for recording file found in output")
13+
14+
# Inferior command also has the name of the binary at the end,
15+
# so the pattern matches opening but not closing paren.
16+
send_gdb("inferior")
17+
expect_gdb(f"\\({path_pystr}")
18+
19+
ok()

‎src/test/info_recording.run‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
source `dirname $0`/util.sh
2+
debug_test_gdb_only

0 commit comments

Comments
 (0)