Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Disservin committed Dec 17, 2023
1 parent 8bee16b commit e0669a2
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 4 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/chess-library.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,36 @@ jobs:
ChessLibrary:
name: Chess Library
runs-on: ubuntu-latest
strategy:
matrix:
id: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v3
- name: Installing required packages
run: |
sudo apt-get update
g++ --version
- name: Running Tests
- name: Normal Tests
if: matrix.id == 1
run: |
make -j2
./chess-library-tests
- name: ASAN Tests
if: matrix.id == 2
run: |
make -j2
./chess-library-tests san=asan
- name: Memory Tests
if: matrix.id == 3
run: |
make -j2
./chess-library-tests san=memory
- name: Undefined Tests
if: matrix.id == 4
run: |
make -j2
./chess-library-tests
./chess-library-tests san=undefined
20 changes: 18 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CXX = g++
NATIVE = -march=native
CXXFLAGS = -O3 -flto -std=c++17 -Wall -Wextra
LDFLAGS =

# Detect Windows
ifeq ($(OS), Windows_NT)
Expand All @@ -13,11 +14,26 @@ ifeq ($(uname_S), Darwin)
NATIVE =
endif

# Compile with address sanitizer
ifeq ($(san), asan)
LDFLAGS += -fsanitize=address
endif

# Compile with memory sanitizer
ifeq ($(san), memory)
LDFLAGS += -fsanitize=memory -fPIE -pie
endif

# Compile with undefined behavior sanitizer
ifeq ($(san), undefined)
LDFLAGS += -fsanitize=undefined
endif

default:
$(CXX) $(NATIVE) $(CXXFLAGS) -g3 -fno-omit-frame-pointer ./tests/*.cpp -o chess-library-tests
$(CXX) $(NATIVE) $(CXXFLAGS) -g3 -fno-omit-frame-pointer ./tests/*.cpp -o chess-library-tests $(LDFLAGS)

showcase:
$(CXX) $(NATIVE) $(CXXFLAGS) -g3 -fno-omit-frame-pointer ./example/main.cpp -o chess-library-example
$(CXX) $(NATIVE) $(CXXFLAGS) -g3 -fno-omit-frame-pointer ./example/main.cpp -o chess-library-example $(LDFLAGS)

shl:
python ./tools/shl.py ./src/include.hpp --header_search_paths ./src/ -o ./include/chess.hpp
Expand Down

0 comments on commit e0669a2

Please # to comment.