]> mj.ucw.cz Git - libucw.git/commitdiff
Libucw: Tests for some fastbufs which already have test main.
authorMichal Vaner <vorner@ucw.cz>
Mon, 21 Jul 2008 11:49:15 +0000 (13:49 +0200)
committerMartin Mares <mj@ucw.cz>
Tue, 22 Jul 2008 16:27:22 +0000 (18:27 +0200)
13 files changed:
ucw/Makefile
ucw/fastbuf.t [deleted file]
ucw/fb-atomic.c
ucw/fb-atomic.t [new file with mode: 0644]
ucw/fb-file.t [new file with mode: 0644]
ucw/fb-grow.t [new file with mode: 0644]
ucw/fb-limfd.c
ucw/fb-limfd.t [new file with mode: 0644]
ucw/fb-mem.c
ucw/fb-mem.t [new file with mode: 0644]
ucw/fb-pool.t [new file with mode: 0644]
ucw/fb-temp.c
ucw/fb-temp.t [new file with mode: 0644]

index 67d974e7edbb7fe30b96d72e6b393015b56922c6..e1e09368e5e67c835d366632f4f9e192c1906121 100644 (file)
@@ -91,9 +91,10 @@ $(o)/ucw/trie-test: $(o)/ucw/trie-test.o $(LIBUCW)
 $(o)/ucw/basecode: $(o)/ucw/basecode.o $(LIBUCW)
 
 TESTS+=$(addprefix $(o)/ucw/,regex.test unicode.test hash-test.test mempool.test stkstring.test \
-    slists.test kmp-test.test bbuf.test getopt.test fastbuf.test ff-unicode.test eltpool.test \
+    slists.test kmp-test.test bbuf.test getopt.test ff-unicode.test eltpool.test \
     fb-socket.test trie-test.test string.test sha1.test asort-test.test binheap-test.test \
-    redblack-test.test basecode.test)
+    redblack-test.test basecode.test fb-file.test fb-grow.test fb-pool.test fb-atomic.test \
+    fb-limfd.test fb-temp.test fb-mem.test)
 
 $(o)/ucw/regex.test: $(o)/ucw/regex-t
 $(o)/ucw/unicode.test: $(o)/ucw/unicode-t
@@ -105,10 +106,8 @@ $(o)/ucw/slists.test: $(o)/ucw/slists-t
 $(o)/ucw/kmp-test.test: $(o)/ucw/kmp-test
 $(o)/ucw/bbuf.test: $(o)/ucw/bbuf-t
 $(o)/ucw/getopt.test: $(o)/ucw/getopt-t
-$(o)/ucw/fastbuf.test: $(o)/ucw/fb-file-t $(o)/ucw/fb-grow-t $(o)/ucw/fb-pool-t
 $(o)/ucw/ff-unicode.test: $(o)/ucw/ff-unicode-t
 $(o)/ucw/eltpool.test: $(o)/ucw/eltpool-t
-$(o)/ucw/fb-socket.test: $(o)/ucw/fb-socket-t
 $(o)/ucw/string.test: $(o)/ucw/str-hex-t $(o)/ucw/str-esc-t
 $(o)/ucw/sha1.test: $(o)/ucw/sha1-t $(o)/ucw/sha1-hmac-t
 $(o)/ucw/trie-test.test: $(o)/ucw/trie-test
@@ -116,6 +115,8 @@ $(o)/ucw/asort-test.test: $(o)/ucw/asort-test
 $(o)/ucw/binheap-test.test: $(o)/ucw/binheap-test
 $(o)/ucw/redblack-test.test: $(o)/ucw/redblack-test
 $(o)/ucw/basecode.test: $(o)/ucw/basecode
+$(addprefix $(o)/ucw/fb-,file.test grow.test pool.test socket.test atomic.test \
+       limfd.test temp.test mem.test): %.test: %-t
 
 ifdef CONFIG_UCW_THREADS
 TESTS+=$(addprefix $(o)/ucw/,asio.test)
