git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [StGIT PATCH 0/2] Make test suite work with dash as /bin/sh
@ 2007-04-29 21:09 Karl Hasselström
  2007-04-29 21:09 ` [StGIT PATCH 1/2] String comparison is done with "=", not "==" Karl Hasselström
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Karl Hasselström @ 2007-04-29 21:09 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

I got some strange errors when running the StGIT test suite on a
machine I hadn't tried developing on before. It turned out that its
/bin/sh was dash, and that a few bashisms needed fixing.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [StGIT PATCH 1/2] String comparison is done with "=", not "=="
  2007-04-29 21:09 [StGIT PATCH 0/2] Make test suite work with dash as /bin/sh Karl Hasselström
@ 2007-04-29 21:09 ` Karl Hasselström
  2007-04-29 21:09 ` [StGIT PATCH 2/2] dash doesn't do curly brace expansion, so avoid that Karl Hasselström
  2007-04-29 22:44 ` [StGIT PATCH 0/2] Make test suite work with dash as /bin/sh Catalin Marinas
  2 siblings, 0 replies; 5+ messages in thread
From: Karl Hasselström @ 2007-04-29 21:09 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

From: Karl Hasselström <kha@treskal.com>

The "test" builtin in bash accepts both "==" and "=", but it didn't
work with dash as /bin/sh.

Signed-off-by: Karl Hasselström <kha@treskal.com>
---

 t/t1300-uncommit.sh |    8 ++++----
 t/t1800-import.sh   |   26 +++++++++++++-------------
 t/t1900-mail.sh     |    2 +-
 t/t2000-sync.sh     |   14 +++++++-------
 4 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/t/t1300-uncommit.sh b/t/t1300-uncommit.sh
index 497c354..519234e 100755
--- a/t/t1300-uncommit.sh
+++ b/t/t1300-uncommit.sh
@@ -42,7 +42,7 @@ test_expect_success \
 	'Uncommit the patches using names' \
 	'
 	stg uncommit bar foo &&
-	[ "$(stg id foo//top)" == "$(stg id bar//bottom)" ] &&
+	[ "$(stg id foo//top)" = "$(stg id bar//bottom)" ] &&
 	stg commit
 	'
 
@@ -50,7 +50,7 @@ test_expect_success \
 	'Uncommit the patches using prefix' \
 	'
 	stg uncommit --number=2 foobar &&
-	[ "$(stg id foobar1//top)" == "$(stg id foobar2//bottom)" ] &&
+	[ "$(stg id foobar1//top)" = "$(stg id foobar2//bottom)" ] &&
 	stg commit
 	'
 
@@ -58,7 +58,7 @@ test_expect_success \
 	'Uncommit the patches using auto names' \
 	'
 	stg uncommit --number=2 &&
-	[ "$(stg id foo-patch//top)" == "$(stg id bar-patch//bottom)" ] &&
+	[ "$(stg id foo-patch//top)" = "$(stg id bar-patch//bottom)" ] &&
 	stg commit
 	'
 
@@ -67,7 +67,7 @@ test_expect_success \
 	'
 	stg uncommit &&
 	stg uncommit &&
-	[ "$(stg id foo-patch//top)" == "$(stg id bar-patch//bottom)" ] &&
+	[ "$(stg id foo-patch//top)" = "$(stg id bar-patch//bottom)" ] &&
 	stg commit
 	'
 test_done
diff --git a/t/t1800-import.sh b/t/t1800-import.sh
index 0c1baa3..ed10fa8 100755
--- a/t/t1800-import.sh
+++ b/t/t1800-import.sh
@@ -19,7 +19,7 @@ test_expect_success \
     '
     stg import ../t1800-import/git-diff &&
     [ $(git cat-file -p $(stg id) \
-        | grep -c "tree e96b1fba2160890ff600b675d7140d46b022b155") == 1 ] &&
+        | grep -c "tree e96b1fba2160890ff600b675d7140d46b022b155") = 1 ] &&
     stg delete ..
     '
 
@@ -28,7 +28,7 @@ test_expect_success \
     '
     stg import ../t1800-import/gnu-diff &&
     [ $(git cat-file -p $(stg id) \
-        | grep -c "tree e96b1fba2160890ff600b675d7140d46b022b155") == 1 ] &&
+        | grep -c "tree e96b1fba2160890ff600b675d7140d46b022b155") = 1 ] &&
     stg delete ..
     '
 
@@ -37,7 +37,7 @@ test_expect_success \
     '
     stg import ../t1800-import/stg-export &&
     [ $(git cat-file -p $(stg id) \
-        | grep -c "tree e96b1fba2160890ff600b675d7140d46b022b155") == 1 ] &&
+        | grep -c "tree e96b1fba2160890ff600b675d7140d46b022b155") = 1 ] &&
     stg delete ..
     '
 
