Skip to content

Commit 2a9b31b

Browse files
authored
Update catch from v2.x to v3.x. CC Based on OS
* macos-12 workflow * test macos-latest-large * macos-latest * ubuntu-latest * g++-13 -> g++ * macos-latest with g++ instead g++-13 * macos-latest only * ubuntu-24.04 beta * CC makefile variable * macos-latest * easier testing * Upgrade Catch2 v2.x to 3.x * ubuntu-latest, all tests * c++17 standard * c++14 standard * ubuntu only * macos-latest only * ubuntu-latest * g++ instead of alias * test * clang * g++-13 test * check os in makefile * Add ubuntu-latest * d * d * conditional CC * delete catch files and add java tests
1 parent ed89fc5 commit 2a9b31b

31 files changed

+11840
-290
lines changed

.github/workflows/test_suite.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
name: Testing C-Runtime
1010
strategy:
1111
matrix:
12-
os: [ubuntu-latest, macos-latest]
12+
os: [macos-latest, ubuntu-latest]
1313
runs-on: ${{ matrix.os }}
1414
steps:
1515
- name: Checkout
@@ -25,18 +25,18 @@ jobs:
2525
run: make test_clean ; make clean
2626

2727
languagefeatures:
28-
name: Testing CBuilder (Java)
29-
strategy:
30-
matrix:
31-
os: [ubuntu-latest, macos-latest]
32-
runs-on: ${{ matrix.os }}
33-
steps:
34-
- name: Checkout
35-
uses: actions/checkout@v4
36-
- name: Set up JDK 21
37-
uses: actions/setup-java@v4
38-
with:
39-
java-version: '21'
40-
distribution: 'temurin'
41-
- name: Build with Gradle
42-
run: ./gradlew test
28+
name: Testing CBuilder (Java)
29+
strategy:
30+
matrix:
31+
os: [ubuntu-latest, macos-latest]
32+
runs-on: ${{ matrix.os }}
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
- name: Set up JDK 21
37+
uses: actions/setup-java@v4
38+
with:
39+
java-version: '21'
40+
distribution: 'temurin'
41+
- name: Build with Gradle
42+
run: ./gradlew test

c-runtime/Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export TESTDIR := $(realpath ./test)
1616
export INCLUDEDIRTEST := $(realpath ./test/include)
1717
export SRCDIRTEST := $(realpath ./test/src)
1818

19-
export C_FILES_TEST := $(wildcard ./test/src/test/*.c ./test/src/test/*/*.c* ./src/*.c ./src/*/*.c*)
19+
export C_FILES_TEST := $(wildcard ./test/src/test/*.c ./test/src/test/*/*.c* ./test/src/*.cpp)
2020
export C_FILES_TEST := $(filter-out ./src/program.c, $(C_FILES_TEST))
2121
export C_FILES := $(wildcard ./src/*.c ./src/*/*.c*)
2222
export C_FILES := $(filter-out ./src/program.c, $(C_FILES))
@@ -104,7 +104,8 @@ lint:
104104
#https://github.com/catchorg/Catch2/blob/v2.x/include/catch.hpp
105105
.PHONY: curl_catch
106106
curl_catch:
107-
curl -o $(TESTDIR)/include/catch.hpp https://github.com/catchorg/Catch2/v2.x/single_include/catch2/catch.hpp
107+
curl -o $(TESTDIR)/include/catch_amalgamated.hpp https://github.com/catchorg/Catch2/devel/extras/catch_amalgamated.hpp
108+
curl -o $(TESTDIR)/src/catch_amalgamated.cpp https://github.com/catchorg/Catch2/devel/extras/catch_amalgamated.cpp
108109

109110
.PHONY: test
110111
test: curl_catch
@@ -130,11 +131,11 @@ test_run:
130131
.PHONY: test_target
131132
test_target: curl_catch
132133
d=$$(date +%s)\
133-
; make -f $(TESTDIR)/Systemtests/makefile test_greater_equal_op \
134+
; make -f $(TESTDIR)/Systemtests/makefile test_declaration_and_assignment \
134135
&& echo "Build took $$(($$(date +%s)-d)) seconds"
135136
make run_target
136137
make test_clean
137138

138139
.PHONY: run_target
139140
run_target:
140-
./test/Systemtests/ComparisonOps/TestGreaterEqualOp.out
141+
./test/Systemtests/DeclarationAndAssignment/TestDeclarationAndAssignment.out

c-runtime/test/Systemtests/ArithmeticOps/TestArithmeticOps.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include <stddef.h>
44

5-
#include "catch.hpp"
5+
#include "catch_amalgamated.hpp"
66
#include "assert.h"
77
#include "mpy_aliases.h"
88
#include "mpy_obj.h"

c-runtime/test/Systemtests/BuiltInFunctions/TestCastInt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include <stddef.h>
44

5-
#include "catch.hpp"
5+
#include "catch_amalgamated.hpp"
66
#include "assert.h"
77
#include "mpy_aliases.h"
88
#include "mpy_obj.h"

