[Reproducible-commits] [disorderfs] 01/01: Add tests for sorting and reversing directory entries.

Chris Lamb chris at chris-lamb.co.uk
Tue Aug 23 12:46:35 UTC 2016


This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository disorderfs.

commit 647b7d6ebe0d86cc4bc8543adedbefa7da260ce6
Author: Chris Lamb <lamby at debian.org>
Date:   Tue Aug 23 13:46:30 2016 +0100

    Add tests for sorting and reversing directory entries.
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 Makefile         |  9 ++++++++-
 tests/common     | 22 ++++++++++++++++++++++
 tests/fixtures/a |  0
 tests/fixtures/b |  0
 tests/fixtures/c |  0
 tests/sort       | 11 +++++++++++
 6 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 41c1067..60f255b 100644
--- a/Makefile
+++ b/Makefile
@@ -93,7 +93,14 @@ install-man: build-man
 	install -d $(DESTDIR)$(MANDIR)/man1
 	install -m 644 disorderfs.1 $(DESTDIR)$(MANDIR)/man1/
 
+#
+# Test
+#
+test: build
+	cd tests && run-parts --verbose .
+
 .PHONY: all \
 	build build-bin build-man \
 	clean clean-bin clean-man \
-	install install-bin install-man
+	install install-bin install-man \
+	test
diff --git a/tests/common b/tests/common
new file mode 100644
index 0000000..9df1957
--- /dev/null
+++ b/tests/common
@@ -0,0 +1,22 @@
+trap "Unmount 2>/dev/null" EXIT
+
+Mount () {
+	Unmount
+	mkdir -p target
+	../disorderfs "${@}" "$(pwd)/fixtures/" target/
+}
+
+Unmount () {
+	fusermount -u target/ 2>/dev/null && rm -rf target/
+}
+
+Expect () {
+	ENTRIES="$(find target -type f -printf %f)"
+	EXPECTED="${1}"
+
+	if [ "${ENTRIES}" != "${EXPECTED}" ]
+	then
+		echo "E: saw ${ENTRIES}, expected ${EXPECTED}"
+		exit 1
+	fi
+}
diff --git a/tests/fixtures/a b/tests/fixtures/a
new file mode 100644
index 0000000..e69de29
diff --git a/tests/fixtures/b b/tests/fixtures/b
new file mode 100644
index 0000000..e69de29
diff --git a/tests/fixtures/c b/tests/fixtures/c
new file mode 100644
index 0000000..e69de29
diff --git a/tests/sort b/tests/sort
new file mode 100755
index 0000000..371d8e2
--- /dev/null
+++ b/tests/sort
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. ./common
+ 
+Mount --sort-dirents=yes --reverse-dirents=no
+Expect abc
+Unmount
+
+Mount --sort-dirents=yes --reverse-dirents=yes
+Expect cba
+Unmount

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/disorderfs.git



More information about the Reproducible-commits mailing list