Add beginnings of a test suite
authorJoachim Breitner <mail@joachim-breitner.de>
Sun, 22 Aug 2010 17:26:24 +0000 (17:26 +0000)
committerJoachim Breitner <mail@joachim-breitner.de>
Sun, 22 Aug 2010 17:26:24 +0000 (17:26 +0000)
13 files changed:
tests/runall.sh [new file with mode: 0644]
tests/split1/after/changes [new file with mode: 0644]
tests/split1/after/patches/featureA.patch [new file with mode: 0644]
tests/split1/after/patches/featureB.patch [new file with mode: 0644]
tests/split1/after/patches/series [new file with mode: 0644]
tests/split1/after/patches/testpatch [new file with mode: 0644]
tests/split1/after/src/code [new file with mode: 0644]
tests/split1/before/changes [new file with mode: 0644]
tests/split1/before/patches/series [new file with mode: 0644]
tests/split1/before/patches/testpatch [new file with mode: 0644]
tests/split1/before/src/code [new file with mode: 0644]
tests/split1/edithunk.sh [new file with mode: 0644]
tests/split1/run.sh [new file with mode: 0644]

diff --git a/tests/runall.sh b/tests/runall.sh
new file mode 100644 (file)
index 0000000..7dc5177
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+cd $(dirname "$0")
+
+for dir in *
+do
+       if test -d $dir
+       then
+               echo -n "Test $dir... "
+               if $dir/run.sh >$dir/last-run.log 2>&1
+               then echo "ok."
+               else echo "failed!."
+               fi
+       fi
+done
+
diff --git a/tests/split1/after/changes b/tests/split1/after/changes
new file mode 100644 (file)
index 0000000..325ceab
--- /dev/null
@@ -0,0 +1,5 @@
+unreleased:
+ * Some change
+
+version 0.1:
+ * Initial Version
diff --git a/tests/split1/after/patches/featureA.patch b/tests/split1/after/patches/featureA.patch
new file mode 100644 (file)
index 0000000..d6a90a5
--- /dev/null
@@ -0,0 +1,18 @@
+diff -u -r old/changes new/changes
+--- old/changes        ignored date
++++ new/changes        ignored date
+@@ -1,5 +1,6 @@
+ unreleased:
+  * Some change
++ * Adding feature A
+ version 0.1:
+  * Initial Version
+diff -u -r old/src/code new/src/code
+--- old/src/code       ignored date
++++ new/src/code       ignored date
+@@ -1,3 +1,3 @@
+ This is the code.
+-It has some lines.
++It has some lines that we change to implement feature A.
+ That we want to edit.
diff --git a/tests/split1/after/patches/featureB.patch b/tests/split1/after/patches/featureB.patch
new file mode 100644 (file)
index 0000000..0573f64
--- /dev/null
@@ -0,0 +1,19 @@
+diff -u -r old/changes new/changes
+--- old/changes        ignored date
++++ new/changes        ignored date
+@@ -1,6 +1,7 @@
+ unreleased:
+  * Some change
+  * Adding feature A
++ * Adding feature B
+ version 0.1:
+  * Initial Version
+diff -u -r old/src/code new/src/code
+--- old/src/code       ignored date
++++ new/src/code       ignored date
+@@ -1,3 +1,4 @@
+ This is the code.
+ It has some lines that we change to implement feature A.
+ That we want to edit.
++Here we add a line to implement feature B
diff --git a/tests/split1/after/patches/series b/tests/split1/after/patches/series
new file mode 100644 (file)
index 0000000..9f964bd
--- /dev/null
@@ -0,0 +1 @@
+testpatch
diff --git a/tests/split1/after/patches/testpatch b/tests/split1/after/patches/testpatch
new file mode 100644 (file)
index 0000000..32fb335
--- /dev/null
@@ -0,0 +1,22 @@
+Index: test/changes
+===================================================================
+--- test.orig/changes  2010-08-03 16:42:39.000000000 +0200
++++ test/changes       2010-08-03 18:41:31.000000000 +0200
+@@ -1,5 +1,7 @@
+ unreleased:
+  * Some change
++ * Adding feature A
++ * Adding feature B
+ version 0.1:
+  * Initial Version
+Index: test/src/code
+===================================================================
+--- test.orig/src/code 2010-08-03 16:42:39.000000000 +0200
++++ test/src/code      2010-08-03 18:41:51.000000000 +0200
+@@ -1,3 +1,4 @@
+ This is the code.
+-It has some lines.
++It has some lines that we change to implement feature A.
+ That we want to edit.
++Here we add a line to implement feature B
diff --git a/tests/split1/after/src/code b/tests/split1/after/src/code
new file mode 100644 (file)
index 0000000..1646544
--- /dev/null
@@ -0,0 +1,3 @@
+This is the code.
+It has some lines.
+That we want to edit.
diff --git a/tests/split1/before/changes b/tests/split1/before/changes
new file mode 100644 (file)
index 0000000..325ceab
--- /dev/null
@@ -0,0 +1,5 @@
+unreleased:
+ * Some change
+
+version 0.1:
+ * Initial Version
diff --git a/tests/split1/before/patches/series b/tests/split1/before/patches/series
new file mode 100644 (file)
index 0000000..9f964bd
--- /dev/null
@@ -0,0 +1 @@
+testpatch
diff --git a/tests/split1/before/patches/testpatch b/tests/split1/before/patches/testpatch
new file mode 100644 (file)
index 0000000..32fb335
--- /dev/null
@@ -0,0 +1,22 @@
+Index: test/changes
+===================================================================
+--- test.orig/changes  2010-08-03 16:42:39.000000000 +0200
++++ test/changes       2010-08-03 18:41:31.000000000 +0200
+@@ -1,5 +1,7 @@
+ unreleased:
+  * Some change
++ * Adding feature A
++ * Adding feature B
+ version 0.1:
+  * Initial Version
+Index: test/src/code
+===================================================================
+--- test.orig/src/code 2010-08-03 16:42:39.000000000 +0200
++++ test/src/code      2010-08-03 18:41:51.000000000 +0200
+@@ -1,3 +1,4 @@
+ This is the code.
+-It has some lines.
++It has some lines that we change to implement feature A.
+ That we want to edit.
++Here we add a line to implement feature B
diff --git a/tests/split1/before/src/code b/tests/split1/before/src/code
new file mode 100644 (file)
index 0000000..1646544
--- /dev/null
@@ -0,0 +1,3 @@
+This is the code.
+It has some lines.
+That we want to edit.
diff --git a/tests/split1/edithunk.sh b/tests/split1/edithunk.sh
new file mode 100644 (file)
index 0000000..1cd6a21
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+ed $1 <<__END__
+11t9
+wq
+__END__
diff --git a/tests/split1/run.sh b/tests/split1/run.sh
new file mode 100644 (file)
index 0000000..12907ad
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+set -e
+
+cd $(dirname $0)
+
+if test -x ../../dist/build/ipatch/ipatch
+then IPATCH=$PWD/../../dist/build/ipatch/ipatch
+else IPATCH=ipatch
+fi
+export EDITOR="$PWD/edithunk.sh"
+
+rm -rf tmp
+
+cp -r before/ tmp
+cd tmp
+export PATH="..:$PATH"
+#$IPATCH split patches/testpatch
+( echo eynynpatches/featureA.patch
+  echo yypatches/featureB.patch 
+)| $IPATCH split patches/testpatch
+
+perl -p -i -e 's/\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d.\d+ .\d\d\d\d/ignored date/' patches/feature?.patch
+cd ..
+diff -r tmp after
+rm -rf tmp
+echo "Test done"
+