git » libjio » commit 574ee6d

Add the tests directory to the repo.

author Alberto Bertogli
2005-12-04 19:38:00 UTC
committer Alberto Bertogli
2007-07-15 13:54:32 UTC
parent 37d581e70af754ef775d951909763ee54429f754

Add the tests directory to the repo.

While the tests are far from complete, it's nice to have them on the repo
(they've always been in the tarballs).

Signed-off-by: Alberto Bertogli <albertito@gmail.com>

tests/.1.jio/1 +0 -0
tests/.1.jio/2 +0 -1
tests/.1.jio/3 +0 -0
tests/.1.jio/4 +0 -0
tests/.1.jio/5 +0 -0
tests/.1.jio/6 +0 -0
tests/.1.jio/8 +0 -0
tests/.1.jio/desc +0 -14
tests/.1.jio/lock +0 -0
tests/1 +0 -1
tests/performance/Makefile +24 -0
tests/recovery/.1.jio/2 +0 -0
tests/recovery/.1.jio/3 +0 -0
tests/recovery/.1.jio/4 +1 -0
tests/recovery/.1.jio/5 +1 -0
tests/recovery/.1.jio/6 +1 -0
tests/recovery/.1.jio/7 +0 -0
tests/recovery/.1.jio/desc +9 -0
tests/recovery/.1.jio/lock +0 -0
tests/recovery/1 +1 -0
tests/recovery/mklock +25 -0
tests/recovery/mktrans +48 -0

diff --git a/tests/.1.jio/1 b/tests/.1.jio/1
deleted file mode 100644
index 67b2ffa..0000000
Binary files a/tests/.1.jio/1 and /dev/null differ
diff --git a/tests/.1.jio/2 b/tests/.1.jio/2
deleted file mode 100644
index 96bdcc1..0000000
--- a/tests/.1.jio/2
+++ /dev/null
@@ -1 +0,0 @@
-Not so random but yet broken transaction
diff --git a/tests/.1.jio/3 b/tests/.1.jio/3
deleted file mode 100644
index 069bc8d..0000000
Binary files a/tests/.1.jio/3 and /dev/null differ
diff --git a/tests/.1.jio/4 b/tests/.1.jio/4
deleted file mode 100644
index 02b727b..0000000
Binary files a/tests/.1.jio/4 and /dev/null differ
diff --git a/tests/.1.jio/5 b/tests/.1.jio/5
deleted file mode 100644
index f9b5055..0000000
Binary files a/tests/.1.jio/5 and /dev/null differ
diff --git a/tests/.1.jio/6 b/tests/.1.jio/6
deleted file mode 100644
index e69de29..0000000
diff --git a/tests/.1.jio/8 b/tests/.1.jio/8
deleted file mode 100644
index dc5c2bb..0000000
Binary files a/tests/.1.jio/8 and /dev/null differ
diff --git a/tests/.1.jio/desc b/tests/.1.jio/desc
deleted file mode 100644
index 8b11482..0000000
--- a/tests/.1.jio/desc
+++ /dev/null
@@ -1,14 +0,0 @@
-
-tid	description
-
-1	random data
-2	simple ascii text
-3	valid transaction (stores 'TESTTESTTEST1234')
-4	header only
-5	header and a bit of data
-6	empty
-7	(doesn't exist)
-8	valid but oversized
-
-This leads to a file with 'TESTTESTTEST1234' on it.
-
diff --git a/tests/.1.jio/lock b/tests/.1.jio/lock
deleted file mode 100644
index 38424fc..0000000
Binary files a/tests/.1.jio/lock and /dev/null differ
diff --git a/tests/1 b/tests/1
deleted file mode 100644
index de6c6a5..0000000
--- a/tests/1
+++ /dev/null
@@ -1 +0,0 @@
-TESTTESTTEST1234
diff --git a/tests/performance/Makefile b/tests/performance/Makefile
new file mode 100644
index 0000000..c545dc3
--- /dev/null
+++ b/tests/performance/Makefile
@@ -0,0 +1,24 @@
+
+LIBS = -ljio -lpthread
+CFLAGS = -Wall -O6
+
+default: all
+
+all: paralell streaming
+
+paralell: paralell.o
+	$(CC) $(LIBS) paralell.o -o paralell
+
+streaming: streaming.o
+	$(CC) $(LIBS) streaming.o -o streaming
+
+.c.o:
+	$(CC) $(CFLAGS) -c $< -o $@
+
+clean:
+	rm -f streaming.o streaming paralell.o paralell
+	rm -f *.bb *.bbg *.da *.gcov gmon.out
+
+
+.PHONY: default all clean
+
diff --git a/tests/recovery/.1.jio/2 b/tests/recovery/.1.jio/2
new file mode 100644
index 0000000..4917df2
Binary files /dev/null and b/tests/recovery/.1.jio/2 differ
diff --git a/tests/recovery/.1.jio/3 b/tests/recovery/.1.jio/3
new file mode 100644
index 0000000..dba9ab9
Binary files /dev/null and b/tests/recovery/.1.jio/3 differ
diff --git a/tests/recovery/.1.jio/4 b/tests/recovery/.1.jio/4
new file mode 100644
index 0000000..e1a12b8
--- /dev/null
+++ b/tests/recovery/.1.jio/4
@@ -0,0 +1 @@
+\xef,\xbf\xf5\xfb\xb8*6\x97@\x87gi*\x9c7!2\xc8	󯩄
\ No newline at end of file
diff --git a/tests/recovery/.1.jio/5 b/tests/recovery/.1.jio/5
new file mode 100644
index 0000000..a781fd3
--- /dev/null
+++ b/tests/recovery/.1.jio/5
@@ -0,0 +1 @@
+XU\xc1\x8dXP_,\xd9`\\xafߋ(\xd3R*\x83\xbe\xde\xe7C\xea\xcf
\ No newline at end of file
diff --git a/tests/recovery/.1.jio/6 b/tests/recovery/.1.jio/6
new file mode 100644
index 0000000..bd9a8b2
--- /dev/null
+++ b/tests/recovery/.1.jio/6
@@ -0,0 +1 @@
+I\xbf\xe6\x9ab\xccǁ\xbe\xcc|X\x8b<[FH,\xe2\xe3긭\xa9\x81Z	\xbbK<\
\ No newline at end of file
diff --git a/tests/recovery/.1.jio/7 b/tests/recovery/.1.jio/7
new file mode 100644
index 0000000..5733512
Binary files /dev/null and b/tests/recovery/.1.jio/7 differ
diff --git a/tests/recovery/.1.jio/desc b/tests/recovery/.1.jio/desc
new file mode 100644
index 0000000..7f6996f
--- /dev/null
+++ b/tests/recovery/.1.jio/desc
@@ -0,0 +1,9 @@
+
+1	valid					Rollbacked
+2	pdata too big				Broken body
+3	udata too big, pdata too small		Broken body
+4	random data, short header		Broken header
+5	random data, header lenght ok		Broken body
+6	random data, long file			Broken body
+7	valid, shorten the file via ftruncate	Rollbacked
+
diff --git a/tests/recovery/.1.jio/lock b/tests/recovery/.1.jio/lock
new file mode 100644
index 0000000..593f470
Binary files /dev/null and b/tests/recovery/.1.jio/lock differ
diff --git a/tests/recovery/1 b/tests/recovery/1
new file mode 100644
index 0000000..8b450bf
--- /dev/null
+++ b/tests/recovery/1
@@ -0,0 +1 @@
+smaller
\ No newline at end of file
diff --git a/tests/recovery/mklock b/tests/recovery/mklock
new file mode 100644
index 0000000..d0ef9e3
--- /dev/null
+++ b/tests/recovery/mklock
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+
+"Generate a lock file"
+
+import sys
+import struct
+
+if sys.argv < 3:
+	print "Use: mklock filename number"
+	sys.exit(1)
+
+try:
+	n = int(sys.argv[2])
+except:
+	print "Use: mlock filename number"
+	sys.exit(1)
+
+fd = open(sys.argv[1], "w");
+
+s = struct.pack("I", n)
+
+fd.write(s)
+
+fd.close()
+
diff --git a/tests/recovery/mktrans b/tests/recovery/mktrans
new file mode 100644
index 0000000..1fa6894
--- /dev/null
+++ b/tests/recovery/mktrans
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+
+"Generate a transaction file"
+
+import sys
+import struct
+
+def help():
+	print "Use: mktrans tfile tid flags len plen ulen offset udata pdata"
+	sys.exit(1)
+
+
+if sys.argv < 10:
+	help()
+
+try:
+	file = sys.argv[1]
+	tid = int(sys.argv[2])
+	flags = int(sys.argv[3])
+	dlen = int(sys.argv[4])
+	plen = int(sys.argv[5])
+	ulen = int(sys.argv[6])
+	offset = int(sys.argv[7])
+	udata = sys.argv[8]
+	pdata = sys.argv[9]
+except:
+	help()
+
+fd = open(file, "w");
+
+s = struct.pack("IIIIIQ%ds%ds" % (len(udata), len(pdata)),\
+		tid, flags, dlen, plen, ulen, offset, \
+		udata, pdata)
+
+print 'tid:', tid
+print 'flags:', flags
+print 'dlen:', dlen
+print 'plen:', plen
+print 'ulen:', ulen
+print 'offset:', offset
+print 'udata: +%s+' % udata
+print 'pdata: +%s+' % pdata
+print 'total lenght:', len(s)
+
+fd.write(s)
+
+fd.close()
+