Skip to content

Dev - #6

Merged
zpeng11 merged 57 commits into
mainfrom
dev
Aug 10, 2025
Merged

Dev#6
zpeng11 merged 57 commits into
mainfrom
dev

Conversation

@zpeng11

@zpeng11 zpeng11 commented Aug 10, 2025

Copy link
Copy Markdown
Owner

No description provided.

@github-advanced-security

Copy link
Copy Markdown

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@zpeng11
zpeng11 requested a review from Copilot August 10, 2025 19:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request replaces the existing thread testing infrastructure with a comprehensive test suite for the Hohnor framework. The changes transition from an older, simpler test structure to a modern, organized testing approach with extensive coverage across all major components.

Key changes:

  • Complete replacement of old thread test files with comprehensive test suites
  • Addition of test coverage for time, process, I/O, file, and core components
  • Implementation of proper test organization with separate test files for each component
  • Introduction of modern testing patterns with proper setup/teardown and atomic synchronization

Reviewed Changes

Copilot reviewed 140 out of 158 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/time/Timestamp_test.cpp Comprehensive tests for timestamp functionality including construction, formatting, and arithmetic operations
test/time/Date_test.cpp Tests for date handling, validation, and conversion operations
test/thread/*.cpp Modern thread testing suite replacing old infrastructure with proper synchronization and lifecycle testing
test/process/ProcessInfo_test.cpp Tests for process information gathering including CPU time, memory usage, and system parameters
test/io/*.cpp I/O system tests covering epoll, file descriptors, and utilities
test/file/*.cpp File operation tests including logging, utilities, and file handling
test/core/*.cpp Core framework tests for event loops, timers, signals, and I/O handlers
test/common/circularbuffertest.cpp Removal of old circular buffer test
test/thread/CMakeLists.txt Removal of old CMake configuration

bool thread_ran = false;
Thread t1([&]() {
thread_ran = true;
CurrentThread::sleepUsec(50 ); // 50ms

Copilot AI Aug 10, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sleep duration is only 50 microseconds, which may be too short. The comment indicates 50ms but the value suggests 50 microseconds. Consider using 50 * 1000 for consistency with other tests.

Suggested change
CurrentThread::sleepUsec(50 ); // 50ms
CurrentThread::sleepUsec(50 * 1000); // 50ms

Copilot uses AI. Check for mistakes.
pool.run([&taskCount]() {
taskCount++;
// Simulate some work
volatile int dummy = 0;

Copilot AI Aug 10, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 'volatile' for simple loop work is not recommended in modern C++. Consider using std::atomic or a more appropriate mechanism for preventing optimization.

Suggested change
volatile int dummy = 0;
std::atomic<int> dummy(0);

Copilot uses AI. Check for mistakes.
Comment thread test/io/FdUtils_test.cpp
TEST_F(FdGuardTest, NonCopyable) {
// FdGuard should inherit from NonCopyable
// This is a compile-time test - if it compiles, the test passes
static_assert(std::is_base_of<NonCopyable, FdGuard>::value, "Epoll must derive from FdGuard");

Copilot AI Aug 10, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The static_assert error message says "Epoll must derive from FdGuard" but should say "FdGuard must derive from NonCopyable" to match the actual assertion being tested.

Suggested change
static_assert(std::is_base_of<NonCopyable, FdGuard>::value, "Epoll must derive from FdGuard");
static_assert(std::is_base_of<NonCopyable, FdGuard>::value, "FdGuard must derive from NonCopyable");

Copilot uses AI. Check for mistakes.
@zpeng11
zpeng11 merged commit cca8a76 into main Aug 10, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants