[Branch,~jesse-barker/libmatrix/trunk] Rev 19: In addition to building the tests (just the one for now), make sure to run

Message ID 20110617163918.10060.45269.launchpad@loganberry.canonical.com
State Accepted
Headers show

Commit Message

Jesse Barker June 17, 2011, 4:39 p.m.
------------------------------------------------------------
revno: 19
committer: Jesse Barker <jesse.barker@linaro.org>
branch nick: trunk
timestamp: Fri 2011-06-17 09:37:04 -0700
message:
  In addition to building the tests (just the one for now), make sure to run
  them and mark the build as failing/error if they don't pass.
modified:
  Makefile


--
lp:libmatrix
https://code.launchpad.net/~jesse-barker/libmatrix/trunk

You are subscribed to branch lp:libmatrix.
To unsubscribe from this branch go to https://code.launchpad.net/~jesse-barker/libmatrix/trunk/+edit-subscription

Patch

=== modified file 'Makefile'
--- Makefile	2011-06-16 21:35:35 +0000
+++ Makefile	2011-06-17 16:37:04 +0000
@@ -1,17 +1,24 @@ 
-TARGETS = libmatrix.a matrix_inverse_test
+TARGETS = libmatrix.a
+TESTS = matrix_inverse_test
 SRCS = mat.cc program.cc matrix_inverse_test.cc
 OBJS = $(SRCS:.cc=.o)
 CXXFLAGS = -Wall -Werror -pedantic -O3
 
-default: $(TARGETS)
+# Make sure to build both the library targets and the tests, and generate 
+# a make failure if the tests don't pass.
+default: $(TARGETS) $(TESTS) run_tests
 
+# Main library targets here.
 mat.o : mat.cc mat.h
 program.o: program.cc program.h
+libmatrix.a : mat.o mat.h stack.h vec.h program.o program.h
+	$(AR) -r $@  $(OBJS)
+
+# Tests and execution targets here.
 matrix_inverse_test.o: matrix_inverse_test.cc mat.h
 matrix_inverse_test: matrix_inverse_test.o libmatrix.a
 	$(CXX) -o $@ $?
-libmatrix.a : mat.o mat.h stack.h vec.h program.o program.h
-	$(AR) -r $@  $(OBJS)
-
+run_tests: $(TESTS)
+	./matrix_inverse_test
 clean :
 	$(RM) $(OBJS) $(TARGETS)