@@ -877,6 +877,7 @@ $(TESTS_C) $(TESTS_INT_C):
877877 printf "\n$@_c exists!\n\n" ; \
878878 fi
879879 @mkdir -p $(LOG_DIR)
880+ @echo 0 > "$(LOG_DIR)/$@.GDB_EXIT_CODE" # Initialize the GDB exit code file, because GDB may not be executed (e.g., test is skipped or on Mac)
880881 @if echo $@ | grep -q "atest\|9test" ; then \
881882 printf "\n$@ is skipped!\n\n" | tee -a "$(LOG_DIR)/$@.log" ; \
882883 elif echo $@ | grep -q "_d0" && [[ $(TESTDIM) = "big" ]] ; then \
@@ -892,7 +893,7 @@ $(TESTS_C) $(TESTS_INT_C):
892893 fi ; \
893894 export NVCOMPILER_TERM=trace && set -eu -o pipefail && \
894895 printf "\n$@_$(SUFFIXO) starts.\n\n" | tee -a "$(LOG_DIR)/$@.log" && \
895- $(GDB) ./$@_c_$(SUFFIXO) $(LOG_DIR)/GDB_EXIT_CODE 2>&1 \
896+ $(GDB) ./$@_c_$(SUFFIXO) $(LOG_DIR)/$@. GDB_EXIT_CODE 2>&1 \
896897 | grep -v "Processor does not support trapping of floating-point exceptions" \
897898 | grep -v "libthread_db" \
898899 | tee -a "$(LOG_DIR)/$@.log" ; \
@@ -911,7 +912,7 @@ $(TESTS_C) $(TESTS_INT_C):
911912 fi ; \
912913 export NVCOMPILER_TERM=trace && set -eu -o pipefail && \
913914 printf "\n$@_$(SUFFIXG) starts.\n\n" | tee -a "$(LOG_DIR)/$@.log" && \
914- $(GDB) ./$@_c_$(SUFFIXG) $(LOG_DIR)/GDB_EXIT_CODE 2>&1 \
915+ $(GDB) ./$@_c_$(SUFFIXG) $(LOG_DIR)/$@. GDB_EXIT_CODE 2>&1 \
915916 | grep -v "Processor does not support trapping of floating-point exceptions" \
916917 | grep -v "libthread_db" \
917918 | tee -a "$(LOG_DIR)/$@.log" ; \
@@ -924,11 +925,11 @@ $(TESTS_C) $(TESTS_INT_C):
924925 @set +o pipefail # Restore the original pipe setting
925926 @bash $(CHCKTST) --error "$(LOG_DIR)/$@.log"
926927 @bash $(CHCKTST) --warning "$(LOG_DIR)/$@.log"
927- @echo "gdb exit code was: " && cat "$(LOG_DIR)/GDB_EXIT_CODE" && exit $$(cat "$(LOG_DIR)/GDB_EXIT_CODE")
928+ @echo "gdb exit code was: " && cat "$(LOG_DIR)/$@. GDB_EXIT_CODE" && exit $$(cat "$(LOG_DIR)/$@. GDB_EXIT_CODE")
928929 @printf "$@ ends at $(shell date +%Y.%m.%d_%H.%M.%S).\n" | tee -a "$(LOG_DIR)/$@.log"
929930 @cat "$(LOG_DIR)/$@.log" >> "$(LOG_DIR)/$(shell echo $@ | sed "s/_.*//").log"
930- @ls "$(LOG_DIR)"
931- @rm -r "$(LOG_DIR)" || :
931+ @rm "$(LOG_DIR)/$@.log" || :
932+ @rm "$(LOG_DIR)/$@.GDB_EXIT_CODE " || :
932933 @$(MAKE) cleanmisc
933934
934935# Make the binary corresponding to %_tst_c, but do not execute it.
0 commit comments