[StGIT PATCH 0/2] New and improved tests

DORMANTno replies

3 messages, 1 author, 2016-06-15 · open the first message on its own page

[StGIT PATCH 0/2] New and improved tests

From: Karl Hasselström <hidden>
Date: 2016-06-15 22:43:27

One new and one improved test, both primarily useful for making sure
the DAG pseries doesn't break anything, since no one else has managed
to produce bugs that mess up the patch order.

This far. So they might be worth having anyway. :-)

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

[StGIT PATCH 1/2] New test: make sure that popping doesn't change patch order

From: Karl Hasselström <hidden>
Date: 2016-06-15 22:43:27

This is mostly useful in conjunction with the DAG appliedness patches,
since getting this right with a plain series file _ought_ to be
trivial. Nevertheless ...

Signed-off-by: Karl Hasselström <redacted>

---

 t/t1203-pop.sh |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/t/t1203-pop.sh b/t/t1203-pop.sh
new file mode 100755
index 0000000..0a311d4
--- /dev/null
+++ b/t/t1203-pop.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+# Copyright (c) 2007 Karl Hasselström
+test_description='Test the pop command'
+. ./test-lib.sh
+
+test_expect_success \
+    'Initialize the StGIT repository' \
+    'stg init'
+
+test_expect_success \
+    'Create ten patches' '
+    for i in 0 1 2 3 4 5 6 7 8 9; do
+        stg new p$i -m p$i;
+    done &&
+    [ "$(echo $(stg applied))" = "p0 p1 p2 p3 p4 p5 p6 p7 p8 p9" ] &&
+    [ "$(echo $(stg unapplied))" = "" ]
+'
+
+test_expect_success \
+    'Pop half the patches' '
+    stg pop -n 5 &&
+    [ "$(echo $(stg applied))" = "p0 p1 p2 p3 p4" ] &&
+    [ "$(echo $(stg unapplied))" = "p5 p6 p7 p8 p9" ]
+'
+
+test_expect_success \
+    'Pop the remaining patches' '
+    stg pop -a &&
+    [ "$(echo $(stg applied))" = "" ] &&
+    [ "$(echo $(stg unapplied))" = "p0 p1 p2 p3 p4 p5 p6 p7 p8 p9" ]
+'
+
+test_done

[StGIT PATCH 2/2] Verify patch status during the test

From: Karl Hasselström <hidden>
Date: 2016-06-15 22:43:27

Signed-off-by: Karl Hasselström <redacted>

---

 t/t1200-push-modified.sh |   55 +++++++++++++++++++++++++++-------------------
 1 files changed, 32 insertions(+), 23 deletions(-)
diff --git a/t/t1200-push-modified.sh b/t/t1200-push-modified.sh
index 324b3b0..0e408d0 100755
--- a/t/t1200-push-modified.sh
+++ b/t/t1200-push-modified.sh
@@ -19,23 +19,26 @@ specify --merged, then rollback and retry with the correct flag.'
 test_create_repo foo
 
 test_expect_success \
-    'Clone tree and setup changes' \
-    "stg clone foo bar &&
-     (cd bar && stg new p1 -m p1 &&
-      printf 'a\nc\n' > file && stg add file && stg refresh &&
-      stg new p2 -m p2 &&
-      printf 'a\nb\nc\n' > file && stg refresh
-     )
-"
+    'Clone tree and setup changes' '
+    stg clone foo bar &&
+    (
+        cd bar && stg new p1 -m p1 &&
+        printf "a\nc\n" > file && stg add file && stg refresh &&
+        stg new p2 -m p2 &&
+        printf "a\nb\nc\n" > file && stg refresh &&
+        [ "$(echo $(stg applied))" = "p1 p2" ] &&
+        [ "$(echo $(stg unapplied))" = "" ]
+    )
+'
 
 test_expect_success \
-    'Port those patches to orig tree' \
-    '(cd foo &&
-      GIT_DIR=../bar/.git git-format-patch --stdout \
-          $(cd ../bar && stg id base@master)..HEAD |
-      git-am -3 -k
-     )
-    '
+    'Port those patches to orig tree' '
+    (
+        cd foo &&
+        GIT_DIR=../bar/.git git-format-patch --stdout \
+          $(cd ../bar && stg id base@master)..HEAD | git-am -3 -k
+    )
+'
 
 test_expect_success \
     'Pull to sync with parent, preparing for the problem' \
@@ -51,15 +54,21 @@ test_expect_failure \
 "
 
 test_expect_success \
-    'Rollback the push' \
-    "(cd bar && stg push --undo
-     )
-"
+    'Rollback the push' '
+    (
+        cd bar && stg push --undo &&
+        [ "$(echo $(stg applied))" = "" ] &&
+        [ "$(echo $(stg unapplied))" = "p1 p2" ]
+    )
+'
 
 test_expect_success \
-    'Push those patches while checking they were merged upstream' \
-    "(cd bar && stg push --merged --all
-     )
-"
+    'Push those patches while checking they were merged upstream' '
+    (
+        cd bar && stg push --merged --all
+        [ "$(echo $(stg applied))" = "p1 p2" ] &&
+        [ "$(echo $(stg unapplied))" = "" ]
+    )
+'
 
 test_done
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help