From: Carlos Maniero <carlos@maniero.me>
To: ~johnnyrichard/olang-devel@lists.sr.ht
Cc: Carlos Maniero <carlos@maniero.me>
Subject: [PATCH olang 1/2] tests: move munit to a shared directory
Date: Sat, 17 Feb 2024 21:50:22 -0300 [thread overview]
Message-ID: <20240218005023.3723888-1-carlos@maniero.me> (raw)
In-Reply-To: <20240218002713.3705605-1-carlos@maniero.me>
Since unit tests also uses munit, there is no reason to keep it inside
the integration directory. Instead I created a shared directory to keep
stuff that are shared in between unit and integration tests.
Signed-off-by: Carlos Maniero <carlos@maniero.me>
---
tests/integration/Makefile | 16 ++++++++++------
tests/{integration => shared}/munit.c | 0
tests/{integration => shared}/munit.h | 0
3 files changed, 10 insertions(+), 6 deletions(-)
rename tests/{integration => shared}/munit.c (100%)
rename tests/{integration => shared}/munit.h (100%)
diff --git a/tests/integration/Makefile b/tests/integration/Makefile
index a42f787..eeebfdd 100644
--- a/tests/integration/Makefile
+++ b/tests/integration/Makefile
@@ -1,12 +1,13 @@
SRCS := $(wildcard *_test.c)
-TO_LINT := $(filter-out munit.c munit.h,$(wildcard *.c *.h))
OBJS := $(patsubst %_test.c, %_test.o, $(SRCS))
-CFLAGS := -I../../src
+CFLAGS := -I../../src -I../shared
TESTS := $(patsubst %_test.c, %_test, $(SRCS))
EXEC_TESTS := $(patsubst %_test, ./%_test, $(TESTS))
+MUNIT_SRC := ../shared/munit.c
+MUNIT := ./munit.o
.PHONY: all
-all: munit.o cli_runner.o $(TESTS)
+all: $(MUNIT) cli_runner.o $(TESTS)
@for file in $(EXEC_TESTS); do \
./"$$file"; \
done
@@ -16,12 +17,15 @@ clean:
$(RM) *.o *_test
.PHONY: linter
-linter: $(TO_LINT)
+linter: $(SRCS)
clang-format --dry-run --Werror $?
.PHONY: linter-fix
-linter-fix: $(TO_LINT)
+linter-fix: $(SRCS)
clang-format -i $?
-cli_test: munit.o cli_runner.o cli_test.o
+cli_test: $(MUNIT) cli_runner.o cli_test.o
$(CC) $? $(CFLAGS) -o $@
+
+$(MUNIT):
+ $(CC) -c $(MUNIT_SRC) $(CFLAGS) -o $(MUNIT)
diff --git a/tests/integration/munit.c b/tests/shared/munit.c
similarity index 100%
rename from tests/integration/munit.c
rename to tests/shared/munit.c
diff --git a/tests/integration/munit.h b/tests/shared/munit.h
similarity index 100%
rename from tests/integration/munit.h
rename to tests/shared/munit.h
--
2.34.1
next prev parent reply other threads:[~2024-02-18 0:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-18 0:27 [PATCH olang 0/2] add unit tests config Carlos Maniero
2024-02-18 0:50 ` Carlos Maniero [this message]
2024-02-18 0:50 ` [PATCH olang 2/2] tests: add unit tests configuration Carlos Maniero
2024-02-18 0:55 ` [olang/patches/.build.yml] build success builds.sr.ht
2024-02-19 0:50 ` [PATCH olang 0/2] add unit tests config Johnny Richard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240218005023.3723888-1-carlos@maniero.me \
--to=carlos@maniero.me \
--cc=~johnnyrichard/olang-devel@lists.sr.ht \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.johnnyrichard.com/olang.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox