[PATCH 5/5] WIP: Add test for unlinkat_s
From: Alexander Holler
Date: Mon Feb 02 2015 - 12:05:46 EST
Simple test, needs the new rm with option -s.
Signed-off-by: Alexander Holler <holler@xxxxxxxxxxxxx>
---
test_unlinkat_s.sh | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
create mode 100755 test_unlinkat_s.sh
diff --git a/test_unlinkat_s.sh b/test_unlinkat_s.sh
new file mode 100755
index 0000000..f6ba6ac
--- /dev/null
+++ b/test_unlinkat_s.sh
@@ -0,0 +1,27 @@
+#!/bin/sh -e
+
+MOUNTDIR="$(mktemp -d --tmpdir unlinkat_s_mnt.XXXXXXXXXX)"
+TESTIMG="$(mktemp --tmpdir unlinkat_s_img.XXXXXXXXXX)"
+
+dd if=/dev/zero of=$TESTIMG bs=1M count=10
+mkfs.ext4 $TESTIMG
+grep -v -a abrakadabra $TESTIMG >/dev/null
+mount -o loop $TESTIMG $MOUNTDIR
+echo abrakadabra >$MOUNTDIR/foo.txt
+umount $MOUNTDIR
+grep -a abrakadabra $TESTIMG >/dev/null
+mount -o loop $TESTIMG $MOUNTDIR
+rm -s $MOUNTDIR/foo.txt
+umount $MOUNTDIR
+grep -v -a abrakadabra $TESTIMG >/dev/null
+mount -o loop $TESTIMG $MOUNTDIR
+echo abrakadabra >$MOUNTDIR/foo.txt
+umount $MOUNTDIR
+grep -a abrakadabra $TESTIMG >/dev/null
+mount -o loop $TESTIMG $MOUNTDIR
+rm $MOUNTDIR/foo.txt
+umount $MOUNTDIR
+grep -a abrakadabra $TESTIMG >/dev/null
+rm $TESTIMG
+rmdir $MOUNTDIR
+echo "unlinkat_s() worked and unlink() didn't"
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/