jdk/test/Makefile
changeset 4342 9f3aa1172803
parent 4335 365eb4449319
child 4514 7758bdd54629
--- a/jdk/test/Makefile	Mon Nov 30 14:15:15 2009 -0800
+++ b/jdk/test/Makefile	Tue Dec 01 08:51:16 2009 -0800
@@ -282,11 +282,23 @@
 RUNLIST   = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/runlist.txt
 PASSLIST  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/passlist.txt
 FAILLIST  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/faillist.txt
+EXITCODE  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/exitcode.txt
+
+TESTEXIT = \
+  if [ ! -s $(EXITCODE) ] ; then \
+    $(ECHO) "ERROR: EXITCODE file not filled in."; \
+    $(ECHO) "1" > $(EXITCODE); \
+  fi ; \
+  testExitCode=`$(CAT) $(EXITCODE)`; \
+  $(ECHO) "EXIT CODE: $${testExitCode}"; \
+  exit ${testExitCode}
+
 BUNDLE_UP_AND_EXIT = \
 ( \
-  exitCode=$$? && \
+  jtregExitCode=$$? && \
   _summary="$(SUMMARY_TXT)"; \
-  $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST); \
+  $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \
+  $(ECHO) "$${jtregExitCode}" > $(EXITCODE); \
   if [ -r "$${_summary}" ] ; then \
     $(ECHO) "Summary: $${_summary}" > $(STATS_TXT); \
     $(EXPAND) $${_summary} | $(EGREP) -v ' Not run\.' > $(RUNLIST); \
@@ -297,10 +309,13 @@
       $(EGREP) ' Error\.' $(RUNLIST); \
       $(EGREP) -v ' Passed\.' $(RUNLIST) ) \
       | $(SORT) | $(UNIQ) > $(FAILLIST); \
-    if [ $${exitCode} != 0 -o -s $(FAILLIST) ] ; then \
+    if [ $${jtregExitCode} != 0 -o -s $(FAILLIST) ] ; then \
       $(EXPAND) $(FAILLIST) \
         | $(CUT) -d' ' -f1 \
         | $(SED) -e 's@^@FAILED: @' >> $(STATS_TXT); \
+      if [ $${jtregExitCode} = 0 ] ; then \
+        jtregExitCode=1; \
+      fi; \
     fi; \
     runc="`$(CAT) $(RUNLIST)      | $(WC) -l | $(AWK) '{print $$1;}'`"; \
     passc="`$(CAT) $(PASSLIST)    | $(WC) -l | $(AWK) '{print $$1;}'`"; \
@@ -312,8 +327,8 @@
     $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \
   fi; \
   $(CAT) $(STATS_TXT); \
-  $(ZIP_UP_RESULTS) && $(KILL_DISPLAY) && \
-  exit $${exitCode} \
+  $(ZIP_UP_RESULTS) && $(KILL_DISPLAY) ; \
+  $(TESTEXIT) \
 )
 
 ################################################################
@@ -598,7 +613,7 @@
               $(JTREG_TEST_OPTIONS)                                          \
               $(TESTDIRS)                                                    \
 	  ) ; $(BUNDLE_UP_AND_EXIT)                                          \
-	) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt
+	) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt ; $(TESTEXIT)
 
 PHONY_LIST += jtreg_tests