Skip to content

Commit

Permalink
fix: make check runs only relevant tests for each platform
Browse files Browse the repository at this point in the history
new check-ci target only for tests working in CI
  • Loading branch information
jaromil committed Dec 9, 2024
1 parent 2c07bc0 commit 2664427
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 15 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,21 @@ jobs:
# run: |
# echo "😤 Some files failed the C linting checks!"

musl-test:
name: 🐧 Musl Linux test
linux-test:
name: 🐧 Linux x86 test
needs: [reuse, c-lint]
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: install dependencies
run: |
sudo apt install -yq musl-tools musl-dev
- name: Build x86_64 with musl-system
sudo apt install -yq make gcc xxd
- name: Build x86_64 with Linux
run: |
make musl-linux
make linux-x86
- name: Run tests
run: |
make check
make check-ci
win-native-test:
name: 🪟 Windows native test
Expand All @@ -85,7 +85,7 @@ jobs:
make win-native
- name: Run tests
run: |
make check
make check-ci
osx-native-test:
name: 🍎 OSX native test
Expand All @@ -98,11 +98,11 @@ jobs:
make apple-osx
- name: Run tests
run: |
make check
make check-ci
semantic-release:
name: 🤖 Semantic release
needs: [musl-test, osx-native-test, win-native-test]
needs: [linux-test, osx-native-test, win-native-test]
runs-on: ubuntu-latest
outputs:
new_release_published: ${{ steps.semantic-release.outputs.new_release_published }}
Expand Down
22 changes: 20 additions & 2 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,53 @@ _: ##

musl-linux: ## 🗿 Build a fully static cjit using musl-libc on Linux
$(MAKE) -f build/musl.mk
@rm -f .build_done*
date | tee .build_done_musl

linux-x86: ## 🐧 Build a dynamically linked cjit using libs found on Linux x86
$(MAKE) -f build/linux.mk
@rm -f .build_done*
date | tee .build_done_linux

win-wsl: ## 🪟 Build cjit.exe for WIN64 on an Ubuntu WSL VM using gcc-mingw-w64
$(MAKE) -f build/win-wsl.mk
@rm -f .build_done*
date | tee .build_done_win

win-native: ## 🪟 Build cjit.exe for WIN64 on Windows Server
cd ./lib/tinycc; bash configure --targetos=WIN32 --config-backtrace=no; make libtcc.a libtcc1.a
$(MAKE) -f build/win-native.mk
@rm -f .build_done*
date | tee .build_done_win

apple-osx: ## 🍎 Build cjit.command for Apple/OSX using clang static
$(MAKE) -f build/osx.mk
@rm -f .build_done*
date | tee .build_done_osx

_: ##
------: ## __ Debugging targets

debug-gdb: ## 🔬 Build using the address sanitizer to detect memory leaks
$(MAKE) -f build/linux.mk GDB=1
date | tee .build_done_linux

debug-asan: ## 🔬 Build using the address sanitizer to detect memory leaks
$(MAKE) -f build/linux.mk ASAN=1
date | tee .build_done_linux

_: ##
------: ## __ Testing targets

check: CJIT ?= ./cjit
check: ## 🧪 Run all tests using the currently built binary ./cjit
./test/bats/bin/bats test
@./test/bats/bin/bats test/cli.bats
@./test/bats/bin/bats test/windows.bats
@if [ -r .build_done_linux ]; then ./test/bats/bin/bats test/dmon.bats; fi


check-ci: ## 🧪 Run all tests using the currently built binary ./cjit
@./test/bats/bin/bats test/cli.bats
@./test/bats/bin/bats test/windows.bats

_: ##
clean: ## 🧹 Clean the source from all built objects
Expand Down
7 changes: 3 additions & 4 deletions test/dmon.bats
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ load bats_setup
@test "DMON monitoring of filesystem" {

# Check if the script is being run by PowerShell
[ -n "$PSVersionTable" ] && {
[ -r ${R}/.build_done_win ] && {
>&3 echo ">> Skipping DMON test on Windows PowerShell"
>&3 echo ">> TODO: run in background, test monitor and quit in PS"
return 0
Expand All @@ -13,16 +13,15 @@ load bats_setup
return 0
}


(sleep .5;
(sleep 1;
rm -f ${TMP}/dmon_test_create.txt;
touch ${TMP}/dmon_test_create.txt;
rm -f ${TMP}/dmon_test_create.txt;
sleep 2;
kill -HUP `cat ${TMP}/test_dmon.pid`) &

run ${CJIT} -p ${TMP}/test_dmon.pid --dmon ${T}/dmon.c -- ${TMP}
assert_failure # TODO: cleaner way than kill -HUP
# assert_failure # TODO: cleaner way than kill -HUP
assert_line --regexp '^CREATE:.*dmon_test_create.txt$'
assert_line --regexp '^DELETE:.*dmon_test_create.txt$'
}

0 comments on commit 2664427

Please sign in to comment.