@@ -46,9 +46,9 @@ test_expect_success \
     '
     stg import -m ../t1800-import/email-8bit &&
     [ $(git cat-file -p $(stg id) \
-        | grep -c "tree 030be42660323ff2a1958f9ee79589a4f3fbee2f") == 1 ] &&
+        | grep -c "tree 030be42660323ff2a1958f9ee79589a4f3fbee2f") = 1 ] &&
     [ $(git cat-file -p $(stg id) \
-        | grep -c "author Inge Ström <inge@power.com>") == 1 ] &&
+        | grep -c "author Inge Ström <inge@power.com>") = 1 ] &&
     stg delete ..
     '
 
@@ -57,9 +57,9 @@ test_expect_success \
     '
     stg import -m ../t1800-import/email-qp &&
     [ $(git cat-file -p $(stg id) \
-        | grep -c "tree 030be42660323ff2a1958f9ee79589a4f3fbee2f") == 1 ] &&
+        | grep -c "tree 030be42660323ff2a1958f9ee79589a4f3fbee2f") = 1 ] &&
     [ $(git cat-file -p $(stg id) \
-        | grep -c "author Inge Ström <inge@power.com>") == 1 ] &&
+        | grep -c "author Inge Ström <inge@power.com>") = 1 ] &&
     stg delete ..
     '
 
@@ -68,17 +68,17 @@ test_expect_success \
     '
     stg import -M ../t1800-import/email-mbox &&
     [ $(git cat-file -p $(stg id change-1) \
-        | grep -c "tree 401bef82cd9fb403aba18f480a63844416a2e023") == 1 ] &&
+        | grep -c "tree 401bef82cd9fb403aba18f480a63844416a2e023") = 1 ] &&
     [ $(git cat-file -p $(stg id change-1) \
-        | grep -c "author Inge Ström <inge@power.com>") == 1 ] &&
+        | grep -c "author Inge Ström <inge@power.com>") = 1 ] &&
     [ $(git cat-file -p $(stg id change-2) \
-        | grep -c "tree e49dbce010ec7f441015a8c64bce0b99108af4cc") == 1 ] &&
+        | grep -c "tree e49dbce010ec7f441015a8c64bce0b99108af4cc") = 1 ] &&
     [ $(git cat-file -p $(stg id change-2) \
-        | grep -c "author Inge Ström <inge@power.com>") == 1 ] &&
+        | grep -c "author Inge Ström <inge@power.com>") = 1 ] &&
     [ $(git cat-file -p $(stg id change-3) \
-        | grep -c "tree 166bbaf27a44aee21ba78c98822a741e6f7d78f5") == 1 ] &&
+        | grep -c "tree 166bbaf27a44aee21ba78c98822a741e6f7d78f5") = 1 ] &&
     [ $(git cat-file -p $(stg id change-3) \
-        | grep -c "author Inge Ström <inge@power.com>") == 1 ] &&
+        | grep -c "author Inge Ström <inge@power.com>") = 1 ] &&
     stg delete ..
     '
 
diff --git a/t/t1900-mail.sh b/t/t1900-mail.sh
index 3eed7f8..78050db 100755
--- a/t/t1900-mail.sh
+++ b/t/t1900-mail.sh
@@ -29,7 +29,7 @@ test_expect_success \
     stg pop -a &&
     stg import -M mbox0 &&
     t2=$(git cat-file -p $(stg id) | grep ^tree) &&
-    [ "$t1" == "$t2" ]
+    [ "$t1" = "$t2" ]
     '
 
 test_done
diff --git a/t/t2000-sync.sh b/t/t2000-sync.sh
index 3dd1cd6..02345bb 100755
--- a/t/t2000-sync.sh
+++ b/t/t2000-sync.sh
@@ -47,7 +47,7 @@ test_expect_success \
     '
     stg sync -b master p2 &&
     test $(stg applied -c) -eq 3 &&
-    test $(cat foo2.txt) == "foo2"
+    test $(cat foo2.txt) = "foo2"
     '
 
 test_expect_success \
@@ -55,8 +55,8 @@ test_expect_success \
     '
     stg sync -b master -a &&
     test $(stg applied -c) -eq 3 &&
-    test $(cat foo1.txt) == "foo1" &&
-    test $(cat foo2.txt) == "foo2"
+    test $(cat foo1.txt) = "foo1" &&
+    test $(cat foo2.txt) = "foo2"
     '
 
 test_expect_success \
@@ -64,9 +64,9 @@ test_expect_success \
     '
     stg sync -s patches-master/series -a &&
     test $(stg applied -c) -eq 3 &&
-    test $(cat foo1.txt) == "foo1" &&
-    test $(cat foo2.txt) == "foo2" &&
-    test $(cat foo3.txt) == "foo3"
+    test $(cat foo1.txt) = "foo1" &&
+    test $(cat foo2.txt) = "foo2" &&
+    test $(cat foo3.txt) = "foo3"
     '
 
 test_expect_success \
