Skip to content

Commit

Permalink
add more syscall tests and fix failures found from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bmiddha committed Dec 27, 2024
1 parent 6347af4 commit 7418415
Show file tree
Hide file tree
Showing 23 changed files with 1,282 additions and 235 deletions.
6 changes: 2 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"name": "(gdb) fstrace",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/fstrace-debug",
"args": ["${workspaceFolder}/build/tests_syscalls_openat2.c"],
"program": "${workspaceFolder}/build/approval-tests",
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
Expand All @@ -23,8 +22,7 @@
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "CMake: clean rebuild"
]
},
{
"name": "(gdb) Attach",
Expand Down
15 changes: 4 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ add_compile_options(-Wall -Wextra -Wpedantic -Wimplicit-fallthrough)
# Build fstrace
add_executable(fstrace src/fstrace.cc)

# target_compile_options(fstrace PRIVATE --coverage)
# target_link_options(fstrace PRIVATE --coverage)

set(DEBUG_FD 1)
target_compile_definitions(fstrace PRIVATE DEBUGFD=${DEBUG_FD})

Expand Down Expand Up @@ -77,12 +74,8 @@ target_link_libraries(approval-tests ApprovalTests::ApprovalTests GTest::gtest_m

include(GoogleTest)

gtest_discover_tests(approval-tests)
target_include_directories(approval-tests PUBLIC "${PROJECT_SOURCE_DIR}")
target_compile_options(approval-tests PRIVATE --coverage)
target_link_options(approval-tests PRIVATE --coverage)

set(SOURCE_DIR "tests/syscalls")
file(GLOB SOURCES "${SOURCE_DIR}/*.c" "${SOURCE_DIR}/*.cpp")
foreach(SOURCE_FILE ${SOURCES})
file(RELATIVE_PATH REL_PATH "${CMAKE_SOURCE_DIR}" "${SOURCE_FILE}")
string(REPLACE "/" "_" TARGET_NAME ${REL_PATH})
add_executable(${TARGET_NAME} ${SOURCE_FILE})
endforeach()
gtest_discover_tests(approval-tests)
318 changes: 210 additions & 108 deletions src/trace_exec.cc

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
RF /tmp/fstrace-test-dir/file0
RX /tmp/fstrace-test-dir/does-not-exist
RD /tmp/fstrace-test-dir/dir0/
RD /tmp/fstrace-test-dir/dir0
RF /tmp/fstrace-test-dir/file0
RX /tmp/fstrace-test-dir/does-not-exist
RD /tmp/fstrace-test-dir/dir0/
RD /tmp/fstrace-test-dir/dir0
RF /tmp/fstrace-test-dir/file0
RX /tmp/fstrace-test-dir/does-not-exist
RD /tmp/fstrace-test-dir/dir0/
RD /tmp/fstrace-test-dir/dir0
RF /tmp/fstrace-test-dir/file0
RX /tmp/fstrace-test-dir/does-not-exist
RD /tmp/fstrace-test-dir/dir0/
RD /tmp/fstrace-test-dir/dir0
RF /tmp/fstrace-test-dir
RF /tmp/fstrace-test-dir/file0
RX /tmp/fstrace-test-dir/does-not-exist
RD /tmp/fstrace-test-dir/dir0/
RD /tmp/fstrace-test-dir/dir0
RF /tmp/fstrace-test-dir/file0
RX /tmp/fstrace-test-dir/does-not-exist
RD /tmp/fstrace-test-dir/dir0/
RD /tmp/fstrace-test-dir/dir0
RF /tmp/fstrace-test-dir/file0
RX /tmp/fstrace-test-dir/does-not-exist
RD /tmp/fstrace-test-dir/dir0/
RD /tmp/fstrace-test-dir/dir0
RF /tmp/fstrace-test-dir/file0
RX /tmp/fstrace-test-dir/does-not-exist
RD /tmp/fstrace-test-dir/dir0/
RD /tmp/fstrace-test-dir/dir0
RF /tmp/fstrace-test-dir/file0
RX /tmp/fstrace-test-dir/does-not-exist
RD /tmp/fstrace-test-dir/dir0/
RD /tmp/fstrace-test-dir/dir0
RF /tmp/fstrace-test-dir/file0
RX /tmp/fstrace-test-dir/does-not-exist
RD /tmp/fstrace-test-dir/dir0/
RD /tmp/fstrace-test-dir/dir0

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RF /tmp/fstrace-test-dir
ED /tmp/fstrace-test-dir
ED /tmp/fstrace-test-dir

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
RF /tmp/fstrace-test-dir/file0
WF /tmp/fstrace-test-dir/file0
WX /tmp/fstrace-test-dir/does-not-exist
WX /tmp/fstrace-test-dir/does-not-exist
RX /tmp/fstrace-test-dir/does-not-exist
WX /tmp/fstrace-test-dir/does-not-exist
RD /tmp/fstrace-test-dir/dir0/
WD /tmp/fstrace-test-dir/dir0/
RD /tmp/fstrace-test-dir/dir0/
RF /tmp/fstrace-test-dir/dir0
WF /tmp/fstrace-test-dir/newfile0
WF /tmp/fstrace-test-dir/newfile1

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
RL /tmp/fstrace-test-dir/file0.link
RX /tmp/fstrace-test-dir/does-not-exist.link
RL /tmp/fstrace-test-dir/dir0.link
RL /tmp/fstrace-test-dir/file0.link
RX /tmp/fstrace-test-dir/does-not-exist.link
RL /tmp/fstrace-test-dir/dir0.link
RL /tmp/fstrace-test-dir/file0.link
RX /tmp/fstrace-test-dir/does-not-exist.link
RL /tmp/fstrace-test-dir/dir0.link
RL /tmp/fstrace-test-dir/file0.link
RX /tmp/fstrace-test-dir/does-not-exist.link
RL /tmp/fstrace-test-dir/dir0.link
RF /tmp/fstrace-test-dir
RL /tmp/fstrace-test-dir/file0.link
RX /tmp/fstrace-test-dir/does-not-exist.link
RL /tmp/fstrace-test-dir/dir0.link
RL /tmp/fstrace-test-dir/file0.link
RX /tmp/fstrace-test-dir/does-not-exist.link
RL /tmp/fstrace-test-dir/dir0.link

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DX /tmp/fstrace-test-dir/file0
WF /tmp/fstrace-test-dir/newfile0
DX /tmp/fstrace-test-dir/file1
WF /tmp/fstrace-test-dir/newfile1

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DX /tmp/fstrace-test-dir/dir0/
DX /tmp/fstrace-test-dir/dir1
DX /tmp/fstrace-test-dir/dir2/
DX /tmp/fstrace-test-dir/dir3

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
RF /tmp/fstrace-test-dir/file0
RX /tmp/fstrace-test-dir/does-not-exist
RD /tmp/fstrace-test-dir/dir0/
RD /tmp/fstrace-test-dir/dir0
RF /tmp/fstrace-test-dir/file0
RX /tmp/fstrace-test-dir/does-not-exist
RD /tmp/fstrace-test-dir/dir0/
RD /tmp/fstrace-test-dir/dir0
RF /tmp/fstrace-test-dir/file0
RX /tmp/fstrace-test-dir/does-not-exist
RD /tmp/fstrace-test-dir/dir0/
RD /tmp/fstrace-test-dir/dir0
RF /tmp/fstrace-test-dir
RF /tmp/fstrace-test-dir/file0
RX /tmp/fstrace-test-dir/does-not-exist
RD /tmp/fstrace-test-dir/dir0/
RD /tmp/fstrace-test-dir/dir0
RF /tmp/fstrace-test-dir/file0
RX /tmp/fstrace-test-dir/does-not-exist
RD /tmp/fstrace-test-dir/dir0/
RD /tmp/fstrace-test-dir/dir0

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DX /tmp/fstrace-test-dir/file0
DX /tmp/fstrace-test-dir/file1
DX /tmp/fstrace-test-dir/file2
DX /tmp/fstrace-test-dir/file3
RF /tmp/fstrace-test-dir
DX /tmp/fstrace-test-dir/file4
DX /tmp/fstrace-test-dir/file5

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

This file was deleted.

This file was deleted.

Loading

0 comments on commit 7418415

Please sign in to comment.