diff options
| author | Paul Buetow <paul@buetow.org> | 2025-07-10 22:58:00 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-07-10 22:58:00 +0300 |
| commit | 7d6f3098976a9e3cfcd8d7f764486645a62188ba (patch) | |
| tree | 8cd94927b7694e4c6f940cb66a532544261239fa | |
| parent | 639af92806847f55c986cc2643986acccba19884 (diff) | |
Update TODO.md and remove obsolete unit test comments
- Remove 5 obsolete "TODO: Unit test this" comments from eventloop.go
for event types that already have comprehensive test coverage
- Keep TODO comment for FcntlEvent which still needs tests
- Reorganize TODO.md with prioritized task list based on all TODOs
found across the codebase
- Add priority levels: High (core functionality), Medium (additional
syscalls), Low (less common features), and General improvements
- Document completed tasks to acknowledge test coverage achievements
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
| -rw-r--r-- | TODO.md | 123 | ||||
| -rw-r--r-- | internal/eventloop.go | 5 |
2 files changed, 73 insertions, 55 deletions
@@ -1,50 +1,73 @@ -# TODO - Eventloop Test Coverage - -## Remaining Helper Functions -- [x] Create helper functions for NameEvent (makeEnterNameEvent/makeExitNameEvent) -- [x] Create helper functions for NullEvent (makeEnterNullEvent/makeExitNullEvent) -- [x] Create helper functions for Dup3Event (makeEnterDup3Event/makeExitDup3Event) - -## Remaining Test Cases - -### FdEvent Syscalls -- [x] Add test case for fsync syscall -- [x] Add test case for ftruncate syscall - -### PathEvent Syscalls -- [x] Add test case for unlink syscall -- [x] Add test case for creat syscall -- [x] Add test case for stat syscall -- [x] Add test case for access syscall - -### NameEvent Syscalls -- [x] Add test case for rename syscall -- [x] Add test case for link syscall -- [x] Add test case for symlink syscall - -### NullEvent Syscalls -- [x] Add test case for sync syscall -- [x] Add test case for io_uring_setup syscall - -### Dup3Event Syscalls -- [x] Add test case for dup3 syscall - -## Advanced Test Cases - -### File Descriptor Lifecycle -- [x] Test that fd from openat is properly tracked in subsequent read/write/close operations -- [x] Test dup/dup2/dup3 creating new file descriptors -- [x] Test close removing fd from tracking -- [x] Test multiple file descriptors being tracked simultaneously - -### Edge Cases -- [x] Test missing enter events (only exit event received) -- [x] Test missing exit events (only enter event received) -- [x] Test mismatched enter/exit pairs -- [x] Test out-of-order events -- [x] Test events from different threads/processes - -### Filtering and Comm Tracking -- [x] Test that comm names are properly propagated across syscalls -- [x] Test filter behavior for each event type -- [x] Test comm filter enable/disable functionality
\ No newline at end of file +# TODO - I/O Riot NG Development Tasks + +## High Priority (Core functionality) + +### 1. Add unit test for FcntlEvent handling +- Test F_SETFL flag modification +- Test F_DUPFD file descriptor duplication +- Test F_DUPFD_CLOEXEC with O_CLOEXEC flag +- Location: internal/eventloop.go:305 + +### 2. Implement byte count tracking for read/write syscalls +- Track number of bytes read/written in each I/O operation +- Add to flamegraph statistics +- Location: internal/flamegraph/counter.go:11 + +## Medium Priority (Additional syscalls) + +### 3. Implement copy_file_range syscall +- Capture source and destination file descriptors +- Track byte count copied +- Location: internal/eventloop.go:353 + +### 4. Implement mmap/msync syscalls +- Track memory-mapped file operations +- Capture file descriptor and memory addresses +- Location: internal/eventloop.go:356 + +### 5. Implement sync_file_range syscall +- Capture file descriptor and range parameters +- Track selective file synchronization +- Location: internal/eventloop.go:358 + +## Low Priority (Less common syscalls) + +### 6. Implement open_by_handle_at syscall +- Handle file access by handle +- Location: internal/eventloop.go:354 + +### 7. Implement name_to_handle_at syscall +- Convert pathname to handle +- Location: internal/eventloop.go:355 + +### 8. Implement getcwd syscall +- Track current working directory queries +- Location: internal/eventloop.go:357 + +### 9. Add sys_enter_open_by_handle_at to BPF +- Update BPF tracepoint generation +- Location: internal/c/generate_tracepoints_c.raku:5 + +### 10. Enhance io_uring_enter capture with FD tracking +- Currently captured but without file descriptor context +- Location: internal/eventloop.go:359 + +## General Improvements + +### 11. Write comprehensive unit tests +- Increase overall test coverage +- Location: internal/ior.go:21 + +### 12. Write integration tests +- Use C/Cgo to simulate real I/O operations +- Test end-to-end functionality +- Location: internal/ior.go:22 + +## Completed Tasks ✓ + +All previously listed test cases have been implemented: +- Helper functions for all event types +- Test cases for all basic syscalls +- File descriptor lifecycle tests +- Edge case handling tests +- Filtering and comm tracking tests
\ No newline at end of file diff --git a/internal/eventloop.go b/internal/eventloop.go index 679d69f..9a64647 100644 --- a/internal/eventloop.go +++ b/internal/eventloop.go @@ -219,13 +219,11 @@ func (e *eventLoop) tracepointExited(exitEv event.Event, ch chan<- *event.Pair) } e.comms[openEv.Tid] = comm - // TODO: Unit test this case *NameEvent: nameEvent := ep.EnterEv.(*NameEvent) ep.File = file.NewOldnameNewname(nameEvent.Oldname[:], nameEvent.Newname[:]) ep.Comm = e.comm(ep.EnterEv.GetTid()) - // TODO: Unit test this case *PathEvent: nameEvent := ep.EnterEv.(*PathEvent) if ep.Is(SYS_ENTER_CREAT) { @@ -240,7 +238,6 @@ func (e *eventLoop) tracepointExited(exitEv event.Event, ch chan<- *event.Pair) } ep.Comm = e.comm(ep.EnterEv.GetTid()) - // TODO: Unit test this case *FdEvent: fd := ep.EnterEv.(*FdEvent).Fd if file_, ok := e.files[fd]; ok { @@ -268,7 +265,6 @@ func (e *eventLoop) tracepointExited(exitEv event.Event, ch chan<- *event.Pair) } } - // TODO: Unit test this case *Dup3Event: dup3Event := ep.EnterEv.(*Dup3Event) fd := int32(dup3Event.Fd) @@ -294,7 +290,6 @@ func (e *eventLoop) tracepointExited(exitEv event.Event, ch chan<- *event.Pair) e.files[newFd] = duppedFdFile } - // TODO: Unit test this case *NullEvent: ep.Comm = e.comm(ep.EnterEv.GetTid()) if !e.filter.eventPair(ep) { |