c-runtime/test/Systemtests/BuiltInFunctions/TestCastString.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include <stddef.h>
44

5-
#include "catch.hpp"
5+
#include "catch_amalgamated.hpp"
66
#include "assert.h"
77
#include "mpy_aliases.h"
88
#include "mpy_obj.h"

c-runtime/test/Systemtests/BuiltInFunctions/TestId.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#include <stddef.h>
77

8-
#include "catch.hpp"
8+
#include "catch_amalgamated.hpp"
99
#include "assert.h"
1010
#include "mpy_aliases.h"
1111
#include "mpy_obj.h"

c-runtime/test/Systemtests/BuiltInFunctions/TestPrint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#include <stddef.h>
99

10-
#include "catch.hpp"
10+
#include "catch_amalgamated.hpp"
1111
#include "assert.h"
1212
#include "mpy_aliases.h"
1313
#include "mpy_obj.h"

c-runtime/test/Systemtests/BuiltInFunctions/TestType.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include <stddef.h>
44

5-
#include "catch.hpp"
5+
#include "catch_amalgamated.hpp"
66
#include "assert.h"
77
#include "mpy_aliases.h"
88
#include "mpy_obj.h"

c-runtime/test/Systemtests/Classes/TestClassInheritance.cpp

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,19 @@
1-
#define CATCH_CONFIG_RUNNER
1+
#define CATCH_CONFIG_MAIN
22

33
#include <stddef.h>
44

5-
#include "catch.hpp"
5+
#include "catch_amalgamated.hpp"
66
#include "test/test_helpers.h"
77
#include "test/Classes/TestClassInheritanceHelpers.h"
88

99
__MPyObj *A;
1010

1111
__MPyObj *B;
1212

13-
int main( int argc, char* argv[] ) {
14-
// global setup...
15-
__mpy_builtins_setup();
16-
17-
int result = 0;
18-
19-
try{
20-
result = Catch::Session().run( argc, argv );
21-
}
22-
catch (const std::runtime_error& error){
23-
printf("");
24-
}
25-
26-
__mpy_builtins_cleanup();
27-
// global clean-up... Why is this working ? ....
28-
29-
return result;
30-
}
31-
3213
int inheritance(){
3314
__MPyObj *child;
3415

16+
__mpy_builtins_setup();
3517
child = __mpy_obj_init_object();
3618
__mpy_obj_ref_inc(child);
3719

@@ -65,6 +47,8 @@ int inheritance(){
6547
__mpy_obj_ref_dec(A);
6648
__mpy_obj_ref_dec(B);
6749

50+
__mpy_builtins_cleanup();
51+
6852
return 0;
6953
}
7054

c-runtime/test/Systemtests/Classes/TestClassInit.cpp

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#define CATCH_CONFIG_RUNNER
1+
#define CATCH_CONFIG_MAIN
22

33
#include <stddef.h>
44

5-
#include "catch.hpp"
5+
#include "catch_amalgamated.hpp"
66
#include "test/test_helpers.h"
77
#include "test/Classes/TestClassInitHelpers.h"
88

@@ -12,28 +12,12 @@ __MPyObj *init_one_param;
1212

1313
__MPyObj *init_multiple_params;
1414

15-
int main( int argc, char* argv[] ) {
16-
// global setup...
17-
__mpy_builtins_setup();
18-
19-
int result = 0;
20-
21-
try{
22-
result = Catch::Session().run( argc, argv );
23-
}
24-
catch (const std::runtime_error& error){
25-
printf("");
26-
}
27-
28-
__mpy_builtins_cleanup();
29-
// global clean-up... Why is this working ? ....
30-
31-
return result;
32-
}
33-
3415
int init_class_no_params(){
3516
__MPyObj *x;
3617

18+
__mpy_builtins_setup();
19+
20+
__mpy_builtins_setup();
3721
x = __mpy_obj_init_object();
3822
__mpy_obj_ref_inc(x);
3923

@@ -58,12 +42,15 @@ int init_class_no_params(){
5842

5943
__mpy_obj_ref_dec(init_no_params);
6044

45+
__mpy_builtins_cleanup();
46+
6147
return 0;
6248
}
6349

6450
int init_class_one_param(){
6551
__MPyObj *x;
6652

53+
__mpy_builtins_setup();
6754
x = __mpy_obj_init_object();
6855
__mpy_obj_ref_inc(x);
6956

@@ -89,12 +76,15 @@ int init_class_one_param(){
8976

9077
print_mpyobj(x);
9178

79+
__mpy_builtins_cleanup();
80+
9281
return 0;
9382
}
9483

9584
int init_class_multiple_params(){
9685
__MPyObj *x;
9786

87+
__mpy_builtins_setup();
9888
x = __mpy_obj_init_object();
9989
__mpy_obj_ref_inc(x);
10090

@@ -119,6 +109,8 @@ int init_class_multiple_params(){
119109

120110
print_mpyobj(x);
121111

112+
__mpy_builtins_cleanup();
113+
122114
return 0;
123115
}
124116

0 commit comments

Comments
 (0)