8000 minimise test compilation time; add test script and actions CI file · Z80coder/datalog-cpp@e3668d2 · GitHub
[go: up one dir, main page]

Skip to content

Commit e3668d2

Browse files
committed
minimise test compilation time; add test script and actions CI file
1 parent 1cf923e commit e3668d2

File tree

6 files changed

+34
-6
lines changed

6 files changed

+34
-6
lines changed

.github/workflows/linux_check.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: CI for Linux
2+
3+
on: push
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: build
12+
run: |
13+
mkdir build && cd build
14+
cmake ../src
15+
make
16+
cd ..
17+
- name: regression test
18+
run: |
19+
cd tests
20+
pwd
21+
ls -l
22+
./run_tests.sh

src/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,17 @@ project("datalog-cpp")
2121
# specify the C++ standard
2222
set(CMAKE_CXX_STANDARD 17)
2323

24+
# unit-test library
25+
add_library(tests_main STATIC ../tests/tests_main.cpp)
26+
2427
# types_test target
2528
add_executable(types_test ../tests/types_test.cpp)
2629
target_include_directories(types_test PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
30+
target_link_libraries(types_test tests_main)
2731
target_compile_definitions(types_test PUBLIC UNIX)
2832

2933
# variable_test target
3034
add_executable(variable_test ../tests/variable_test.cpp)
3135
target_include_directories(variable_test PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
36+
target_link_libraries(variable_test tests_main)
3237
target_compile_definitions(variable_test PUBLIC UNIX)

tests/run_tests.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
set -e
3+
../build/types_test
4+
../build/variable_test

tests/tests_main.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// tests-main.cpp
2+
#define CATCH_CONFIG_MAIN
3+
#include "catch.hpp"

tests/types_test.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// Let Catch provide main():
2-
#define CATCH_CONFIG_MAIN
3-
41
#include "catch.hpp"
52
#include "Datalog.h"
63

tests/variable_test.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// Let Catch provide main():
2-
#define CATCH_CONFIG_MAIN
3-
41
#include "catch.hpp"
52
#include "Variable.h"
63

0 commit comments

Comments
 (0)
0