From 7b3eb027e21a0ce31a5e82105fc6d89c58540a9f Mon Sep 17 00:00:00 2001 From: E M <5089238+emizzle@users.noreply.github.com> Date: Thu, 12 Feb 2026 19:41:34 +1100 Subject: [PATCH] local cbindings tests - Adds cbindings tests to the makefile so they can be run locally, eg with make testLibstorage or make testAll - Remove the separate workflow for running these tests in ci, opting instead to run them along with unit and integration tests --- .github/workflows/ci-reusable.yml | 5 +++++ .github/workflows/ci.yml | 11 ----------- Makefile | 16 +++++++++++++++- tools/scripts/ci-job-matrix.sh | 9 +++++++++ 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci-reusable.yml b/.github/workflows/ci-reusable.yml index 7dd08a44..7121786a 100644 --- a/.github/workflows/ci-reusable.yml +++ b/.github/workflows/ci-reusable.yml @@ -63,6 +63,11 @@ jobs: path: tests/integration/logs/ retention-days: 1 + ## Part 3 Tests ## + - name: Libstorage tests + if: matrix.tests == 'libstorage' || matrix.tests == 'all' + run: make -j${ncpu} testLibstorage + status: if: always() needs: [build] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef35dc0d..cb844403 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,14 +100,3 @@ jobs: with: os: linux nim_version: ${{ env.nim_version }} - - - name: C Binding build - run: | - make -j${ncpu} update - make -j${ncpu} libstorage - - - name: C Binding test - run: | - cd examples/c - gcc -o storage storage.c -L../../build -lstorage -Wl,-rpath,../../ -pthread - LD_LIBRARY_PATH=../../build ./storage diff --git a/Makefile b/Makefile index b4fe4883..ca5306be 100644 --- a/Makefile +++ b/Makefile @@ -83,6 +83,9 @@ endif deps \ libbacktrace \ test \ + testAll \ + testIntegration \ + testLibstorage \ update ifeq ($(NIM_PARAMS),) @@ -144,8 +147,19 @@ testIntegration: | build deps echo -e $(BUILD_MSG) "build/$@" && \ $(ENV_SCRIPT) nim testIntegration $(TEST_PARAMS) $(NIM_PARAMS) --define:ws_resubscribe=240 build.nims +# Builds a C example that uses the libstorage C library and runs it +testLibstorage: | build deps libstorage + cd examples/c && \ + if [ "$(detected_OS)" = "Windows" ]; then \ + gcc -o storage.exe storage.c -L../../build -lstorage -pthread && \ + PATH=../../build:$$PATH ./storage.exe; \ + else \ + gcc -o storage storage.c -L../../build -lstorage -Wl,-rpath,../../ -pthread && \ + LD_LIBRARY_PATH=../../build ./storage; \ + fi + # Builds and runs all tests (except for Taiko L2 tests) -testAll: | build deps +testAll: | build deps testLibstorage echo -e $(BUILD_MSG) "build/$@" && \ $(ENV_SCRIPT) nim testAll $(NIM_PARAMS) build.nims diff --git a/tools/scripts/ci-job-matrix.sh b/tools/scripts/ci-job-matrix.sh index 28734fbc..e55968bf 100755 --- a/tools/scripts/ci-job-matrix.sh +++ b/tools/scripts/ci-job-matrix.sh @@ -109,10 +109,19 @@ integration_test () { fi } + +# outputs a libstorage test job +libstorage_test () { + job_tests="libstorage" + job_includes="" + job +} + # outputs jobs for all test types all_tests () { unit_test integration_test + libstorage_test } # outputs jobs for the specified operating systems and all test types