git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] test-suite: adding a test for fast-export with tag variants
@ 2009-03-23 12:53 Erik Faye-Lund
  2009-03-23 12:53 ` [PATCH 2/4] builtin-fast-export.c: turn error into warning Erik Faye-Lund
  2009-03-29 20:05 ` [PATCH 1/4] test-suite: adding a test for fast-export with tag variants Erik Faye-Lund
  0 siblings, 2 replies; 13+ messages in thread
From: Erik Faye-Lund @ 2009-03-23 12:53 UTC (permalink / raw)
  To: git; +Cc: gitster, Erik Faye-Lund

The first two new tests are crashing, so I'm adding them commented out as they
exit with unpredictable return-codes.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
---
 t/t9301-fast-export.sh |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/t/t9301-fast-export.sh b/t/t9301-fast-export.sh
index 86c3760..db4b0b3 100755
--- a/t/t9301-fast-export.sh
+++ b/t/t9301-fast-export.sh
@@ -28,7 +28,12 @@ test_expect_success 'setup' '
 	git commit -m sitzt file2 &&
 	test_tick &&
 	git tag -a -m valentin muss &&
-	git merge -s ours master
+	git merge -s ours master &&
+	HEAD_TREE=`git show -s --pretty=raw HEAD | grep tree | sed "s/tree //"` &&
+	git tag    tree_tag        -m "tagging a tree" $HEAD_TREE &&
+	git tag -a tree_tag-obj    -m "tagging a tree" $HEAD_TREE &&
+	git tag    tag-obj_tag     -m "tagging a tag" tree_tag-obj &&
+	git tag -a tag-obj_tag-obj -m "tagging a tag" tree_tag-obj
 
 '
 
@@ -259,4 +264,11 @@ test_expect_success 'cope with tagger-less tags' '
 
 '
 
+# NEEDSWORK: not just check return status, but validate the output
+# two tests commented out due to crash and thus unreliable return code
+#test_expect_success 'tree_tag'        'git fast-export tree_tag'
+#test_expect_success 'tree_tag-obj'    'git fast-export tree_tag-obj'
+test_expect_failure 'tag-obj_tag'     'git fast-export tag-obj_tag'
+test_expect_failure 'tag-obj_tag-obj' 'git fast-export tag-obj_tag-obj'
+
 test_done
-- 
1.6.2.1.225.g9a4a0.dirty

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

* [PATCH 2/4] builtin-fast-export.c: turn error into warning
  2009-03-23 12:53 [PATCH 1/4] test-suite: adding a test for fast-export with tag variants Erik Faye-Lund
@ 2009-03-23 12:53 ` Erik Faye-Lund
  2009-03-23 12:53   ` [PATCH 3/4] builtin-fast-export.c: fix crash on tagged trees Erik Faye-Lund
  2009-03-29 20:05 ` [PATCH 1/4] test-suite: adding a test for fast-export with tag variants Erik Faye-Lund
  1 sibling, 1 reply; 13+ messages in thread
From: Erik Faye-Lund @ 2009-03-23 12:53 UTC (permalink / raw)
  To: git; +Cc: gitster, Erik Faye-Lund

fast-import doesn't have a syntax to support tree-objects (and some other
object-types), so fast-export shouldn't handle them. However, aborting the
operation is a bit drastic. This patch turns the error into a warning instead.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
---
 builtin-fast-export.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/builtin-fast-export.c b/builtin-fast-export.c
index fdf4ae9..02bad1f 100644
--- a/builtin-fast-export.c
+++ b/builtin-fast-export.c
@@ -378,8 +378,10 @@ static void get_tags_and_duplicates(struct object_array *pending,
 			}
 			break;
 		default:
-			die ("Unexpected object of type %s",
-			     typename(e->item->type));
+			warning("%s: Unexpected object of type %s, skipping.",
+			        e->name,
+			        typename(e->item->type));
+			continue;
 		}
 		if (commit->util)
 			/* more than one name for the same object */
-- 
1.6.2.1.225.g9a4a0.dirty

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

* [PATCH 3/4] builtin-fast-export.c: fix crash on tagged trees
  2009-03-23 12:53 ` [PATCH 2/4] builtin-fast-export.c: turn error into warning Erik Faye-Lund
