Skip to content

beta-v3.1.0

Pre-release
Pre-release

Choose a tag to compare

@ChaseSunstrom ChaseSunstrom released this 19 Jan 04:23
· 16 commits to master since this release

CForge Release beta-v3.1.0

Test System Overhaul & Cross-Platform Fixes

CForge beta-v3.1.0 brings significant improvements to the test runner, build progress display, and fixes critical cross-platform compatibility issues.


New Features

Cargo-Style Test Output

Test command output now matches the build system's Cargo/Rust-style formatting with right-aligned action words and consistent coloring.

Before:

Running 40 tests...
test_lockfile::parse ... ok
test_lockfile::write ... ok

After:

     Running 40 tests
     Testing test_lockfile::parse ... ok
     Testing test_lockfile::write ... ok
    Finished 40 passed, 0 failed in 1.23s

Test Build Directory Consistency

Problem: Test builds were placed in .cforge/tests/ regardless of the project's configured build directory, causing confusion and inconsistency.

Fix: Tests now respect build.build_dir from cforge.toml and output to {build_dir}/tests/{target_name}/ alongside the main project build.


Improved Build Progress Display

  • Progress bar now aligns with "Compiling" output (3-space indent)
  • Timer updates continuously every 100ms, even during silent phases like linking
  • Two-line progress display: filename on first line, progress bar on second
  • Proper cleanup when build completes (no extra blank lines)

Bug Fixes

Linux Build Failure: linux Macro Collision

Problem: On Linux, linux is a predefined macro (defined to 1), causing compilation errors:

error: expected unqualified-id before numeric constant
   84 |   platform_setup linux;
      |                  ^~~~~

Fix: Renamed the struct member from linux to linux_os in package_setup.


Test Discovery Cross-Platform Path Comparison

Problem: fs::relative() returns "." on Windows but an empty path on some Linux systems when comparing paths in the same directory, causing test discovery to fail.

Fix: Added fallback checks for empty paths and directory name comparison:

bool is_flat = files_by_dir.size() == 1 &&
               (first_rel == "." || first_rel.empty() || first_rel == test_dir.filename());

Silent Test Build Failures

Problem: When test CMake configuration or build failed, only a generic "FAILED to build tests" message was shown without the actual error.

Fix: Test runner now outputs the full CMake stdout/stderr on failure, making debugging much easier.


Test Build Directory Creation

Problem: Test build directory wasn't always created before CMake configure, causing failures on some systems.

Fix: Added explicit fs::create_directories(build_dir) before running CMake configure.


Files Changed

File Changes
include/core/registry.hpp Renamed linux to linux_os member
src/core/registry.cpp Updated linux to linux_os references
src/core/commands/command_build.cpp Updated linux to linux_os references
src/core/workspace/workspace.cpp Updated linux to linux_os references
include/core/test_runner.hpp Added m_build_base_dir, get_test_gen_dir(), get_test_build_dir()
src/core/utils/test_runner.cpp Test directory respects config, improved error output, cross-platform path fixes
src/core/utils/test_output_formatter.cpp Cargo-style output with logger::print_action()
src/cforge/log.cpp Progress bar alignment, timer display improvements

Breaking Changes

  • Test build artifacts now go to {build_dir}/tests/ instead of .cforge/tests/
  • Run cforge clean to remove the old .cforge/tests/ directory if desired

All existing workflows remain compatible.

Please report issues at github.com/ChaseSunstrom/cforge/issues