@@ -92,7 +92,7 @@ test_expect_success \
     '
     stg sync -b master p2 &&
     test $(stg applied -c) -eq 3 &&
-    test $(cat bar2.txt) == "bar2"
+    test $(cat bar2.txt) = "bar2"
     '
 
 test_expect_failure \

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [StGIT PATCH 2/2] dash doesn't do curly brace expansion, so avoid that
  2007-04-29 21:09 [StGIT PATCH 0/2] Make test suite work with dash as /bin/sh Karl Hasselström
  2007-04-29 21:09 ` [StGIT PATCH 1/2] String comparison is done with "=", not "==" Karl Hasselström
@ 2007-04-29 21:09 ` Karl Hasselström
  2007-04-29 22:44 ` [StGIT PATCH 0/2] Make test suite work with dash as /bin/sh Catalin Marinas
  2 siblings, 0 replies; 5+ messages in thread
From: Karl Hasselström @ 2007-04-29 21:09 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

From: Karl Hasselström <kha@treskal.com>

I have dash as /bin/sh, and it doesn't seem to expand stuff in curly
braces, which breaks t1800. Work around this by not using curly brace
expansion to generate test data.

Signed-off-by: Karl Hasselström <kha@treskal.com>
---

 t/t1800-import.sh      |    4 +---
 t/t1800-import/foo.txt |   27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/t/t1800-import.sh b/t/t1800-import.sh
index ed10fa8..8c8c9a0 100755
--- a/t/t1800-import.sh
+++ b/t/t1800-import.sh
@@ -6,9 +6,7 @@ test_description='Test the import command'
 test_expect_success \
     'Initialize the StGIT repository' \
     '
-    for x in {do,di,da}{be,bi,bo}{dam,dim,dum}; do
-      echo $x
-    done > foo.txt &&
+    cp ../t1800-import/foo.txt . &&
     git add foo.txt &&
     git commit -a -m "initial version" &&
     stg init
diff --git a/t/t1800-import/foo.txt b/t/t1800-import/foo.txt
new file mode 100644
index 0000000..ad01662
--- /dev/null
+++ b/t/t1800-import/foo.txt
@@ -0,0 +1,27 @@
+dobedam
+dobedim
+dobedum
+dobidam
+dobidim
+dobidum
+dobodam
+dobodim
+dobodum
+dibedam
+dibedim
+dibedum
+dibidam
+dibidim
+dibidum
+dibodam
+dibodim
+dibodum
+dabedam
+dabedim
+dabedum
+dabidam
+dabidim
+dabidum
+dabodam
+dabodim
+dabodum

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [StGIT PATCH 0/2] Make test suite work with dash as /bin/sh
  2007-04-29 21:09 [StGIT PATCH 0/2] Make test suite work with dash as /bin/sh Karl Hasselström
  2007-04-29 21:09 ` [StGIT PATCH 1/2] String comparison is done with "=", not "==" Karl Hasselström
  2007-04-29 21:09 ` [StGIT PATCH 2/2] dash doesn't do curly brace expansion, so avoid that Karl Hasselström
@ 2007-04-29 22:44 ` Catalin Marinas
  2007-04-30  7:08   ` Karl Hasselström
  2 siblings, 1 reply; 5+ messages in thread
From: Catalin Marinas @ 2007-04-29 22:44 UTC (permalink / raw)
  To: Karl Hasselström; +Cc: git

On 30/04/07, Karl Hasselström <kha@treskal.com> wrote:
> I got some strange errors when running the StGIT test suite on a
> machine I hadn't tried developing on before. It turned out that its
> /bin/sh was dash, and that a few bashisms needed fixing.

Thanks for your patches. I'll apply them in about 2 weeks time (when I
get back to the UK).

-- 
Catalin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [StGIT PATCH 0/2] Make test suite work with dash as /bin/sh
  2007-04-29 22:44 ` [StGIT PATCH 0/2] Make test suite work with dash as /bin/sh Catalin Marinas
@ 2007-04-30  7:08   ` Karl Hasselström
  0 siblings, 0 replies; 5+ messages in thread
From: Karl Hasselström @ 2007-04-30  7:08 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

On 2007-04-30 01:44:24 +0300, Catalin Marinas wrote:

> Thanks for your patches. I'll apply them in about 2 weeks time (when
> I get back to the UK).

Thanks. Does that mean that you have no objections to my war on
redundant metadata?

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-04-30  7:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-29 21:09 [StGIT PATCH 0/2] Make test suite work with dash as /bin/sh Karl Hasselström
2007-04-29 21:09 ` [StGIT PATCH 1/2] String comparison is done with "=", not "==" Karl Hasselström
2007-04-29 21:09 ` [StGIT PATCH 2/2] dash doesn't do curly brace expansion, so avoid that Karl Hasselström
2007-04-29 22:44 ` [StGIT PATCH 0/2] Make test suite work with dash as /bin/sh Catalin Marinas
2007-04-30  7:08   ` Karl Hasselström

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).