summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/dist/s_all
blob: ac9c9699f5a372575f63b783878b538cd5e6d6df (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#! /bin/sh

# Run standard scripts.
t=__wt.$$
t_pfx=__s_all_tmp_
trap 'rm -f $t *.pyc __tmp __wt.* __s_all_tmp*' 0 1 2 3 13 15

# We require python which may not be installed.
type python > /dev/null 2>&1 || {
	echo 's_all: python not found'
	exit 1
}

echo 'dist/s_all run started...'

force=
reconf=0
errmode=0
errfound=0
while :
	do case "$1" in
	-A)	# Reconfigure the library build.
		reconf=1
		shift;;
	-f)	# Force versions to be updated
		force="-f"
		shift;;
	-E)	# Return an error code on failure
		errmode=1
		shift;;
	*)
		break;;
	esac
done

echo "Updating files that include the package version" &&
    sh ./s_version $force

test "$reconf" -eq 0 || {
	(echo "Rebuilding GNU tools library support" &&
	    cd ../build_posix && 2>&1 sh ./reconf | sed -e 's/^/    /')
}

errchk()
{
	if ! `test -s $2`; then
		return
	fi

	echo "####################### MESSAGE ############################"
	echo "s_all run of: \"$1\" resulted in:"
	sed -e 's/^/    /' $2
	echo "#######################"

	rm -f $2

	# Some tests shouldn't return an error, we exclude them here.
	case "$1" in
	*s_export|*s_tags)
		;;
	*)
		errfound=1;;
	esac
}

run()
{
	2>&1 $1 > $t
	errchk "$1" $t
}

# Non parallelizable scripts The following scripts either modify files or
# already parallelize internally.
run "sh ./s_readme $force"
run "sh ./s_install $force"
run "python api_config.py"
run "python api_err.py"
run "python flags.py"
run "python log.py"
run "python stat.py"
run "sh ./s_copyright"
run "sh ./s_style"
run "./s_clang-format"
run "python prototypes.py"
run "sh ./s_typedef -b"

COMMANDS="
2>&1 ./s_define > ${t_pfx}s_define
2>&1 ./s_docs > ${t_pfx}s_docs
2>&1 ./s_evergreen > ${t_pfx}s_evergreen
2>&1 ./s_export > ${t_pfx}s_export
2>&1 ./s_funcs > ${t_pfx}s_funcs
2>&1 ./s_function > ${t_pfx}s_function
2>&1 ./s_getopt > ${t_pfx}s_getopt
2>&1 ./s_lang > ${t_pfx}s_lang
2>&1 ./s_longlines > ${t_pfx}s_longlines
2>&1 ./s_python > ${t_pfx}s_python
2>&1 ./s_stat > ${t_pfx}_stat
2>&1 ./s_string > ${t_pfx}s_string
2>&1 ./s_tags > ${t_pfx}tags
2>&1 ./s_typedef -c > ${t_pfx}s_typedef_c
2>&1 ./s_void > ${t_pfx}s_void
2>&1 ./s_whitespace > ${t_pfx}s_whitespace
2>&1 ./s_win > ${t_pfx}s_win
2>&1 python function.py > ${t_pfx}py_function
2>&1 python style.py > ${t_pfx}py_style"

# Parallelize if possible.
xp=""
echo date | xargs -P 20 >/dev/null 2>&1
if test $? -eq 0; then
	xp="-P 20"
fi
echo "$COMMANDS" | xargs $xp -I{} /bin/sh -c {}

for f in `find . -name ${t_pfx}\*`; do
	if `test -s $f`; then
		LOCAL_NAME=`basename $f`
		# Find original command and trim redirect garbage
		FAILED_CMD=`echo "$COMMANDS" | grep $LOCAL_NAME | \
		    sed -e 's/ >.*//' -e 's/.* //'`
		errchk "$FAILED_CMD" $f
	fi
done

echo 'dist/s_all run finished'
if test $errmode -ne 0; then
	exit $errfound;
fi
exit 0