git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Lesh <eclesh@ucla.edu>
To: jsipek@cs.sunysb.edu
Cc: git@vger.kernel.org, Eric Lesh <eclesh@ucla.edu>
Subject: [GUILT PATCH 5/5] Guards test suite
Date: Mon, 30 Jul 2007 20:11:21 -0700	[thread overview]
Message-ID: <11858514811776-git-send-email-eclesh@ucla.edu> (raw)
In-Reply-To: <1185851481190-git-send-email-eclesh@ucla.edu>

The guards patches touch a lot of guilt, so make sure they don't muck
anything up.

Signed-off-by: Eric Lesh <eclesh@ucla.edu>
---
 regression/070-guards.sh |  184 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 184 insertions(+), 0 deletions(-)
 create mode 100755 regression/070-guards.sh

diff --git a/regression/070-guards.sh b/regression/070-guards.sh
new file mode 100755
index 0000000..d6917f2
--- /dev/null
+++ b/regression/070-guards.sh
@@ -0,0 +1,184 @@
+#!/bin/bash
+#
+# Test the commands that use get_*_series, while applying guards
+#
+
+source scaffold
+source generic_test_data
+
+function prepare_for_tests
+{
+	# generic_test_data's patches all depend on each other
+	# that's no good for guards testing
+
+	echo "abc" > def
+	git-add def
+	git-commit -s -m "initial" 2> /dev/null > /dev/null
+
+	cat << DONE > .git/patches/master/first
+diff --git a/first b/first
+new file mode 100644
+index 0000000..9c59e24
+--- /dev/null
++++ b/first
+@@ -0,0 +1 @@
++first
+DONE
+
+	cat << DONE > .git/patches/master/second
+diff --git a/second b/second
+new file mode 100644
+index 0000000..e019be0
+--- /dev/null
++++ b/second
+@@ -0,0 +1 @@
++second
+DONE
+
+	cat << DONE > .git/patches/master/third
+diff --git a/third b/third
+new file mode 100644
+index 0000000..234496b
+--- /dev/null
++++ b/third
+@@ -0,0 +1 @@
++third
+DONE
+
+	cat << DONE > .git/patches/master/fourth
+diff --git a/fourth b/fourth
+new file mode 100644
+index 0000000..285a4e6
+--- /dev/null
++++ b/fourth
+@@ -0,0 +1 @@
++fourth
+DONE
+
+	cat << DONE > .git/patches/master/series
+first
+second
+third
+fourth
+DONE
+
+	touch -d "$GIT_COMMITTER_DATE" .git/patches/master/first
+	touch -d "$GIT_COMMITTER_DATE" .git/patches/master/second
+	touch -d "$GIT_COMMITTER_DATE" .git/patches/master/third
+	touch -d "$GIT_COMMITTER_DATE" .git/patches/master/fourth
+}
+
+function expected_applied_none
+{
+	echo "first"
+	echo "second"
+	echo "third"
+	echo "fourth"
+}
+
+function expected_applied_positive
+{
+	echo "second"
+	echo "third"
+	echo "fourth"
+}
+
+function expected_applied_positive_selected
+{
+	echo "first"
+	echo "second"
+	echo "third"
+	echo "fourth"
+}
+
+function expected_applied_negative
+{
+	echo "first"
+	echo "second"
+	echo "third"
+	echo "fourth"
+}
+
+function expected_applied_negative_selected
+{
+	echo "second"
+	echo "third"
+	echo "fourth"
+}
+
+function expected_next
+{
+	echo "second"
+}
+
+function expected_unapplied
+{
+	echo "second"
+	echo "third"
+	echo "fourth"
+}
+
+empty_repo
+cd $REPODIR
+guilt-init
+
+prepare_for_tests
+
+# test with no guarded patches and no guards selected
+guilt-push -a > /dev/null
+guilt-applied > /tmp/reg.$$
+expected_applied_none | diff -u - /tmp/reg.$$
+echo -n "[none] "
+
+# test with one positive guarded patch and no guards selected
+guilt-pop -a > /dev/null
+guilt-guard first +foo
+guilt-push -a > /dev/null
+guilt-applied > /tmp/reg.$$
+expected_applied_positive | diff -u - /tmp/reg.$$
+echo -n "[positive] "
+
+# test with one positive guarded patch with that guard selected
+guilt-pop -a > /dev/null
+guilt-select foo
+guilt-push -a > /dev/null
+guilt-applied > /tmp/reg.$$
+expected_applied_positive_selected | diff -u - /tmp/reg.$$
+echo -n "[positive selected] "
+
+# test with one negative guarded patch and no guards selected
+guilt pop -a > /dev/null
+guilt-select -n
+guilt-guard first -foo
+guilt-push -a > /dev/null
+guilt-applied > /tmp/reg.$$
+expected_applied_negative | diff -u - /tmp/reg.$$
+echo -n "[negative] "
+
+# test with one negative guarded patch with that guard selected
+guilt pop -a > /dev/null
+guilt-select foo
+guilt-push -a > /dev/null
+guilt-applied > /tmp/reg.$$
+expected_applied_negative_selected | diff -u - /tmp/reg.$$
+echo -n "[negative selected] "
+
+# test that guilt-next works
+guilt-pop -a > /dev/null
+guilt-select -n
+guilt-guard first +foo
+guilt-next > /tmp/reg.$$
+expected_next | diff -u - /tmp/reg.$$
+echo -n "[next] "
+
+# test that guilt-unapplied works
+guilt-pop -a > /dev/null
+guilt-select -n
+guilt-guard first +foo
+guilt-unapplied > /tmp/reg.$$
+expected_unapplied | diff -u - /tmp/reg.$$
+echo -n "[unapplied] "
+
+rm -f /tmp/reg.$$
+
+complete_test
-- 
1.5.2

  parent reply	other threads:[~2007-07-31  3:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-31  3:11 [GUILT PATCH v2 0/5] Add guards to guilt Eric Lesh
2007-07-31  3:11 ` [GUILT PATCH 1/5] get_series: Remove comments from end of series lines Eric Lesh
2007-07-31  3:50   ` Josef Sipek
2007-07-31  3:11 ` [GUILT PATCH 2/5] guilt-guard: Assign guards to patches in series Eric Lesh
2007-07-31  4:05   ` Josef Sipek
2007-08-09  7:34     ` Eric Lesh
2007-08-09  8:17       ` David Kastrup
2007-08-09  8:22         ` Thomas Adam
2007-08-09  8:43           ` David Kastrup
2007-08-09  8:53           ` Eric Lesh
2007-08-09  9:01         ` Eric Lesh
2007-08-09 13:47       ` Josef Sipek
2007-07-31  3:11 ` [GUILT PATCH 3/5] guilt-select: Select guards to apply when pushing patches Eric Lesh
2007-07-31  3:11 ` [GUILT PATCH 4/5] get_series: return guarded patches only Eric Lesh
2007-07-31  3:11 ` Eric Lesh [this message]
2007-07-31  3:42 ` [GUILT PATCH v2 0/5] Add guards to guilt Josef Sipek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11858514811776-git-send-email-eclesh@ucla.edu \
    --to=eclesh@ucla.edu \
    --cc=git@vger.kernel.org \
    --cc=jsipek@cs.sunysb.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).