Skip to content

Commit 51a1d16

Browse files
Joern Engeltorvalds
authored andcommitted
selftests: exit 1 on failure
In case this ever gets scripted, it should return 0 on success and 1 on failure. Parsing the output should be left to meatbags. Signed-off-by: Joern Engel <joern@logfs.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 0786f7b commit 51a1d16

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

tools/testing/selftests/vm/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ all: hugepage-mmap hugepage-shm map_hugetlb thuge-gen
88
$(CC) $(CFLAGS) -o $@ $^
99

1010
run_tests: all
11-
@/bin/sh ./run_vmtests || echo "vmtests: [FAIL]"
11+
@/bin/sh ./run_vmtests || (echo "vmtests: [FAIL]"; exit 1)
1212

1313
clean:
1414
$(RM) hugepage-mmap hugepage-shm map_hugetlb

tools/testing/selftests/vm/run_vmtests

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#we need 256M, below is the size in kB
55
needmem=262144
66
mnt=./huge
7+
exitcode=0
78

89
#get pagesize and freepages from /proc/meminfo
910
while read name size unit; do
@@ -41,6 +42,7 @@ echo "--------------------"
4142
./hugepage-mmap
4243
if [ $? -ne 0 ]; then
4344
echo "[FAIL]"
45+
exitcode=1
4446
else
4547
echo "[PASS]"
4648
fi
@@ -55,6 +57,7 @@ echo "--------------------"
5557
./hugepage-shm
5658
if [ $? -ne 0 ]; then
5759
echo "[FAIL]"
60+
exitcode=1
5861
else
5962
echo "[PASS]"
6063
fi
@@ -67,6 +70,7 @@ echo "--------------------"
6770
./map_hugetlb
6871
if [ $? -ne 0 ]; then
6972
echo "[FAIL]"
73+
exitcode=1
7074
else
7175
echo "[PASS]"
7276
fi
@@ -75,3 +79,4 @@ fi
7579
umount $mnt
7680
rm -rf $mnt
7781
echo $nr_hugepgs > /proc/sys/vm/nr_hugepages
82+
exit $exitcode

0 commit comments

Comments
 (0)