@ 2009-03-23 12:53   ` Erik Faye-Lund
  2009-03-23 12:53     ` [PATCH 4/4] builtin-fast-export.c: handle nested tags Erik Faye-Lund
  0 siblings, 1 reply; 13+ messages in thread
From: Erik Faye-Lund @ 2009-03-23 12:53 UTC (permalink / raw)
  To: git; +Cc: gitster, Erik Faye-Lund

If a tag object points to a tree (or another unhandled type), the commit-
pointer is left uninitialized and later dereferenced. This patch adds a default
case to the switch that issues a warning and skips the object.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
---
 builtin-fast-export.c  |    4 ++++
 t/t9301-fast-export.sh |    5 ++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/builtin-fast-export.c b/builtin-fast-export.c
index 02bad1f..e716eee 100644
--- a/builtin-fast-export.c
+++ b/builtin-fast-export.c
@@ -375,6 +375,10 @@ static void get_tags_and_duplicates(struct object_array *pending,
 			case OBJ_BLOB:
 				handle_object(tag->object.sha1);
 				continue;
+			default:
+				warning("Tag points to object of unexpected type %s, skipping.",
+				        typename(tag->object.type));
+				continue;
 			}
 			break;
 		default:
diff --git a/t/t9301-fast-export.sh b/t/t9301-fast-export.sh
index db4b0b3..79ca832 100755
--- a/t/t9301-fast-export.sh
+++ b/t/t9301-fast-export.sh
@@ -265,9 +265,8 @@ test_expect_success 'cope with tagger-less tags' '
 '
 
 # NEEDSWORK: not just check return status, but validate the output
-# two tests commented out due to crash and thus unreliable return code
-#test_expect_success 'tree_tag'        'git fast-export tree_tag'
-#test_expect_success 'tree_tag-obj'    'git fast-export tree_tag-obj'
+test_expect_success 'tree_tag'        'git fast-export tree_tag'
+test_expect_success 'tree_tag-obj'    'git fast-export tree_tag-obj'
 test_expect_failure 'tag-obj_tag'     'git fast-export tag-obj_tag'
 test_expect_failure 'tag-obj_tag-obj' 'git fast-export tag-obj_tag-obj'
 
-- 
1.6.2.1.225.g9a4a0.dirty

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

* [PATCH 4/4] builtin-fast-export.c: handle nested tags
  2009-03-23 12:53   ` [PATCH 3/4] builtin-fast-export.c: fix crash on tagged trees Erik Faye-Lund
@ 2009-03-23 12:53     ` Erik Faye-Lund
  0 siblings, 0 replies; 13+ messages in thread
From: Erik Faye-Lund @ 2009-03-23 12:53 UTC (permalink / raw)
  To: git; +Cc: gitster, Erik Faye-Lund

When tags that points to tags are passed to fast-export, an error saying
"Tag [TAGNAME] points nowhere?". This fix calls parse_object() on the object
before referencing it's tag, to ensure the tag-info is fully initialized. In
addition, it inserts a comment to point out where nested tags are handled. This
is consistent with the comment for signed tags.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
---
 builtin-fast-export.c  |    5 ++++-
 t/t9301-fast-export.sh |    4 ++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/builtin-fast-export.c b/builtin-fast-export.c
