Skip to content

Commit a356642

Browse files
Merge pull request #81 from dreamer-coding/upgrade_commands
Upgrade commands and summary
2 parents 643502c + 03da56e commit a356642

File tree

10 files changed

+694
-265
lines changed

10 files changed

+694
-265
lines changed

.github/workflows/meson_ci.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@ on:
55
paths:
66
- "**.c"
77
- "**.h"
8-
- "**.cpp"
9-
- "**.hpp"
108
- "**.py"
119
- "**.build"
1210
- "**.options"
1311
pull_request:
1412
paths:
1513
- "**.c"
1614
- "**.h"
17-
- "**.cpp"
18-
- "**.hpp"
1915
- "**.py"
2016
- "**.build"
2117
- "**.options"
@@ -26,7 +22,7 @@ jobs:
2622
runs-on: windows-latest
2723
strategy:
2824
matrix:
29-
msvc_version: [2015, 2017, 2019, 2022]
25+
msvc_version: [2015, 2017, 2019, 2022, 2025]
3026
steps:
3127
- name: Checkout code
3228
uses: actions/checkout@v4
@@ -51,6 +47,8 @@ jobs:
5147
choco install visualstudio2019buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --includeOptional --passive"
5248
} elseif ($env:msvc_version -eq "2022") {
5349
choco install visualstudio2022buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --includeOptional --passive"
50+
} elseif ($env:msvc_version -eq "2025") {
51+
choco install visualstudio2025buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --includeOptional --passive"
5452
}
5553
$env:CC="cl.exe"
5654
$env:CXX="cl.exe"
@@ -62,7 +60,7 @@ jobs:
6260
run: meson compile -C builddir_msvc_${{ matrix.msvc_version }}
6361

6462
- name: Run Tests
65-
run: meson test -C builddir_msvc_${{ matrix.msvc_version }} -v
63+
run: meson test -C builddir_msvc_${{ matrix.msvc_version }} -v --test-arg='summary ci'
6664

6765
- name: Upload Test Log
6866
if: failure()
@@ -102,7 +100,7 @@ jobs:
102100
run: meson compile -C builddir
103101

104102
- name: Run Tests
105-
run: meson test -C builddir -v
103+
run: meson test -C builddir -v --test-arg='summary ci'
106104

107105
- name: Upload Test Log
108106
if: failure()
@@ -149,7 +147,7 @@ jobs:
149147
run: meson compile -C builddir
150148

151149
- name: Run Tests
152-
run: meson test -C builddir -v
150+
run: meson test -C builddir -v --test-arg='summary ci'
153151

154152
- name: Upload Test Log
155153
if: failure()
@@ -200,7 +198,7 @@ jobs:
200198
run: meson compile -C builddir
201199

202200
- name: Run Tests
203-
run: meson test -C builddir -v
201+
run: meson test -C builddir -v --test-arg='summary ci'
204202

205203
- name: Upload Test Log
206204
if: failure()
@@ -250,7 +248,7 @@ jobs:
250248
sudo apt update
251249
meson setup builddir --fatal-meson-warnings -Dwerror=true -Dwith_test=enabled -Dwarning_level=3
252250
meson compile -C builddir
253-
meson test -C builddir -v"
251+
meson test -C builddir -v --test-arg='summary ci'"
254252
255253
build_cross:
256254
name: Building on Bedrock ${{ matrix.architecture }}
@@ -344,4 +342,9 @@ jobs:
344342
345343
- name: Build the Project
346344
run: |
347-
meson compile -C builddir
345+
meson compile -C builddir -v
346+
347+
- name: Test the Project
348+
run: |
349+
meson test -C builddir -v --test-arg='summary ci'
350+

README.md

Lines changed: 10 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ To get started with Fossil Test, ensure you have the following installed:
5757
# ======================
5858
[wrap-git]
5959
url = https://github.com/fossillogic/fossil-test.git
60-
revision = v1.1.8
60+
revision = v1.2.0
6161

6262
[provide]
6363
fossil-test = fossil_test_dep
@@ -79,87 +79,18 @@ The Fossil Test CLI provides an efficient way to run and manage tests directly f
7979

8080
### Commands and Options
8181

82-
| Command | Description | Notes |
82+
| Command | Description | Notes |
8383
|----------------------------------|-----------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|
8484
| `--version` | Displays the current version of Fossil Test. | Useful for verifying the version of the tool in use. |
8585
| `--help` | Shows help message with usage instructions. | Provides a quick reference for all available commands. |
86-
| `--info` | Displays detailed information about the test run. | Includes information such as test count, duration, and configuration. |
87-
| `reverse [enable/disable]` | Enables or disables reverse order of test execution. | Useful for debugging or ensuring the tests don't depend on execution order. |
88-
| `shuffle [enable/disable]` | Enables or disables shuffling of test execution order. | Helps identify order-dependent issues in the test suite. |
89-
| `dry-run [enable/disable]` | Enables or disables dry run mode, showing which tests will execute without running them. | Ideal for verifying test selection criteria before actual execution. |
90-
| `repeat=<number>` | Repeats the test suite a specified number of times. | Handy for stress-testing or reproducing intermittent failures. |
91-
92-
### Key Notes Summary:
93-
- **Version**: Quickly check the installed version of Fossil Test.
94-
- **Help**: Access usage instructions and command references.
95-
- **Info**: Get detailed insights about the test run, including test count and duration.
96-
- **Reverse and Shuffle**: Help debug issues by manipulating test execution order.
97-
- **Repeat**: Ideal for reliability testing by repeatedly executing tests.
98-
- **Dry Run**: Provides a preview of the test plan without running the tests, useful for preparation and validation.
99-
100-
### Usage
101-
102-
To use the Fossil Test CLI, navigate to your project directory and run the desired command. For example, to check the version of Fossil Test, use:
103-
104-
```sh
105-
fossil-test --version
106-
```
107-
108-
To display help information, use:
109-
110-
```sh
111-
fossil-test --help
112-
```
113-
114-
For detailed information about the test run, use:
115-
116-
```sh
117-
fossil-test --info
118-
```
119-
120-
To enable reverse order of test execution, use:
121-
122-
```sh
123-
fossil-test reverse enable
124-
```
125-
126-
To disable reverse order of test execution, use:
127-
128-
```sh
129-
fossil-test reverse disable
130-
```
131-
132-
To enable shuffling of test execution order, use:
133-
134-
```sh
135-
fossil-test shuffle enable
136-
```
137-
138-
To disable shuffling of test execution order, use:
139-
140-
```sh
141-
fossil-test shuffle disable
142-
```
143-
144-
To perform a dry run, use:
145-
146-
```sh
147-
fossil-test dry-run enable
148-
```
149-
150-
To disable dry run mode, use:
151-
152-
```sh
153-
fossil-test dry-run disable
154-
```
155-
156-
To repeat the test suite a specified number of times, use:
157-
158-
```sh
159-
fossil-test repeat=<number>
160-
```
161-
162-
---
86+
| `--info` | Displays detailed information about the test run. | Includes information such as test count, duration, and configuration. |
87+
| `reverse [enable/disable]` | Enables or disables reverse order of test execution. | Useful for debugging or ensuring the tests don't depend on execution order. |
88+
| `shuffle [enable/disable]` | Enables or disables shuffling of test execution order. | Helps identify order-dependent issues in the test suite. |
89+
| `dry-run [enable/disable]` | Enables or disables dry run mode, showing which tests will execute without running them. | Ideal for verifying test selection criteria before actual execution. |
90+
| `repeat <number>` | Repeats the test suite a specified number of times. | Handy for stress-testing or reproducing intermittent failures. |
91+
| `color [enable/disable]` | Enables or disables colored output. | Enhances readability in supported terminals. |
92+
| `format <plain, ci, jellyfish>` | Selects the output format for test results. | Affects how test data is displayed; useful for visual or machine-parsed output. |
93+
| `summary <plain, ci, jellyfish>` | Sets the level of summary output after test execution. | `ci` is minimal, `jellyfish` is smart test mode, and `plain` is default classic. |
16394

16495
## Configure Build Options
16596

code/logic/fossil/test/internal.h

Lines changed: 85 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,38 +17,51 @@
1717

1818
#define MAX_NAME_LENGTH 256
1919

20-
// Color codes
21-
#define FOSSIL_TEST_COLOR_RESET "\033[0m" // Reset
22-
#define FOSSIL_TEST_COLOR_GREEN "\033[32m" // Green
23-
#define FOSSIL_TEST_COLOR_RED "\033[31m" // Red
24-
#define FOSSIL_TEST_COLOR_YELLOW "\033[33m" // Yellow
25-
#define FOSSIL_TEST_COLOR_BLUE "\033[34m" // Blue
26-
#define FOSSIL_TEST_COLOR_MAGENTA "\033[35m" // Magenta
27-
#define FOSSIL_TEST_COLOR_CYAN "\033[36m" // Cyan
28-
#define FOSSIL_TEST_COLOR_WHITE "\033[97m" // White
29-
#define FOSSIL_TEST_COLOR_PURPLE "\033[35m" // Purple
30-
#define FOSSIL_TEST_COLOR_ORANGE "\033[38;5;208m" // Orange
31-
32-
#define FOSSIL_TEST_ATTR_BOLD "\033[1m" // Bold
33-
#define FOSSIL_TEST_ATTR_DIM "\033[2m" // Dim
34-
#define FOSSIL_TEST_ATTR_UNDERLINE "\033[4m" // Underline
35-
#define FOSSIL_TEST_ATTR_ITALIC "\033[3m" // Italic
36-
#define FOSSIL_TEST_ATTR_REVERSE "\033[7m" // Reverse
37-
#define FOSSIL_TEST_ATTR_STRIKETHROUGH "\033[9m" // Strikethrough
38-
3920
#include <setjmp.h>
4021
#include <stddef.h>
22+
#include <stdarg.h>
4123
#include <stdlib.h>
4224
#include <stdio.h>
4325
#include <string.h>
4426
#include <stdbool.h>
4527
#include <stdint.h>
4628
#include <time.h>
29+
#include <float.h>
30+
31+
// Define color codes for output
32+
#define FOSSIL_TEST_COLOR_RESET "\033[0m"
33+
#define FOSSIL_TEST_COLOR_RED "\033[31m"
34+
#define FOSSIL_TEST_COLOR_GREEN "\033[32m"
35+
#define FOSSIL_TEST_COLOR_YELLOW "\033[33m"
36+
#define FOSSIL_TEST_COLOR_BLUE "\033[34m"
37+
#define FOSSIL_TEST_COLOR_MAGENTA "\033[35m"
38+
#define FOSSIL_TEST_COLOR_CYAN "\033[36m"
39+
#define FOSSIL_TEST_COLOR_WHITE "\033[37m"
40+
41+
// Define text attributes
42+
#define FOSSIL_TEST_ATTR_BOLD "\033[1m"
43+
#define FOSSIL_TEST_ATTR_UNDERLINE "\033[4m"
44+
#define FOSSIL_TEST_ATTR_REVERSED "\033[7m"
45+
#define FOSSIL_TEST_ATTR_BLINK "\033[5m"
46+
#define FOSSIL_TEST_ATTR_HIDDEN "\033[8m"
47+
#define FOSSIL_TEST_ATTR_NORMAL "\033[22m"
4748

4849
#ifdef __cplusplus
4950
extern "C" {
5051
#endif
5152

53+
typedef enum {
54+
FOSSIL_TEST_FORMAT_PLAIN,
55+
FOSSIL_TEST_FORMAT_CI,
56+
FOSSIL_TEST_FORMAT_JELLYFISH
57+
} fossil_test_format_t;
58+
59+
typedef enum {
60+
FOSSIL_TEST_SUMMARY_PLAIN,
61+
FOSSIL_TEST_SUMMARY_CI,
62+
FOSSIL_TEST_SUMMARY_JELLYFISH
63+
} fossil_test_summary_t;
64+
5265
/**
5366
* @struct fossil_test_options_t
5467
* @brief Structure to hold various options for fossil testing.
@@ -79,6 +92,14 @@ extern "C" {
7992
* @var fossil_test_options_t::dry_run
8093
* Flag to indicate if the tests should be run in dry-run mode (no actual execution).
8194
*
95+
* @var fossil_test_options_t::fail_fast
96+
* Flag to enable fail-fast behavior, stopping test execution after the first failure.
97+
*
98+
* @var fossil_test_options_t::quiet
99+
* Flag to suppress most non-essential output for minimal console logging.
100+
*
101+
* @var fossil_test_options_t::color_output
102+
* Flag to enable or disable colorized output in the console.
82103
*/
83104
typedef struct {
84105
bool show_version;
@@ -89,8 +110,53 @@ typedef struct {
89110
int32_t repeat_count;
90111
bool shuffle_enabled;
91112
bool dry_run;
113+
bool color_output;
114+
fossil_test_summary_t summary; // Replaces 'quiet'
115+
fossil_test_format_t format; // Store the format type
92116
} fossil_test_options_t;
93117

118+
/**
119+
* Prints a string to the output.
120+
*
121+
* @param str The string to be printed.
122+
*/
123+
void internal_test_puts(const char *str);
124+
125+
/**
126+
* Prints a formatted string to the output.
127+
*
128+
* @param format The format string.
129+
* @param ... The additional arguments to be formatted.
130+
*/
131+
void internal_test_printf(const char *format, ...);
132+
133+
/**
134+
* Prints a string to the output with a specified color.
135+
*
136+
* @param color The color code to be applied.
137+
* @param format The format string.
138+
* @param ... The additional arguments to be formatted.
139+
*/
140+
void internal_test_print_color(const char *color, const char *format, ...);
141+
142+
/**
143+
* Prints a character to the output.
144+
*
145+
* @param c The character to be printed.
146+
*/
147+
void internal_test_putchar(char c);
148+
149+
/**
150+
* Prints a character to the output with a specified color.
151+
*
152+
* @param c The character to be printed.
153+
* @param color The color code to be applied.
154+
*/
155+
void internal_test_putchar_color(char c, const char *color);
156+
157+
// Set global color output flag
158+
void internal_test_set_color_output(bool enabled);
159+
94160
#ifdef __cplusplus
95161
}
96162
#endif

code/logic/fossil/test/marking.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
#ifndef FOSSIL_MARK_BENCHMARK_H
1616
#define FOSSIL_MARK_BENCHMARK_H
1717

18-
#include <stdio.h>
19-
#include <stdint.h>
20-
#include <time.h>
21-
#include <float.h>
18+
#include "internal.h"
2219

2320
#ifdef __cplusplus
2421
extern "C" {

code/logic/fossil/test/mocking.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@
1717
#ifndef FOSSIL_MOCK_MOCKUP_H
1818
#define FOSSIL_MOCK_MOCKUP_H
1919

20-
#include <stdio.h>
21-
#include <stdlib.h>
22-
#include <stddef.h>
23-
#include <stdbool.h>
24-
#include <string.h>
20+
#include "internal.h"
2521

2622
#ifdef __cplusplus
2723
extern "C" {

0 commit comments

Comments
 (0)