Commit ac39b7b60544d4ac3b20c4a46213ea60227da103
authorMichel Pollet <buserror@gmail.com>
Wed, 22 Feb 2012 12:21:27 +0000 (12:21 +0000)
committerMichel Pollet <buserror@gmail.com>
Sat, 25 Feb 2012 10:18:13 +0000 (10:18 +0000)
Removed extra scripts, etc

Signed-off-by: Michel Pollet <buserror@gmail.com>
3 files changed:
Makefile.common
tests/Makefile
tests/run_tests [deleted file]

index 81130a35d67e28ced25396a2440551cb6998fcaa..6e1c7c34804c76fec70a9a6963f58e47247b7af6 100644 (file)
@@ -107,7 +107,6 @@ endif
 
 ${OBJ}/%.elf:
 ifeq ($(V),1)
-       echo $^ / $<
        $(CC) -MMD ${CFLAGS}  ${LFLAGS} -o $@ $^ $(LDFLAGS)
 else
        @echo LD $@
index 29f504f226f511bac9026b2f0ccc4ffd9c6b60d8..e2d04c2b6ed403ca7b6d9c78d21d0eaab6947e7a 100644 (file)
@@ -3,7 +3,7 @@
 # And compiles it into an ELF binary.
 # It also disassembles it for debugging purposes.
 # 
-#      Copyright 2008, 2009 Michel Pollet <buserror@gmail.com>
+#      Copyright 2008-2012 Michel Pollet <buserror@gmail.com>
 #
 #      This file is part of simavr.
 #
 #      along with simavr.  If not, see <http://www.gnu.org/licenses/>.
 
 
-SHELL   = /bin/bash
+SHELL          = /bin/bash
 
 sources                := $(wildcard at*.c)
-test_sources    := $(wildcard test_*.c)
-simavr = ..
+simavr                 = ..
 
-IPATH += ${simavr}/include
-IPATH += ${simavr}/simavr/sim
-CFLAGS += -Wall
-TEST_SRC=${wildcard test_*.c}
-TESTS=${TEST_SRC:.c=}
+IPATH          += ${simavr}/include
+IPATH          += ${simavr}/simavr/sim
+CFLAGS                 += -Wall
+LDFLAGS                += -L${simavr}/simavr/${OBJ} -lsimavr
 
-all: obj ${sources:.c=.axf} ${TESTS}
-# if you want hex files
-#all : ${sources:.c=.hex}
-# if you need assembler output
-#all :  ${sources:.c=.s}  
+tests_src      = ${wildcard test_*.c}
+tests          = ${patsubst %.c, ${OBJ}/%.tst, ${tests_src}}
+
+all: obj axf tests
 
 include ../Makefile.common
 
-# do not delete intermediate .o files after running `make run_tests'
-.SECONDARY:
+tests: ${tests}
+       
+axf: ${sources:.c=.axf}
+       
 
-test_%: ${OBJ}/test_%.o ${OBJ}/tests.o ${simavr}/simavr/${OBJ}/libsimavr.so
-       gcc ${LFLAGS} -o $@ $^ ${LDFLAGS}
+${OBJ}/%.tst: tests.c %.c
+ifeq ($(V),1)
+       $(CC) -MMD ${CFLAGS}  ${LFLAGS} -o $@ $^ $(LDFLAGS)
+else
+       @echo TST $@
+       @$(CC) -MMD ${CFLAGS}  ${LFLAGS} -o $@ $^ $(LDFLAGS)
+endif
 
-run_tests: obj ${sources:.c=.axf} ${TESTS}
-       ./run_tests
+run_tests: all
+       @export LD_LIBRARY_PATH=${simavr}/simavr/${OBJ} ;\
+       num_failed=0 ;\
+       num_run=0 ;\
+       for test in ${OBJ}/test_*.tst; do \
+           num_run=$$(($$num_run+1)) ;\
+           if ! $$test; then \
+                       echo "$$test returned with exit value $$?." ;\
+                       num_failed=$$(($$num_failed+1)) ;\
+           fi ;\
+       done ;\
+       echo "Tests run: $$num_run  Successes: $$(($$num_run-$num_failed)) Failures: $$num_failed"
 
 clean: clean-${OBJ}
-       rm -f ${TESTS} *.axf
+       rm -f *.axf
diff --git a/tests/run_tests b/tests/run_tests
deleted file mode 100755 (executable)
index 36becf0..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-TESTS=`find . -maxdepth 1 -executable -name test_\*`
-
-num_failed=0
-num_run=0
-
-for test in $TESTS; do
-    num_run=$(($num_run+1))
-    if ! $test; then
-       echo "$test returned with exit value $?."
-       num_failed=$(($num_failed+1))
-    fi
-done
-
-echo "Tests run: $num_run  Successes: $(($num_run-$num_failed))  Failures: $num_failed"