diff --git a/ucw/fastbuf.t b/ucw/fastbuf.t
deleted file mode 100644 (file)
index af00f9b..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-# Tests for fastbufs
-
-Run:   ../obj/ucw/fb-file-t
-Out:   112
-       <hello><hello><hello><hello><hello><hello><hello><hello><hello><hello><hello><hello><hello><hello><hello><hello>
-       112 116
-
-Run:   ../obj/ucw/fb-grow-t
-Out:   <10><10><0>1234512345<10><9>5<10>
-       <10><10><0>1234512345<10><9>5<10>
-       <10><10><0>1234512345<10><9>5<10>
-       <10><10><0>1234512345<10><9>5<10>
-       <10><10><0>1234512345<10><9>5<10>
-
-Run:   ../obj/ucw/fb-pool-t
index b5fb6223a01fec4c5d74554a465cdced73c5f28f..bc350f636944a1486d09875060fe26800e128e13 100644 (file)
@@ -145,13 +145,13 @@ int main(int argc UNUSED, char **argv UNUSED)
 {
   struct fastbuf *f, *g;
 
-  log(L_INFO, "Testing block writes");
+  msg(L_INFO, "Testing block writes");
   f = fbatomic_open("test", NULL, 16, 4);
   for (u32 i=0; i<17; i++)
     bwrite(f, &i, 4);
   bclose(f);
 
-  log(L_INFO, "Testing interleaved var-size writes");
+  msg(L_INFO, "Testing interleaved var-size writes");
   f = fbatomic_open("test2", NULL, 23, -5);
   g = fbatomic_open("test2", f, 23, -5);
   for (int i=0; i<100; i++)
diff --git a/ucw/fb-atomic.t b/ucw/fb-atomic.t
new file mode 100644 (file)
index 0000000..be70c63
--- /dev/null
@@ -0,0 +1,7 @@
+# Test for fb-atomic
+
+Run:   ../obj/ucw/fb-atomic-t 2>&1 | sed -e 's/^\(.\) [^ ]* [^ ]* /\1 /'
+Out:   I Testing block writes
+       I Testing interleaved var-size writes
+       D Reallocating buffer for atomic file test2 with slack 10
+       D Reallocating buffer for atomic file test2 with slack 10
diff --git a/ucw/fb-file.t b/ucw/fb-file.t
new file mode 100644 (file)
index 0000000..7a0c21d
--- /dev/null
@@ -0,0 +1,7 @@
+#Tests for fb-file
+
+Run:   ../obj/ucw/fb-file-t
+Out:   112
+       <hello><hello><hello><hello><hello><hello><hello><hello><hello><hello><hello><hello><hello><hello><hello><hello>
+       112 116
+
diff --git a/ucw/fb-grow.t b/ucw/fb-grow.t
new file mode 100644 (file)
index 0000000..8b88418
--- /dev/null
@@ -0,0 +1,9 @@
+# Tests for fb-grow.c
+
+Run:   ../obj/ucw/fb-grow-t
+Out:   <10><10><0>1234512345<10><9>5<10>
+       <10><10><0>1234512345<10><9>5<10>
+       <10><10><0>1234512345<10><9>5<10>
+       <10><10><0>1234512345<10><9>5<10>
+       <10><10><0>1234512345<10><9>5<10>
+
index a1c218aa21388fb49ff3a65468e9e1e97074dedf..7e30f6a2029c9e38cf3efe58c41b058134022750 100644 (file)
@@ -60,7 +60,7 @@ bopen_limited_fd(int fd, uns buflen, uns limit)
 
 #ifdef TEST
 
-int main(int argc, char **argv)
+int main(int UNUSED argc, char UNUSED **argv)
 {
   struct fastbuf *f = bopen_limited_fd(0, 3, 13);
   struct fastbuf *o = bfdopen_shared(1, 16);
diff --git a/ucw/fb-limfd.t b/ucw/fb-limfd.t
new file mode 100644 (file)
index 0000000..25fe12d
--- /dev/null
@@ -0,0 +1,6 @@
+# Tests for fb-limfd
+
+Run:   ../obj/ucw/fb-limfd-t
+In:    123456789012
+       4567890
+Out:   123456789012
index cddb169a8c690f2c2f29de1cb137b4c12f2514d7..1acb38f6c3f6721b6742abe67934cbe8ce70a7f0 100644 (file)
@@ -213,6 +213,7 @@ int main(void)
   printf("<!%d>", (int)btell(r));
   while ((t = bgetc(r)) >= 0)
     putchar(t);
+  putchar('\n');
   fflush(stdout);
   bclose(r);
   return 0;
diff --git a/ucw/fb-mem.t b/ucw/fb-mem.t
new file mode 100644 (file)
index 0000000..54b71c6
--- /dev/null
@@ -0,0 +1,4 @@
+# Test for fb-mem.c
+
+Run:   ../obj/ucw/fb-mem-t
+Out:   <10><10><0>1234512345<10><20><!0>12345123451234512345<!3>45123451234512345
diff --git a/ucw/fb-pool.t b/ucw/fb-pool.t
new file mode 100644 (file)
index 0000000..0b87bf2
--- /dev/null
@@ -0,0 +1,3 @@
+# Test for fb-tool.c
+
+Run:   ../obj/ucw/fb-pool-t
index f3c574b6bb047d57851e26747dc2dac11722bd85..05fb655b3f65934afa6a1d40c59ad75e6992d20b 100644 (file)
@@ -50,6 +50,7 @@ int main(int argc, char **argv)
     die("Hey, whaddya want?");
 
   struct fastbuf *f = bopen_tmp(65536);
+  ASSERT(f && f->name);
   bputsn(f, "Hello, world!");
   bclose(f);
   return 0;
diff --git a/ucw/fb-temp.t b/ucw/fb-temp.t
new file mode 100644 (file)
index 0000000..952d86d
--- /dev/null
@@ -0,0 +1,3 @@
+# Test for fb-temp.c
+
+Run:   ../obj/ucw/fb-temp-t