[Mirmince-commits] {tests} branch master updated. 374357e6e6fddf3d77ec879dcfe58d8ce51df71e

tg at freewrt.org tg at freewrt.org
Sun Jan 13 06:19:32 UTC 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Supplemental git repository tests for FreeWRT project mirmince".

The branch, master has been updated
       via  374357e6e6fddf3d77ec879dcfe58d8ce51df71e (commit)
      from  630ac099d45de89001b7f04d2c52f1881c83cd61 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 374357e6e6fddf3d77ec879dcfe58d8ce51df71e
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Sun Jan 13 06:17:48 2013 +0000

    a testsuite, and test both forms of open(2)

-----------------------------------------------------------------------

Summary of changes:
 Makefile        |   53 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 hw-unix.0.t.1   |    1 +
 hw-unix.0.t.do  |    2 ++
 hw-unix.0.t.out |  Bin 0 -> 24 bytes
 hw-unix.1.t.1   |    1 +
 hw-unix.1.t.do  |    2 ++
 hw-unix.1.t.out |  Bin 0 -> 32 bytes
 hw-unix.c       |    5 ++++-
 8 files changed, 62 insertions(+), 2 deletions(-)
 create mode 100644 hw-unix.0.t.1
 create mode 100644 hw-unix.0.t.do
 create mode 100644 hw-unix.0.t.out
 create mode 100644 hw-unix.1.t.1
 create mode 100644 hw-unix.1.t.do
 create mode 100644 hw-unix.1.t.out

diff --git a/Makefile b/Makefile
index 3964601..965fdbb 100644
--- a/Makefile
+++ b/Makefile
@@ -71,4 +71,55 @@ ${_i}: ${OBJS_${_i}}
 .endfor
 
 clean:
-	rm -f ${PROGS} ${PROGS:=.o} ${CLEANFILES}
+	rm -f ${PROGS} ${PROGS:=.o} ${CLEANFILES} *.out.*
+
+TESTRUNS+=	hw-unix.0 hw-unix.1
+RUN_hw-unix.0=	./hw-unix
+RUN_hw-unix.1=	./hw-unix foo bar
+
+regress: ${PROGS}
+	@:>tests.out.failed
+	@:>tests.out.passed
+.for _i in ${TESTRUNS}
+	@set +e; d=${_i:Q}; s=${.CURDIR:Q}/$$d; o=PASS; :>"$$d.out.0"; \
+	if [[ -s $$s.t.0 ]]; then \
+		cat "$$s.t.0"; \
+	else \
+		:; \
+	fi | ( ( ${RUN_${_i}} ); echo $$? >"$$d.out.e" ) \
+	    >"$$d.out.1" 2>"$$d.out.2"; \
+	if [[ -s $$s.t.e ]]; then \
+		diff -u "$$d.out.e" "$$s.t.e" >>"$$d.out.0" || o=FAIL; \
+	else \
+		ec=$$(<$$d.out.e); \
+		if (( ec )); then \
+			echo "Unexpected errorlevel $$ec" >>"$$d.out.0"; \
+			o=FAIL; \
+		fi; \
+	fi; \
+	if [[ -s $$s.t.1 ]]; then \
+		diff -u "$$d.out.1" "$$s.t.1" >>"$$d.out.0" || o=FAIL; \
+	elif [[ -s $$d.out.1 ]]; then \
+		diff -u "$$d.out.1" /dev/null >>"$$d.out.0"; \
+		o=FAIL; \
+	fi; \
+	if [[ -s $$s.t.2 ]]; then \
+		diff -u "$$d.out.2" "$$s.t.2" >>"$$d.out.0" || o=FAIL; \
+	elif [[ -s $$d.out.2 ]]; then \
+		diff -u "$$d.out.2" /dev/null >>"$$d.out.0"; \
+		o=FAIL; \
+	fi; \
+	if [[ -s $$s.t.do ]]; then \
+		${SHELL} "$$s.t.do" "$$d" "$$s" >>"$$d.out.0" || o=FAIL; \
+	fi; \
+	print -r -- $$o ${_i:Q}: ${RUN_${_i}:Q}; \
+	cat "$$d.out.0"; \
+	if [[ $$o = PASS ]]; then \
+		print -r -- ${_i:Q} >>tests.out.passed; \
+	else \
+		print -r -- ${_i:Q} >>tests.out.failed; \
+	fi
+.endfor
+	@print -r -- Total failed: $$(wc -l <tests.out.failed)
+	@print -r -- Total passed: $$(wc -l <tests.out.passed)
+	@[[ ! -s tests.out.failed ]]
diff --git a/hw-unix.0.t.1 b/hw-unix.0.t.1
new file mode 100644
index 0000000..8ab686e
--- /dev/null
+++ b/hw-unix.0.t.1
@@ -0,0 +1 @@
+Hello, World!
diff --git a/hw-unix.0.t.do b/hw-unix.0.t.do
new file mode 100644
index 0000000..6ff7f2f
--- /dev/null
+++ b/hw-unix.0.t.do
@@ -0,0 +1,2 @@
+d=$1 s=$2
+diff -au hw-unix.out "$s.t.out"
diff --git a/hw-unix.0.t.out b/hw-unix.0.t.out
new file mode 100644
index 0000000..d8b4d5c
Binary files /dev/null and b/hw-unix.0.t.out differ
diff --git a/hw-unix.1.t.1 b/hw-unix.1.t.1
new file mode 100644
index 0000000..8ab686e
--- /dev/null
+++ b/hw-unix.1.t.1
@@ -0,0 +1 @@
+Hello, World!
diff --git a/hw-unix.1.t.do b/hw-unix.1.t.do
new file mode 100644
index 0000000..6ff7f2f
--- /dev/null
+++ b/hw-unix.1.t.do
@@ -0,0 +1,2 @@
+d=$1 s=$2
+diff -au hw-unix.out "$s.t.out"
diff --git a/hw-unix.1.t.out b/hw-unix.1.t.out
new file mode 100644
index 0000000..8dc26d9
Binary files /dev/null and b/hw-unix.1.t.out differ
diff --git a/hw-unix.c b/hw-unix.c
index 0a76016..a93bf89 100644
--- a/hw-unix.c
+++ b/hw-unix.c
@@ -15,12 +15,15 @@ main(int argc, char *argv[])
 {
 	int fd;
 
-	if ((fd = open(fn, O_WRONLY | O_CREAT, 0666)) < 0)
+	if ((fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0)
 		return (1);
 	if ((size_t)write(fd, hw, sizeof(hw)) != sizeof(hw)) {
 		close(fd);
 		return (2);
 	}
+	close(fd);
+	if ((fd = open(fn, O_WRONLY | O_APPEND)) < 0)
+		return (1);
 	while (argc--) {
 		write(fd, *argv, strlen(*argv) + 1);
 		++argv;


hooks/post-receive
-- 
Supplemental git repository tests for FreeWRT project mirmince
(FreeWRT project mirmince repository tests)


More information about the Mirmince-commits mailing list