File: tests.mk

package info (click to toggle)
sagemath 8.6-6
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 113,052 kB
  • sloc: python: 996,064; cpp: 6,208; sh: 3,252; ansic: 3,226; objc: 1,407; makefile: 1,087; lisp: 5
file content (51 lines) | stat: -rwxr-xr-x 1,367 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/make -f
# Makefile containing shell snippets to help with running sage tests and
# analysing the output.
#
# TODO: eventually call this from an autopkgtest

SAGE = sage
SAGE_TEST_FLAGS =
LOGFILE = ptestlong.log

check:
	$(SAGE) -t -p --all --long --logfile=$(LOGFILE) $(SAGE_TEST_FLAGS)

check-failed:
	$(SAGE) -t -p --all --long --logfile=$(LOGFILE) -f $(SAGE_TEST_FLAGS)

FAILED_TESTS = grep '^sage -t .*  \#' $(LOGFILE)
failed-tests:
	$(FAILED_TESTS)

failed-tests-total-normal:
	grep "^Failed example:" $(LOGFILE) | wc -l

failed-tests-special:
	$(FAILED_TESTS) | grep '# [^0-9]' || true

failed-tests-by-name:
	$(FAILED_TESTS) | sort '-t#' -k1

failed-tests-by-count:
# Sort "special" failures last, e.g. segfault/abort/timed-out etc
	$(FAILED_TESTS) \
	  | sed -e 's,#\(\s\s*[^0-9]\),#9999999\1,g' \
	  | sort '-t#' -k2n,2n \
	  | sed -e 's,9999999,,g'

failed-tests-by-error:
# Filter out NameError; most of these are caused by earlier errors
	grep '\(Error\|Warning\):' $(LOGFILE) \
	  | grep -v NameError \
	  | sort | uniq -c | sort -k1n,1n

FT_CAUSE_ERRORTYPE = \(Error\|Warning\)
FT_CAUSE_BACKTRACE = 2
failed-tests-by-cause:
	grep -B$$((2 * $(FT_CAUSE_BACKTRACE))) -Z '$(FT_CAUSE_ERRORTYPE):' $(LOGFILE) \
	  | sed -e 's/^--$$/\x00/g' \
	  | sed -z -e 's/^\s*//g' \
	  | tr '\0\n' '\n\t' \
	  | sort | uniq -c | sort -k1n,1n \
	  | less -S +G