Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Linux

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build-and-test:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: "Linux GCC"
compiler: gcc
cmake-generator: 'Ninja'
cmake-options: '-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++'

- name: "Linux Clang"
compiler: clang
cmake-generator: 'Ninja'
cmake-options: '-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++'

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Install ninja-build
run: |
sudo apt-get update
sudo apt-get install -y ninja-build
shell: bash

- name: Configure CMake
run: |
cmake -B build -G "${{ matrix.cmake-generator }}" ${{ matrix.cmake-options }}
shell: bash

- name: Build
run: |
cmake --build build --config Release
shell: bash

- name: Run tests
working-directory: build
run: |
./tests/testcoe_tests
shell: bash
47 changes: 47 additions & 0 deletions .github/workflows/ci-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: macOS

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build-and-test:
name: ${{ matrix.name }}
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
include:
- name: "macOS Clang"
compiler: clang
cmake-generator: 'Ninja'
cmake-options: ''

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Install ninja-build
run: |
brew install ninja
shell: bash

- name: Configure CMake
run: |
cmake -B build -G "${{ matrix.cmake-generator }}" ${{ matrix.cmake-options }}
shell: bash

- name: Build
run: |
cmake --build build --config Release
shell: bash

- name: Run tests
working-directory: build/tests
run: |
./testcoe_tests
shell: bash
86 changes: 86 additions & 0 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Windows

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build-and-test:
name: ${{ matrix.name }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- name: "Windows MSVC"
compiler: msvc
cmake-generator: 'Visual Studio 17 2022'
cmake-options: ''

- name: "Windows MinGW"
compiler: gcc
cmake-generator: 'MinGW Makefiles'
cmake-options: '-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++'

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Install Windows build tools
if: matrix.compiler != 'msvc'
run: |
choco install mingw
shell: bash

- name: Configure CMake
run: |
cmake -B build -G "${{ matrix.cmake-generator }}" ${{ matrix.cmake-options }}
shell: bash

- name: Build
run: |
cmake --build build --config Release
shell: bash

- name: Copy MinGW DLLs
if: matrix.compiler == 'gcc'
run: |
# Find GCC directory
GCC_DIR=$(dirname $(which gcc))
echo "GCC directory: $GCC_DIR"

# Copy DLLs to test directory
echo "Copying DLLs to tests directory"
cp "$GCC_DIR"/libgcc*.dll build/tests/ 2>/dev/null || echo "No libgcc DLLs found"
cp "$GCC_DIR"/libstdc*.dll build/tests/ 2>/dev/null || echo "No libstdc DLLs found"
cp "$GCC_DIR"/libwinpthread*.dll build/tests/ 2>/dev/null || echo "No libwinpthread DLLs found"

# Copy DLLs to example directories
echo "Copying DLLs to example directories"
for dir in build/examples/basic build/examples/filter build/examples/crash; do
echo "Copying to $dir"
cp "$GCC_DIR"/libgcc*.dll "$dir/" 2>/dev/null || echo "No libgcc DLLs found"
cp "$GCC_DIR"/libstdc*.dll "$dir/" 2>/dev/null || echo "No libstdc DLLs found"
cp "$GCC_DIR"/libwinpthread*.dll "$dir/" 2>/dev/null || echo "No libwinpthread DLLs found"
done

# List files to verify
echo "Files in build/tests:"
ls -la build/tests/*.dll || echo "No DLLs in tests"
echo "Files in build/examples/basic:"
ls -la build/examples/basic/*.dll || echo "No DLLs in basic"
shell: bash

- name: Run tests
working-directory: build
run: |
if [ "${{ matrix.compiler }}" == "gcc" ]; then
./tests/testcoe_tests.exe
else
./tests/Release/testcoe_tests.exe
fi
shell: bash
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if(MSVC)
# Ensure debug symbols are generated and linked
add_compile_options(/Zi)
add_link_options(/DEBUG)
# Keep debug info in release builds too for stack traces
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# Enhanced debug info for GCC/Clang
add_compile_options(-g3 -fno-omit-frame-pointer)
endif()

# googletest
find_package(GTest QUIET)
if(GTest_FOUND)
Expand All @@ -31,6 +43,11 @@ set(STACK_WALKING_UNWIND TRUE CACHE BOOL "Use unwind for stack walking" FORCE)
set(STACK_DETAILS_AUTO_DETECT FALSE CACHE BOOL "Auto detect backward details" FORCE)
set(STACK_DETAILS_BACKTRACE_SYMBOL TRUE CACHE BOOL "Use backtrace symbols" FORCE)

# Windows-specific enhancements for better stack traces
if(WIN32)
set(BACKWARD_HAS_DBGHELP 1 CACHE BOOL "Enable Windows DbgHelp for better stack traces" FORCE)
endif()

find_package(Backward QUIET)
if(Backward_FOUND)
message(STATUS "[testcoe] Using existing Backward-cpp installation")
Expand Down
98 changes: 98 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# testcoe

Visual test progress and crash handling for Google Test.

[![Windows](https://github.com/nircoe/testcoe/actions/workflows/ci-windows.yml/badge.svg)](https://github.com/nircoe/testcoe/actions/workflows/ci-windows.yml)
[![Linux](https://github.com/nircoe/testcoe/actions/workflows/ci-linux.yml/badge.svg)](https://github.com/nircoe/testcoe/actions/workflows/ci-linux.yml)
[![macOS](https://github.com/nircoe/testcoe/actions/workflows/ci-macos.yml/badge.svg)](https://github.com/nircoe/testcoe/actions/workflows/ci-macos.yml)

## What is testcoe?

testcoe enhances Google Test with real-time grid visualization and crash reporting:

```
Running 12 tests... Completed: 8/12 (P: 6, F: 2)
P - Passed, F - Failed, R - Running, . - Not run yet

MathTests PPF.. (3/5)
StringTests PRPP. (4/5)
VectorTests .... (0/2)
```

When tests crash, you get detailed stack traces instead of silent failures.

## Quick Start

### 1. Add to your project (CMake)

```cmake
include(FetchContent)
FetchContent_Declare(
testcoe
GIT_REPOSITORY https://github.com/nircoe/testcoe.git
GIT_TAG v0.1.0
)
FetchContent_MakeAvailable(testcoe)

target_link_libraries(your_test_executable PRIVATE testcoe)
```

### 2. Use in your tests

```cpp
#include <testcoe.hpp>

int main(int argc, char** argv) {
testcoe::init(&argc, argv);
return testcoe::run();
}
```

That's it! Run your tests and see the enhanced output.

## Features

- 🎯 **Grid Visualization** - See all tests progress in real-time
- 🛡️ **Crash Handling** - Get stack traces when tests crash
- 🎨 **Color Support** - Automatic terminal detection
- 🔍 **Test Filtering** - Run specific tests or suites
- 📦 **Zero Config** - Works out of the box with Google Test

## Examples

See the [examples/](examples/) directory for demonstrations:
- [Basic usage](examples/basic/) - Grid visualization
- [Crash handling](examples/crash/) - Stack traces on crashes
- [Test filtering](examples/filter/) - Running specific tests

## Requirements

- C++17 or later
- CMake 3.14+
- Google Test (automatically included)

## API Reference

```cpp
// Initialize testcoe
testcoe::init(&argc, argv);

// Run all tests
testcoe::run();

// Run specific suite
testcoe::run_suite("MathTests");

// Run specific test
testcoe::run_test("MathTests", "Addition");
```

## Documentation

- [Architecture](docs/ARCHITECTURE.md) - How testcoe works internally
- [Contributing](docs/CONTRIBUTING.md) - Development setup and guidelines
- [Roadmap](docs/ROADMAP.md) - Version history and future plans

## License

MIT License - see [LICENSE](LICENSE) file for details.
Loading
Loading