index e716eee..8083c5f 100644
--- a/builtin-fast-export.c
+++ b/builtin-fast-export.c
@@ -362,7 +362,10 @@ static void get_tags_and_duplicates(struct object_array *pending,
 			break;
 		case OBJ_TAG:
 			tag = (struct tag *)e->item;
+
+			/* handle nested tags */
 			while (tag && tag->object.type == OBJ_TAG) {
+				parse_object(tag->object.sha1);
 				string_list_append(full_name, extra_refs)->util = tag;
 				tag = (struct tag *)tag->tagged;
 			}
@@ -375,7 +378,7 @@ static void get_tags_and_duplicates(struct object_array *pending,
 			case OBJ_BLOB:
 				handle_object(tag->object.sha1);
 				continue;
-			default:
+			default: /* OBJ_TAG (nested tags) is already handled */
 				warning("Tag points to object of unexpected type %s, skipping.",
 				        typename(tag->object.type));
 				continue;
diff --git a/t/t9301-fast-export.sh b/t/t9301-fast-export.sh
index 79ca832..7e94893 100755
--- a/t/t9301-fast-export.sh
+++ b/t/t9301-fast-export.sh
@@ -267,7 +267,7 @@ test_expect_success 'cope with tagger-less tags' '
 # NEEDSWORK: not just check return status, but validate the output
 test_expect_success 'tree_tag'        'git fast-export tree_tag'
 test_expect_success 'tree_tag-obj'    'git fast-export tree_tag-obj'
-test_expect_failure 'tag-obj_tag'     'git fast-export tag-obj_tag'
-test_expect_failure 'tag-obj_tag-obj' 'git fast-export tag-obj_tag-obj'
+test_expect_success 'tag-obj_tag'     'git fast-export tag-obj_tag'
+test_expect_success 'tag-obj_tag-obj' 'git fast-export tag-obj_tag-obj'
 
 test_done
-- 
1.6.2.1.225.g9a4a0.dirty

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

* Re: [PATCH 1/4] test-suite: adding a test for fast-export with tag  variants
  2009-03-23 12:53 [PATCH 1/4] test-suite: adding a test for fast-export with tag variants Erik Faye-Lund
  2009-03-23 12:53 ` [PATCH 2/4] builtin-fast-export.c: turn error into warning Erik Faye-Lund
@ 2009-03-29 20:05 ` Erik Faye-Lund
  2009-03-29 21:32   ` Junio C Hamano
  1 sibling, 1 reply; 13+ messages in thread
From: Erik Faye-Lund @ 2009-03-29 20:05 UTC (permalink / raw)
  To: Erik Faye-Lund; +Cc: git, gitster

OK, I see now that the previous patch-series has been merged to "pu".
Is there a reason why this updated patch-series hasn't superseded it?
Did I do something wrong when I resubmitted it? And what do I need to
do to get these patches going forward from there?

On Mon, Mar 23, 2009 at 2:53 PM, Erik Faye-Lund <kusmabite@gmail.com> wrote:
> The first two new tests are crashing, so I'm adding them commented out as they
> exit with unpredictable return-codes.
>
> Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
> ---
>  t/t9301-fast-export.sh |   14 +++++++++++++-
>  1 files changed, 13 insertions(+), 1 deletions(-)
>
> diff --git a/t/t9301-fast-export.sh b/t/t9301-fast-export.sh
> index 86c3760..db4b0b3 100755
> --- a/t/t9301-fast-export.sh
> +++ b/t/t9301-fast-export.sh
> @@ -28,7 +28,12 @@ test_expect_success 'setup' '
>        git commit -m sitzt file2 &&
>        test_tick &&
>        git tag -a -m valentin muss &&
> -       git merge -s ours master
> +       git merge -s ours master &&
> +       HEAD_TREE=`git show -s --pretty=raw HEAD | grep tree | sed "s/tree //"` &&
> +       git tag    tree_tag        -m "tagging a tree" $HEAD_TREE &&
> +       git tag -a tree_tag-obj    -m "tagging a tree" $HEAD_TREE &&
> +       git tag    tag-obj_tag     -m "tagging a tag" tree_tag-obj &&
> +       git tag -a tag-obj_tag-obj -m "tagging a tag" tree_tag-obj
>
>  '
>
> @@ -259,4 +264,11 @@ test_expect_success 'cope with tagger-less tags' '
>
>  '
>
> +# NEEDSWORK: not just check return status, but validate the output
> +# two tests commented out due to crash and thus unreliable return code
> +#test_expect_success 'tree_tag'        'git fast-export tree_tag'
> +#test_expect_success 'tree_tag-obj'    'git fast-export tree_tag-obj'
> +test_expect_failure 'tag-obj_tag'     'git fast-export tag-obj_tag'
> +test_expect_failure 'tag-obj_tag-obj' 'git fast-export tag-obj_tag-obj'
> +
>  test_done
> --
> 1.6.2.1.225.g9a4a0.dirty
>
>



-- 
Erik "kusma" Faye-Lund
kusmabite@gmail.com
(+47) 986 59 656

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

* Re: [PATCH 1/4] test-suite: adding a test for fast-export with tag  variants
  2009-03-29 20:05 ` [PATCH 1/4] test-suite: adding a test for fast-export with tag variants Erik Faye-Lund
@ 2009-03-29 21:32   ` Junio C Hamano
  2009-03-29 21:44     ` Erik Faye-Lund
  0 siblings, 1 reply; 13+ messages in thread
From: Junio C Hamano @ 2009-03-29 21:32 UTC (permalink / raw)
  To: Erik Faye-Lund; +Cc: Erik Faye-Lund, git, gitster

Erik Faye-Lund <kusmabite@googlemail.com> writes:

> OK, I see now that the previous patch-series has been merged to "pu".
> Is there a reason why this updated patch-series hasn't superseded it?

Even if the tested program crashes, it is Ok to test them inside
expect_failure, so I'd suggest not commenting the first two out.

But running the tests with the first patch applied to the same base as
where v1 was applied gives this, which is a more serious issue:

    $ sh t9301-fast-export.sh 2>&1 | tail -n 2
    * still have 4 known breakage(s)
    * failed 6 among remaining 15 test(s)

In other words, the changes to the set-up part seem to break unrelated
tests.  Why can such an update supersede the previous one?

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

* Re: [PATCH 1/4] test-suite: adding a test for fast-export with tag  variants
  2009-03-29 21:32   ` Junio C Hamano
@ 2009-03-29 21:44     ` Erik Faye-Lund
  2009-03-30  2:50       ` Junio C Hamano
  0 siblings, 1 reply; 13+ messages in thread
From: Erik Faye-Lund @ 2009-03-29 21:44 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Erik Faye-Lund, git

On Sun, Mar 29, 2009 at 11:32 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Even if the tested program crashes, it is Ok to test them inside
> expect_failure, so I'd suggest not commenting the first two out.

OK, the reason why I didn't want to do that is because the test
appears to succeed on windows when it crashes. But you might not care
too much about that ;)

> But running the tests with the first patch applied to the same base as
> where v1 was applied gives this, which is a more serious issue:
>
>    $ sh t9301-fast-export.sh 2>&1 | tail -n 2
>    * still have 4 known breakage(s)
>    * failed 6 among remaining 15 test(s)
>
> In other words, the changes to the set-up part seem to break unrelated
> tests.  Why can such an update supersede the previous one?

That's weird. I did test it properly before I applied it, and I don't
recall having any failures on Linux. On Windows, I get lots of
failures with vanilla git.git, and I don't have access to my Linux-box
right now, so I can't easily verify this until that box comes up
again. I did see that another patch (ebeec7d) has made it's way into
the test since I submitted it - perhaps these two collided?

But OK, I'll have a look at it when that box comes up, and see if I
can come up with a good patch-series.

-- 
Erik "kusma" Faye-Lund
kusmabite@gmail.com
(+47) 986 59 656

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

* Re: [PATCH 1/4] test-suite: adding a test for fast-export with tag  variants
  2009-03-29 21:44     ` Erik Faye-Lund
@ 2009-03-30  2:50       ` Junio C Hamano
  0 siblings, 0 replies; 13+ messages in thread
From: Junio C Hamano @ 2009-03-30  2:50 UTC (permalink / raw)
  To: Erik Faye-Lund; +Cc: Erik Faye-Lund, git

Erik Faye-Lund <kusmabite@googlemail.com> writes:

>> But running the tests with the first patch applied to the same base as
>> where v1 was applied gives this, which is a more serious issue:
>>
>>    $ sh t9301-fast-export.sh 2>&1 | tail -n 2
>>    * still have 4 known breakage(s)
>>    * failed 6 among remaining 15 test(s)
>>
>> In other words, the changes to the set-up part seem to break unrelated
>> tests.  Why can such an update supersede the previous one?
>
> That's weird. I did test it properly before I applied it, and I don't
> recall having any failures on Linux.

I think it is just the matter of doing something like this instead of your
patch [PATCH v2 1/4].  Either that, or I think you need to adjust the
existing tests that try to export --all and get hit by the fast that you
added the tags you already knew the old code had trouble with in the test
setup for them.

-- >8 --
From: Erik Faye-Lund <kusmabite@gmail.com>
Date: Mon, 23 Mar 2009 12:53:06 +0000
Subject: [PATCH] test-suite: adding a test for fast-export with tag variants

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t9301-fast-export.sh |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/t/t9301-fast-export.sh b/t/t9301-fast-export.sh
index 86c3760..2e31f67 100755
--- a/t/t9301-fast-export.sh
+++ b/t/t9301-fast-export.sh
@@ -259,4 +259,20 @@ test_expect_success 'cope with tagger-less tags' '
 
 '
 
+test_expect_success 'set-up a few more tags for tag export tests' '
+	git checkout -f master &&
+	HEAD_TREE=`git show -s --pretty=raw HEAD | grep tree | sed "s/tree //"` &&
+	git tag    tree_tag        -m "tagging a tree" $HEAD_TREE &&
+	git tag -a tree_tag-obj    -m "tagging a tree" $HEAD_TREE &&
+	git tag    tag-obj_tag     -m "tagging a tag" tree_tag-obj &&
+	git tag -a tag-obj_tag-obj -m "tagging a tag" tree_tag-obj
+'
+
+# NEEDSWORK: not just check return status, but validate the output
+# two tests commented out due to crash and thus unreliable return code
+test_expect_failure 'tree_tag'        'git fast-export tree_tag'
+test_expect_failure 'tree_tag-obj'    'git fast-export tree_tag-obj'
+test_expect_failure 'tag-obj_tag'     'git fast-export tag-obj_tag'
+test_expect_failure 'tag-obj_tag-obj' 'git fast-export tag-obj_tag-obj'
+
 test_done
-- 
1.6.2.1

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

* [PATCH 1/4] test-suite: adding a test for fast-export with tag variants
@ 2009-03-30  9:08 Erik Faye-Lund
  0 siblings, 0 replies; 13+ messages in thread
From: Erik Faye-Lund @ 2009-03-30  9:08 UTC (permalink / raw)
  To: git; +Cc: gitster, Erik Faye-Lund

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
---
 t/t9301-fast-export.sh |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/t/t9301-fast-export.sh b/t/t9301-fast-export.sh
index b860626..763dde5 100755
--- a/t/t9301-fast-export.sh
+++ b/t/t9301-fast-export.sh
@@ -262,4 +262,21 @@ test_expect_success 'cope with tagger-less tags' '
 
 '
 
+test_expect_success 'set-up a few more tags for tag export tests' '
+
+	git checkout -f master &&
+	HEAD_TREE=`git show -s --pretty=raw HEAD | grep tree | sed "s/tree //"` &&
+	git tag    tree_tag        -m "tagging a tree" $HEAD_TREE &&
+	git tag -a tree_tag-obj    -m "tagging a tree" $HEAD_TREE &&
+	git tag    tag-obj_tag     -m "tagging a tag" tree_tag-obj &&
+	git tag -a tag-obj_tag-obj -m "tagging a tag" tree_tag-obj
+
+'
+
+# NEEDSWORK: not just check return status, but validate the output
+test_expect_failure 'tree_tag'        'git fast-export tree_tag'
+test_expect_failure 'tree_tag-obj'    'git fast-export tree_tag-obj'
+test_expect_failure 'tag-obj_tag'     'git fast-export tag-obj_tag'
+test_expect_failure 'tag-obj_tag-obj' 'git fast-export tag-obj_tag-obj'
+
 test_done
-- 
1.6.2.1

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

* Re: [PATCH 1/4] test-suite: adding a test for fast-export with tag  variants
  2009-03-23  0:55   ` Erik Faye-Lund
@ 2009-03-23  3:41     ` Junio C Hamano
  0 siblings, 0 replies; 13+ messages in thread
From: Junio C Hamano @ 2009-03-23  3:41 UTC (permalink / raw)
  To: Erik Faye-Lund; +Cc: Erik Faye-Lund, git

Erik Faye-Lund <kusmabite@googlemail.com> writes:

> On Mon, Mar 23, 2009 at 1:39 AM, Junio C Hamano <gitster@pobox.com> wrote:
> ...
>> These tests seem to only care about fast-export not dying, but don't we
>> also want to check if they produce correct results?
>
> Well, yeah. But I was working mainly on fixing a crash-bug here, and I
> don't think I know enough about the correct output of fast-export to
> pull this off. Perhaps tighting up the test is something someone else
> would care to do?

Surely; for a starter, saying something like this:

+# NEEDSWORK: not just check return status, but validate the output
+test_expect_failure 'tree_tag'        'git fast-export tree_tag'
+test_expect_failure 'tree_tag-obj'    'git fast-export tree_tag-obj'
+test_expect_failure 'tag-obj_tag'     'git fast-export tag-obj_tag'
+test_expect_failure 'tag-obj_tag-obj' 'git fast-export tag-obj_tag-obj'

would do, and will invite others to fill the gap when they have time.

Thanks.

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

* Re: [PATCH 1/4] test-suite: adding a test for fast-export with tag  variants
  2009-03-23  0:39 ` Junio C Hamano
@ 2009-03-23  0:55   ` Erik Faye-Lund
  2009-03-23  3:41     ` Junio C Hamano
  0 siblings, 1 reply; 13+ messages in thread
From: Erik Faye-Lund @ 2009-03-23  0:55 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Erik Faye-Lund, git

On Mon, Mar 23, 2009 at 1:39 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> diff --git a/t/t9302-fast-export-tags.sh b/t/t9302-fast-export-tags.sh
>> new file mode 100644
>
> Make it executable if you need to add a new script, but shouldn't these
> small tests be done as an addition to existing t9301, not as a brand new
> script?

Sure, will do. I just have to figure out how to make it executable in windows ;)

As this is my first test, I was wondering a bit about how much I could
depend on the state of the repo, so I was a bit reluctant to add it to
the same test. But I guess it's easier for everyone in the long term
to put it into the same test, so I'll give it a go.

>> +test_expect_success 'tree_tag'        'git fast-export tree_tag'
>> +test_expect_success 'tree_tag-obj'    'git fast-export tree_tag-obj'
>> +test_expect_success 'tag-obj_tag'     'git fast-export tag-obj_tag'
>> +test_expect_success 'tag-obj_tag-obj' 'git fast-export tag-obj_tag-obj'
>> +
>> +test_done
>
> The purpose of the first patch that adds tests is to expose existing
> problems, and it is better to say test_expect_failure in them.  Later
> patch to fix these issues will contain code change and also change to flip
> some of the expect_failure to expect_success, and that way we can see what
> issue is fixed with which patch more easily.

Sure, will do. I was a bit lazy, but updating it as we go will make
stuff easier in the future.

> These tests seem to only care about fast-export not dying, but don't we
> also want to check if they produce correct results?

Well, yeah. But I was working mainly on fixing a crash-bug here, and I
don't think I know enough about the correct output of fast-export to
pull this off. Perhaps tighting up the test is something someone else
would care to do?

-- 
Erik "kusma" Faye-Lund
kusmabite@gmail.com
(+47) 986 59 656

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

* Re: [PATCH 1/4] test-suite: adding a test for fast-export with tag variants
  2009-03-22 21:50 Erik Faye-Lund
@ 2009-03-23  0:39 ` Junio C Hamano
  2009-03-23  0:55   ` Erik Faye-Lund
  0 siblings, 1 reply; 13+ messages in thread
From: Junio C Hamano @ 2009-03-23  0:39 UTC (permalink / raw)
  To: Erik Faye-Lund; +Cc: git

Erik Faye-Lund <kusmabite@gmail.com> writes:

> Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
> ---
>  t/t9302-fast-export-tags.sh |   25 +++++++++++++++++++++++++
>  1 files changed, 25 insertions(+), 0 deletions(-)
>  create mode 100644 t/t9302-fast-export-tags.sh
>
> diff --git a/t/t9302-fast-export-tags.sh b/t/t9302-fast-export-tags.sh
> new file mode 100644

Make it executable if you need to add a new script, but shouldn't these
small tests be done as an addition to existing t9301, not as a brand new
script?

> index 0000000..2ecac32
> --- /dev/null
> +++ b/t/t9302-fast-export-tags.sh
> @@ -0,0 +1,25 @@
> +#!/bin/sh
> +#
> +# Copyright (c) 2009 Erik Faye-Lund
> +#
> +
> +test_description='git fast-export tag variants'
> +. ./test-lib.sh
> +
> +test_expect_success 'setup' '
> +	touch dummy &&
> +	git add dummy &&
> +	git commit -m "initial commit" &&
> +	HEAD_TREE=`git show -s --pretty=raw HEAD | grep tree | sed "s/tree //"` &&
> +	git tag    tree_tag        -m "tagging a tree" $HEAD_TREE &&
> +	git tag -a tree_tag-obj    -m "tagging a tree" $HEAD_TREE &&
> +	git tag    tag-obj_tag     -m "tagging a tag" tree_tag-obj &&
> +	git tag -a tag-obj_tag-obj -m "tagging a tag" tree_tag-obj
> +'
> +
> +test_expect_success 'tree_tag'        'git fast-export tree_tag'
> +test_expect_success 'tree_tag-obj'    'git fast-export tree_tag-obj'
> +test_expect_success 'tag-obj_tag'     'git fast-export tag-obj_tag'
> +test_expect_success 'tag-obj_tag-obj' 'git fast-export tag-obj_tag-obj'
> +
> +test_done

The purpose of the first patch that adds tests is to expose existing
problems, and it is better to say test_expect_failure in them.  Later
patch to fix these issues will contain code change and also change to flip
some of the expect_failure to expect_success, and that way we can see what
issue is fixed with which patch more easily.

These tests seem to only care about fast-export not dying, but don't we
also want to check if they produce correct results?

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

* [PATCH 1/4] test-suite: adding a test for fast-export with tag variants
@ 2009-03-22 21:50 Erik Faye-Lund
  2009-03-23  0:39 ` Junio C Hamano
  0 siblings, 1 reply; 13+ messages in thread
From: Erik Faye-Lund @ 2009-03-22 21:50 UTC (permalink / raw)
  To: git; +Cc: gitster, Erik Faye-Lund

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
---
 t/t9302-fast-export-tags.sh |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
 create mode 100644 t/t9302-fast-export-tags.sh

diff --git a/t/t9302-fast-export-tags.sh b/t/t9302-fast-export-tags.sh
new file mode 100644
index 0000000..2ecac32
--- /dev/null
+++ b/t/t9302-fast-export-tags.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 Erik Faye-Lund
+#
+
+test_description='git fast-export tag variants'
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+	touch dummy &&
+	git add dummy &&
+	git commit -m "initial commit" &&
+	HEAD_TREE=`git show -s --pretty=raw HEAD | grep tree | sed "s/tree //"` &&
+	git tag    tree_tag        -m "tagging a tree" $HEAD_TREE &&
+	git tag -a tree_tag-obj    -m "tagging a tree" $HEAD_TREE &&
+	git tag    tag-obj_tag     -m "tagging a tag" tree_tag-obj &&
+	git tag -a tag-obj_tag-obj -m "tagging a tag" tree_tag-obj
+'
+
+test_expect_success 'tree_tag'        'git fast-export tree_tag'
+test_expect_success 'tree_tag-obj'    'git fast-export tree_tag-obj'
+test_expect_success 'tag-obj_tag'     'git fast-export tag-obj_tag'
+test_expect_success 'tag-obj_tag-obj' 'git fast-export tag-obj_tag-obj'
+
+test_done
-- 
1.6.2.1.226.gcb2dd

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

end of thread, other threads:[~2009-03-30  9:10 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-23 12:53 [PATCH 1/4] test-suite: adding a test for fast-export with tag variants Erik Faye-Lund
2009-03-23 12:53 ` [PATCH 2/4] builtin-fast-export.c: turn error into warning Erik Faye-Lund
2009-03-23 12:53   ` [PATCH 3/4] builtin-fast-export.c: fix crash on tagged trees Erik Faye-Lund
2009-03-23 12:53     ` [PATCH 4/4] builtin-fast-export.c: handle nested tags Erik Faye-Lund
2009-03-29 20:05 ` [PATCH 1/4] test-suite: adding a test for fast-export with tag variants Erik Faye-Lund
2009-03-29 21:32   ` Junio C Hamano
2009-03-29 21:44     ` Erik Faye-Lund
2009-03-30  2:50       ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2009-03-30  9:08 Erik Faye-Lund
2009-03-22 21:50 Erik Faye-Lund
2009-03-23  0:39 ` Junio C Hamano
2009-03-23  0:55   ` Erik Faye-Lund
2009-03-23  3:41     ` Junio C Hamano

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