From 3eb7b99799aa46c18f6a8024c38398c5624c94cc Mon Sep 17 00:00:00 2001
From: jD91mZM2 <me@krake.one>
Date: Sun, 29 Jul 2018 10:04:11 +0200
Subject: [PATCH] Move test binaries to tests/bins/

---
 tests/.gitignore | 77 +-----------------------------------------------
 tests/Makefile   | 18 ++++-------
 2 files changed, 6 insertions(+), 89 deletions(-)

diff --git a/tests/.gitignore b/tests/.gitignore
index affa0abf..42721007 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -1,79 +1,4 @@
 # Automatically generated by 'make ignore'
 /*.out
 /gen/
-args
-arpainet
-assert
-ctype
-error
-fcntl/create
-fcntl/fcntl
-locale
-math
-setjmp
-signal
-stdio/all
-stdio/freopen
-stdio/fwrite
-stdio/getc_unget
-stdio/printf
-stdio/rename
-stdio/scanf
-stdio/sprintf
-stdlib/a64l
-stdlib/atof
-stdlib/atoi
-stdlib/env
-stdlib/mkostemps
-stdlib/rand
-stdlib/strtol
-stdlib/strtoul
-stdlib/system
-string/mem
-string/strchr
-string/strcspn
-string/strncmp
-string/strpbrk
-string/strrchr
-string/strspn
-string/strstr
-string/strtok
-string/strtok_r
-strings
-time/asctime
-time/gmtime
-time/localtime
-time/mktime
-time/strftime
-time/time
-unistd/brk
-unistd/dup
-unistd/exec
-unistd/fchdir
-unistd/fsync
-unistd/ftruncate
-unistd/getopt
-unistd/isatty
-unistd/pipe
-unistd/rmdir
-unistd/sleep
-unistd/write
-waitpid
-wchar/mbrtowc
-wchar/mbsrtowcs
-wchar/putwchar
-wchar/wcrtomb
-dirent
-pwd
-resource/getrusage
-stdlib/alloc
-stdlib/bsearch
-stdlib/mktemp
-time/gettimeofday
-time/times
-unistd/chdir
-unistd/gethostname
-unistd/getid
-unistd/link
-unistd/setid
-unistd/stat
+/bins/
diff --git a/tests/Makefile b/tests/Makefile
index d313fb34..c52f6501 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -86,20 +86,11 @@ all: $(BINS)
 clean:
 	rm -f $(BINS) *.out
 
-ignore: $(BINS)
-	echo "# Automatically generated by 'make ignore'" > .gitignore
-	echo "/*.out" >> .gitignore
-	echo "/gen/" >> .gitignore
-	for bin in $^; \
-	do \
-		echo "$${bin}" >> .gitignore; \
-	done
-
 run: $(BINS)
 	for bin in $^; \
 	do \
 		echo "# $${bin} #"; \
-		"./$${bin}" test args || exit $$?; \
+		"bins/$${bin}" test args || exit $$?; \
 	done
 
 expected: $(EXPECT_BINS)
@@ -109,7 +100,7 @@ expected: $(EXPECT_BINS)
 	do \
 		echo "# $${bin} #"; \
 		mkdir -p expected/`dirname $${bin}`; \
-		"./$${bin}" test args > "expected/$${bin}.stdout" 2> "expected/$${bin}.stderr" || exit $$?; \
+		"bins/$${bin}" test args > "expected/$${bin}.stdout" 2> "expected/$${bin}.stderr" || exit $$?; \
 	done
 
 verify: $(EXPECT_BINS)
@@ -119,7 +110,7 @@ verify: $(EXPECT_BINS)
 	do \
 		echo "# $${bin} #"; \
 		mkdir -p gen/`dirname $${bin}`; \
-		"./$${bin}" test args > "gen/$${bin}.stdout" 2> "gen/$${bin}.stderr" || exit $$?; \
+		"bins/$${bin}" test args > "gen/$${bin}.stdout" 2> "gen/$${bin}.stderr" || exit $$?; \
 		diff -u "gen/$${bin}.stdout" "expected/$${bin}.stdout" || exit $$?; \
 		diff -u "gen/$${bin}.stderr" "expected/$${bin}.stderr" || exit $$?; \
 	done
@@ -140,4 +131,5 @@ TAILLIBS=\
 	../target/openlibm/libopenlibm.a
 
 %: %.c $(HEADLIBS) $(TAILLIBS)
-	gcc -fno-builtin -fno-stack-protector -Wall -g $(CFLAGS) $(HEADLIBS) "$<" $(TAILLIBS) -o "$@"
+	mkdir -p "bins/$$(dirname "$@")"
+	gcc -fno-builtin -fno-stack-protector -Wall -g $(CFLAGS) $(HEADLIBS) "$<" $(TAILLIBS) -o "bins/$@"
-- 
GitLab