summaryrefslogtreecommitdiffstats
path: root/TopicCheck
blob: d38a2c5103244d7ccb279ad0e21cb39b44485d24 (plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/sh

usage () {
	echo >&2 "usage: $0 [--stdin | <topics>...]"
}

stdin=
while case "$1" in -*) ;; *) break; esac
do
	case "$1" in
	--stdin)
		stdin=stdin ;;
	*)
		usage
		exit 1 ;;
	esac
	shift
done

case "$#,$stdin" in
0,)
	stdin=stdin ;;
esac

section () {
	printf >&3 "\033]0;%s %s\007" "$*"
	printf >&3 "# %s %s\n" "$*"
	printf >&2 "\n\n\n\n##### %s %s\n\n\n\n" "$*"
}

git checkout --quiet --detach

logbase=./+log/$$
mkdir -p "$logbase"

exec 3>&2

onetopic () {
	topic="$1"
	log="$logbase/$(echo "$topic" | tr '/' '-')"
	exec >"$log" 2>&1
	git reset --hard "$topic"
	failed=

	section "$topic - leaks" &&
	(
		export SANITIZE=leak GIT_TEST_PASSING_SANITIZE_LEAK=true &&
		Meta/Make -j32  CC=clang test
		st=$?
		Meta/Make -j32  CC=clang  >/dev/null 2>&1 distclean
		exit $st
	) || failed="leaks"

	section "$topic - sha256" &&
	(
		export GIT_TEST_DEFAULT_HASH=sha256 &&
		Meta/Make -j32 test
		st=$?
		Meta/Make >/dev/null 2>&1 distclean
		exit $st
	) || failed="$failed${failed:+" "}sha256"

	section "$topic - test" &&
	(
		: export GIT_TEST_LONG=YesPlease &&
		Meta/Make -j32 test
		st=$?
		Meta/Make >/dev/null 2>&1 distclean
		exit $st
	) || failed="$failed${failed:+" "}test"

	section "$topic - breaking" &&
	(
		Meta/Make $jobs WITH_BREAKING_CHANGES=YesPlease $T test
		st=$?
		Meta/Make WITH_BREAKING_CHANGES=YesPlease >/dev/null 2>&1 distclean
		exit $st
	) || failed="$failed${failed:+" "}breaking"

	if test "$failed" = ""
	then
		rm -f "$log"
	else
		echo >&3 "failed ($failed) $topic"
		echo >&2 "failed ($failed) $topic"
	fi
}

if test "$stdin" = stdin
then
	while read topic
	do
		onetopic "$topic"
	done
else
	for topic
	do
		onetopic "$topic"
	done
fi