Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] test-lib: save test counts across invocations

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:51:57

Thomas Rast [off-list ref] writes:
Save the number of tests run ($test_count) in a file under
test-counts/.  Then when sourcing test-lib.sh the next time, compare
the timestamps.
... which is this logic ...
+test_count_file="$TEST_DIRECTORY"/test-counts/$(basename "$0" .sh)
+test_count_saved=$(
+	if [ -n "$test_disable_saved_count" ]; then
+		:
+	# the saved count is only valid if the file is newer than the test
+	elif [ -f "$test_count_file" -a "$test_count_file" -nt "$0" ]; then
+		cat "$test_count_file" 2>/dev/null
+	fi
+	# otherwise we leave the variable empty
+)
I think the patch is cute, but I however do not think this is sufficient
to catch prerequisite changes, unfortunately. I'd rather leave the total
unknown than giving incorrect numbers.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help