Skip to content

Commit

Permalink
selftests: exit 1 on failure
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Joern Engel authored and Linus Torvalds committed Jul 3, 2013
1 parent 0786f7b commit 51a1d16
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tools/testing/selftests/vm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ all: hugepage-mmap hugepage-shm map_hugetlb thuge-gen
$(CC) $(CFLAGS) -o $@ $^

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

clean:
$(RM) hugepage-mmap hugepage-shm map_hugetlb
5 changes: 5 additions & 0 deletions tools/testing/selftests/vm/run_vmtests
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#we need 256M, below is the size in kB
needmem=262144
mnt=./huge
exitcode=0

#get pagesize and freepages from /proc/meminfo
while read name size unit; do
Expand Down Expand Up @@ -41,6 +42,7 @@ echo "--------------------"
./hugepage-mmap
if [ $? -ne 0 ]; then
echo "[FAIL]"
exitcode=1
else
echo "[PASS]"
fi
Expand All @@ -55,6 +57,7 @@ echo "--------------------"
./hugepage-shm
if [ $? -ne 0 ]; then
echo "[FAIL]"
exitcode=1
else
echo "[PASS]"
fi
Expand All @@ -67,6 +70,7 @@ echo "--------------------"
./map_hugetlb
if [ $? -ne 0 ]; then
echo "[FAIL]"
exitcode=1
else
echo "[PASS]"
fi
Expand All @@ -75,3 +79,4 @@ fi
umount $mnt
rm -rf $mnt
echo $nr_hugepgs > /proc/sys/vm/nr_hugepages
exit $exitcode

0 comments on commit 51a1d16

Please sign in to comment.