summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <Cyan4973@users.noreply.github.com>2022-12-02 22:46:24 (GMT)
committerGitHub <noreply@github.com>2022-12-02 22:46:24 (GMT)
commitd879e7f15a7c392fc590123eaf3620128ff8106e (patch)
tree84b798646b2478795b3b513c41197af7fbb71d5a
parent3e213fdf8e50694fdc6cafd51874394dc057b56d (diff)
parent08f1483b0a4e685c2211f3ca24a9e505502dc333 (diff)
downloadlz4-d879e7f15a7c392fc590123eaf3620128ff8106e.zip
lz4-d879e7f15a7c392fc590123eaf3620128ff8106e.tar.gz
lz4-d879e7f15a7c392fc590123eaf3620128ff8106e.tar.bz2
Merge pull request #1187 from t-mat/pr-issue-1186
Add environment check for freestanding test : resolves #1186
-rw-r--r--tests/Makefile37
-rw-r--r--tests/freestanding.c1
2 files changed, 34 insertions, 4 deletions
diff --git a/tests/Makefile b/tests/Makefile
index 1dd8628..a24185c 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -115,9 +115,6 @@ decompress-partial: lz4.o decompress-partial.c
decompress-partial-usingDict: lz4.o decompress-partial-usingDict.c
$(CC) $(FLAGS) $^ -o $@$(EXT)
-freestanding: freestanding.c
- $(CC) -ffreestanding -nostdlib $^ -o $@$(EXT)
-
.PHONY: clean
clean:
@$(MAKE) -C $(LZ4DIR) $@ > $(VOID)
@@ -353,10 +350,44 @@ test-decompress-partial : decompress-partial decompress-partial-usingDict
@echo "\n ---- test decompress-partial-usingDict ----"
./decompress-partial-usingDict$(EXT)
+
+#-----------------------------------------------------------------------------
+# freestanding test only for Linux x86_64
+#-----------------------------------------------------------------------------
+ifeq ($(OS),Windows_NT)
+ UNAME_S := Windows
+else
+ UNAME_S := $(shell uname -s)
+endif
+
+ifeq ($(OS),Windows_NT)
+ UNAME_P := Unknown
+else
+ UNAME_P := $(shell uname -p)
+endif
+
+FREESTANDING_CFLAGS := -ffreestanding -nostdlib
+
+ifneq ($(UNAME_S), Linux)
+ FREESTANDING_CFLAGS :=
+endif
+
+ifneq ($(UNAME_P), x86_64)
+ FREESTANDING_CFLAGS :=
+endif
+
+freestanding: freestanding.c
+ $(CC) $(FREESTANDING_CFLAGS) $^ -o $@$(EXT)
+
test-freestanding: freestanding
@echo "\n ---- test freestanding ----"
+ifeq ($(FREESTANDING_CFLAGS),)
+ @echo "\n (skip)"
+else
./freestanding$(EXT)
-strace ./freestanding$(EXT)
-ltrace ./freestanding$(EXT)
+endif
+
endif
diff --git a/tests/freestanding.c b/tests/freestanding.c
index ceff4c5..6109aa7 100644
--- a/tests/freestanding.c
+++ b/tests/freestanding.c
@@ -30,7 +30,6 @@
#if !defined(__x86_64__) || !defined(__linux__)
-EXTERN_C void _start(void) { }
int main(int argc, char** argv) { return 0; }
#else