From 51db3b42368291de255d7a3281d2a962338bd2a3 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Sun, 26 Mar 2023 20:02:29 -0600 Subject: [PATCH 1/2] test: update default location of sharness It's included as a module for a reason. Also, use "$0" so the tests can be run like `./t/main.t` (or any other directory). Signed-off-by: Felipe Contreras --- t/main.t | 2 +- t/smoke-test.t | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/t/main.t b/t/main.t index c4603fc..25acb35 100755 --- a/t/main.t +++ b/t/main.t @@ -5,7 +5,7 @@ test_description='Main tests' -. "${SHARNESS_TEST_SRCDIR-/usr/share/sharness}"/sharness.sh || exit 1 +. "${SHARNESS_TEST_SRCDIR-$(dirname "$0")/sharness}"/sharness.sh || exit 1 check() { echo "$3" > expected && diff --git a/t/smoke-test.t b/t/smoke-test.t index 5bda86a..73ffff8 100755 --- a/t/smoke-test.t +++ b/t/smoke-test.t @@ -8,7 +8,7 @@ test_description='Smoke test' -. "${SHARNESS_TEST_SRCDIR-/usr/share/sharness}"/sharness.sh || exit 1 +. "${SHARNESS_TEST_SRCDIR-$(dirname "$0")/sharness}"/sharness.sh || exit 1 check() { echo "$3" > expected && From 90c6ad5f8759f91e70d659f2842cd63a3e5e665f Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Sun, 26 Mar 2023 19:49:08 -0600 Subject: [PATCH 2/2] test: use make to run the tests Signed-off-by: Felipe Contreras --- .github/workflows/main.yml | 2 +- t/Makefile | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 t/Makefile diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dd1b98c..e4d1217 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,4 +18,4 @@ jobs: submodules: 'recursive' - name: Run tests - run: ./run-tests + run: make -C t diff --git a/t/Makefile b/t/Makefile new file mode 100644 index 0000000..0d2faad --- /dev/null +++ b/t/Makefile @@ -0,0 +1,12 @@ +T = $(wildcard *.t) + +test: $(T) + @$(MAKE) --silent clean + +$(T): clean + ./$@ $(TEST_OPTS) + +clean: + @rm -fr test-results + +.PHONY: test $(T) clean