-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun-tests
More file actions
executable file
·64 lines (53 loc) · 1.41 KB
/
run-tests
File metadata and controls
executable file
·64 lines (53 loc) · 1.41 KB
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
#
# run-tests
# srm - https://github.com/WestleyR/srm
#
# Created by WestleyR on July 30, 2020
# Source code: https://github.com/WestleyR/srm
#
# Copyright (c) 2020-2021 WestleyR. All rights reserved.
# This software is licensed under a BSD 3-Clause Clear License.
# Consult the LICENSE file that came with this software regarding
# your rights to distribute this software.
#
COMMAND="srm"
echo "Testing ${COMMAND} version:"
echo
./${COMMAND} --version
#./${COMMAND} --commit
echo "Generating testdata..."
test -d tests/testingdata && rm -rf tests/testingdata
cp -r tests/testdata tests/testingdata
chmod 000 tests/testingdata/no-perm
ln -s $(pwd)/tests/testingdata/link1 $(pwd)/tests/testingdata/link2
touch tests/testingdata/broken-link
ln -s $(pwd)/tests/testingdata/broken-link $(pwd)/tests/testingdata/broken-link-file
rm tests/testingdata/broken-link
echo
echo "Running all tests..."
echo
all_tests_num=0
tests_failed_num=0
tests_failed=""
test_files=`ls -1 tests/ | sort -n`
for t in $test_files; do
if [ -f "tests/${t}" ]; then
echo "Testing: ${t}:"
if ! bash "tests/${t}"; then
echo "test failed: ${t}"
echo ""
((tests_failed_num+=1))
tests_failed=`echo "${test_failed} ${t}"`
fi
((all_tests_num+=1))
fi
done
echo
echo "${all_tests_num} tests ran with ${tests_failed_num} test(s) failed."
if [[ $tests_failed_num -ge 1 ]]; then
echo "FAILED TO RUN ALL TESTS"
exit 1
fi
#
# End run-tests
#