* [PATCH 0/1] t3420 remove progress from output
@ 2019-07-01 13:11 Phillip Wood via GitGitGadget
2019-07-01 13:11 ` [PATCH 1/1] t3420: remove progress lines before comparing output Phillip Wood via GitGitGadget
2019-07-04 9:47 ` [PATCH v2 0/1] t3420 remove progress from output Phillip Wood via GitGitGadget
0 siblings, 2 replies; 8+ messages in thread
From: Phillip Wood via GitGitGadget @ 2019-07-01 13:11 UTC (permalink / raw)
To: git; +Cc: Johannes Schindelin, Junio C Hamano
Remove ugliness in the tests that check the output of git rebase
Based-On: sg/rebase-progress Cc: SZEDER Gábor szeder.dev@gmail.com
[szeder.dev@gmail.com]
Phillip Wood (1):
t3420: remove progress lines before comparing output
t/t3420-rebase-autostash.sh | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
base-commit: 5b12e3123b7b70e3875404a4ffe571ca079364fe
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-276%2Fphillipwood%2Fwip%2Ft3420-remove-progress-from-output-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-276/phillipwood/wip/t3420-remove-progress-from-output-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/276
--
gitgitgadget
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/1] t3420: remove progress lines before comparing output
2019-07-01 13:11 [PATCH 0/1] t3420 remove progress from output Phillip Wood via GitGitGadget
@ 2019-07-01 13:11 ` Phillip Wood via GitGitGadget
2019-07-01 21:01 ` Junio C Hamano
2019-07-04 9:47 ` [PATCH v2 0/1] t3420 remove progress from output Phillip Wood via GitGitGadget
1 sibling, 1 reply; 8+ messages in thread
From: Phillip Wood via GitGitGadget @ 2019-07-01 13:11 UTC (permalink / raw)
To: git; +Cc: Johannes Schindelin, Junio C Hamano, Phillip Wood
From: Phillip Wood <phillip.wood@dunelm.org.uk>
Some of the tests check the output of rebase is what we expect. These
were added after a regression that added unwanted stash output when
using --autostash. They are useful as they prevent unintended changes to
the output of the various rebase commands. However they also include all
the progress output which is less useful as it only tests what would be
written to a dumb terminal which is not the normal use case. The recent
changes to fix clearing the line when printing progress necessarily
meant making an ugly change to these tests. Address this my removing the
progress output before comparing it to the expected output. We do this
by removing everything before the final "\r" on each line as we don't
care about the progress indicator, but we do care about what is printed
immediately after it.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
---
t/t3420-rebase-autostash.sh | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh
index 9186e90127..0454018584 100755
--- a/t/t3420-rebase-autostash.sh
+++ b/t/t3420-rebase-autostash.sh
@@ -48,8 +48,8 @@ create_expected_success_interactive () {
q_to_cr >expected <<-EOF
$(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
HEAD is now at $(git rev-parse --short feature-branch) third commit
- Rebasing (1/2)QRebasing (2/2)QApplied autostash.
- Q QSuccessfully rebased and updated refs/heads/rebased-feature-branch.
+ Applied autostash.
+ Successfully rebased and updated refs/heads/rebased-feature-branch.
EOF
}
@@ -67,13 +67,13 @@ create_expected_failure_am () {
}
create_expected_failure_interactive () {
- q_to_cr >expected <<-EOF
+ cat >expected <<-EOF
$(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
HEAD is now at $(git rev-parse --short feature-branch) third commit
- Rebasing (1/2)QRebasing (2/2)QApplying autostash resulted in conflicts.
+ Applying autostash resulted in conflicts.
Your changes are safe in the stash.
You can run "git stash pop" or "git stash drop" at any time.
- Q QSuccessfully rebased and updated refs/heads/rebased-feature-branch.
+ Successfully rebased and updated refs/heads/rebased-feature-branch.
EOF
}
@@ -109,7 +109,8 @@ testrebase () {
suffix=interactive
fi &&
create_expected_success_$suffix &&
- test_i18ncmp expected actual
+ sed "$(printf "s/.*\\r//")" <actual >actual2 &&
+ test_i18ncmp expected actual2
'
test_expect_success "rebase$type: dirty index, non-conflicting rebase" '
@@ -209,7 +210,8 @@ testrebase () {
suffix=interactive
fi &&
create_expected_failure_$suffix &&
- test_i18ncmp expected actual
+ sed "$(printf "s/.*\\r//")" <actual >actual2 &&
+ test_i18ncmp expected actual2
'
}
--
gitgitgadget
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] t3420: remove progress lines before comparing output
2019-07-01 13:11 ` [PATCH 1/1] t3420: remove progress lines before comparing output Phillip Wood via GitGitGadget
@ 2019-07-01 21:01 ` Junio C Hamano
2019-07-02 15:54 ` Phillip Wood
0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2019-07-01 21:01 UTC (permalink / raw)
To: Phillip Wood via GitGitGadget; +Cc: git, Johannes Schindelin, Phillip Wood
"Phillip Wood via GitGitGadget" <gitgitgadget@gmail.com> writes:
> progress output before comparing it to the expected output. We do this
> by removing everything before the final "\r" on each line as we don't
> care about the progress indicator, but we do care about what is printed
> immediately after it.
As long as sed implementation used here does not do anything funny
to CR, I think the approach to strip everything before the last CR
on the line is sensible. As I am not familiar with how Windows port
of sed wants to treat a CR byte in the pattern, I am not sure about
the precondition of the above statement, though.
I also have to wonder if we can/want to do this without an extra
printf process every time we sanitize the output, though I do not
think I care too deeply about it.
> Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
> ---
> t/t3420-rebase-autostash.sh | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh
> index 9186e90127..0454018584 100755
> --- a/t/t3420-rebase-autostash.sh
> +++ b/t/t3420-rebase-autostash.sh
> @@ -48,8 +48,8 @@ create_expected_success_interactive () {
> q_to_cr >expected <<-EOF
> $(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
> HEAD is now at $(git rev-parse --short feature-branch) third commit
> - Rebasing (1/2)QRebasing (2/2)QApplied autostash.
> - Q QSuccessfully rebased and updated refs/heads/rebased-feature-branch.
> + Applied autostash.
> + Successfully rebased and updated refs/heads/rebased-feature-branch.
> EOF
> }
>
> @@ -67,13 +67,13 @@ create_expected_failure_am () {
> }
>
> create_expected_failure_interactive () {
> - q_to_cr >expected <<-EOF
> + cat >expected <<-EOF
> $(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
> HEAD is now at $(git rev-parse --short feature-branch) third commit
> - Rebasing (1/2)QRebasing (2/2)QApplying autostash resulted in conflicts.
> + Applying autostash resulted in conflicts.
> Your changes are safe in the stash.
> You can run "git stash pop" or "git stash drop" at any time.
> - Q QSuccessfully rebased and updated refs/heads/rebased-feature-branch.
> + Successfully rebased and updated refs/heads/rebased-feature-branch.
> EOF
> }
>
> @@ -109,7 +109,8 @@ testrebase () {
> suffix=interactive
> fi &&
> create_expected_success_$suffix &&
> - test_i18ncmp expected actual
> + sed "$(printf "s/.*\\r//")" <actual >actual2 &&
> + test_i18ncmp expected actual2
> '
>
> test_expect_success "rebase$type: dirty index, non-conflicting rebase" '
> @@ -209,7 +210,8 @@ testrebase () {
> suffix=interactive
> fi &&
> create_expected_failure_$suffix &&
> - test_i18ncmp expected actual
> + sed "$(printf "s/.*\\r//")" <actual >actual2 &&
> + test_i18ncmp expected actual2
> '
> }
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] t3420: remove progress lines before comparing output
2019-07-01 21:01 ` Junio C Hamano
@ 2019-07-02 15:54 ` Phillip Wood
2019-07-02 17:23 ` Junio C Hamano
0 siblings, 1 reply; 8+ messages in thread
From: Phillip Wood @ 2019-07-02 15:54 UTC (permalink / raw)
To: Junio C Hamano, Phillip Wood via GitGitGadget
Cc: git, Johannes Schindelin, Phillip Wood
On 01/07/2019 22:01, Junio C Hamano wrote:
> "Phillip Wood via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
>> progress output before comparing it to the expected output. We do this
>> by removing everything before the final "\r" on each line as we don't
>> care about the progress indicator, but we do care about what is printed
>> immediately after it.
>
> As long as sed implementation used here does not do anything funny
> to CR, I think the approach to strip everything before the last CR
> on the line is sensible. As I am not familiar with how Windows port
> of sed wants to treat a CR byte in the pattern, I am not sure about
> the precondition of the above statement, though.
I wondered about that too, but it passes the CI tests under windows.
> I also have to wonder if we can/want to do this without an extra
> printf process every time we sanitize the output, though I do not
> think I care too deeply about it.
I could add 're="$(printf ...)"' to the setup at the top of the file if
you want
Best Wishes
Phillip
>> Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
>> ---
>> t/t3420-rebase-autostash.sh | 16 +++++++++-------
>> 1 file changed, 9 insertions(+), 7 deletions(-)
>>
>> diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh
>> index 9186e90127..0454018584 100755
>> --- a/t/t3420-rebase-autostash.sh
>> +++ b/t/t3420-rebase-autostash.sh
>> @@ -48,8 +48,8 @@ create_expected_success_interactive () {
>> q_to_cr >expected <<-EOF
>> $(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
>> HEAD is now at $(git rev-parse --short feature-branch) third commit
>> - Rebasing (1/2)QRebasing (2/2)QApplied autostash.
>> - Q QSuccessfully rebased and updated refs/heads/rebased-feature-branch.
>> + Applied autostash.
>> + Successfully rebased and updated refs/heads/rebased-feature-branch.
>> EOF
>> }
>>
>> @@ -67,13 +67,13 @@ create_expected_failure_am () {
>> }
>>
>> create_expected_failure_interactive () {
>> - q_to_cr >expected <<-EOF
>> + cat >expected <<-EOF
>> $(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
>> HEAD is now at $(git rev-parse --short feature-branch) third commit
>> - Rebasing (1/2)QRebasing (2/2)QApplying autostash resulted in conflicts.
>> + Applying autostash resulted in conflicts.
>> Your changes are safe in the stash.
>> You can run "git stash pop" or "git stash drop" at any time.
>> - Q QSuccessfully rebased and updated refs/heads/rebased-feature-branch.
>> + Successfully rebased and updated refs/heads/rebased-feature-branch.
>> EOF
>> }
>>
>> @@ -109,7 +109,8 @@ testrebase () {
>> suffix=interactive
>> fi &&
>> create_expected_success_$suffix &&
>> - test_i18ncmp expected actual
>> + sed "$(printf "s/.*\\r//")" <actual >actual2 &&
>> + test_i18ncmp expected actual2
>> '
>>
>> test_expect_success "rebase$type: dirty index, non-conflicting rebase" '
>> @@ -209,7 +210,8 @@ testrebase () {
>> suffix=interactive
>> fi &&
>> create_expected_failure_$suffix &&
>> - test_i18ncmp expected actual
>> + sed "$(printf "s/.*\\r//")" <actual >actual2 &&
>> + test_i18ncmp expected actual2
>> '
>> }
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] t3420: remove progress lines before comparing output
2019-07-02 15:54 ` Phillip Wood
@ 2019-07-02 17:23 ` Junio C Hamano
2019-07-04 9:53 ` Phillip Wood
0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2019-07-02 17:23 UTC (permalink / raw)
To: Phillip Wood
Cc: Phillip Wood via GitGitGadget, git, Johannes Schindelin,
Phillip Wood
Phillip Wood <phillip.wood123@gmail.com> writes:
>> As long as sed implementation used here does not do anything funny
>> to CR, I think the approach to strip everything before the last CR
>> on the line is sensible. As I am not familiar with how Windows port
>> of sed wants to treat a CR byte in the pattern, I am not sure about
>> the precondition of the above statement, though.
>
> I wondered about that too, but it passes the CI tests under windows.
Hopefully Git for Windows, MinGW, and CygWin would all behave
similarly.
>> I also have to wonder if we can/want to do this without an extra
>> printf process every time we sanitize the output, though I do not
>> think I care too deeply about it.
>
> I could add 're="$(printf ...)"' to the setup at the top of the file
> if you want
As I do not care too deeply about it, we recently saw a lot about
reducing number of processes in the tests, so apparently some folks
care and I presume they want to see something like that to happen.
I do not think $re is a good name for such a variable, though ;-)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 0/1] t3420 remove progress from output
2019-07-01 13:11 [PATCH 0/1] t3420 remove progress from output Phillip Wood via GitGitGadget
2019-07-01 13:11 ` [PATCH 1/1] t3420: remove progress lines before comparing output Phillip Wood via GitGitGadget
@ 2019-07-04 9:47 ` Phillip Wood via GitGitGadget
2019-07-04 9:47 ` [PATCH v2 1/1] t3420: remove progress lines before comparing output Phillip Wood via GitGitGadget
1 sibling, 1 reply; 8+ messages in thread
From: Phillip Wood via GitGitGadget @ 2019-07-04 9:47 UTC (permalink / raw)
To: git; +Cc: SZEDER Gábor, Johannes Schindelin, Junio C Hamano
Remove ugliness in the tests that check the output of git rebase
I've updated this to avoid repeated calls to printf as suggested by Junio
Based-On: sg/rebase-progress
Phillip Wood (1):
t3420: remove progress lines before comparing output
t/t3420-rebase-autostash.sh | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
base-commit: 5b12e3123b7b70e3875404a4ffe571ca079364fe
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-276%2Fphillipwood%2Fwip%2Ft3420-remove-progress-from-output-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-276/phillipwood/wip/t3420-remove-progress-from-output-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/276
Range-diff vs v1:
1: 52501623f6 ! 1: e1b4023bc0 t3420: remove progress lines before comparing output
@@ -20,6 +20,16 @@
diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh
--- a/t/t3420-rebase-autostash.sh
+++ b/t/t3420-rebase-autostash.sh
+@@
+ echo conflicting-change >file2 &&
+ git add . &&
+ test_tick &&
+- git commit -m "related commit"
++ git commit -m "related commit" &&
++ remove_progress_re="$(printf "s/.*\\r//")"
+ '
+
+ create_expected_success_am () {
@@
q_to_cr >expected <<-EOF
$(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
@@ -53,7 +63,7 @@
fi &&
create_expected_success_$suffix &&
- test_i18ncmp expected actual
-+ sed "$(printf "s/.*\\r//")" <actual >actual2 &&
++ sed "$remove_progress_re" <actual >actual2 &&
+ test_i18ncmp expected actual2
'
@@ -63,7 +73,7 @@
fi &&
create_expected_failure_$suffix &&
- test_i18ncmp expected actual
-+ sed "$(printf "s/.*\\r//")" <actual >actual2 &&
++ sed "$remove_progress_re" <actual >actual2 &&
+ test_i18ncmp expected actual2
'
}
--
gitgitgadget
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 1/1] t3420: remove progress lines before comparing output
2019-07-04 9:47 ` [PATCH v2 0/1] t3420 remove progress from output Phillip Wood via GitGitGadget
@ 2019-07-04 9:47 ` Phillip Wood via GitGitGadget
0 siblings, 0 replies; 8+ messages in thread
From: Phillip Wood via GitGitGadget @ 2019-07-04 9:47 UTC (permalink / raw)
To: git; +Cc: SZEDER Gábor, Johannes Schindelin, Junio C Hamano,
Phillip Wood
From: Phillip Wood <phillip.wood@dunelm.org.uk>
Some of the tests check the output of rebase is what we expect. These
were added after a regression that added unwanted stash output when
using --autostash. They are useful as they prevent unintended changes to
the output of the various rebase commands. However they also include all
the progress output which is less useful as it only tests what would be
written to a dumb terminal which is not the normal use case. The recent
changes to fix clearing the line when printing progress necessarily
meant making an ugly change to these tests. Address this my removing the
progress output before comparing it to the expected output. We do this
by removing everything before the final "\r" on each line as we don't
care about the progress indicator, but we do care about what is printed
immediately after it.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
---
t/t3420-rebase-autostash.sh | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh
index 9186e90127..b8f4d03467 100755
--- a/t/t3420-rebase-autostash.sh
+++ b/t/t3420-rebase-autostash.sh
@@ -30,7 +30,8 @@ test_expect_success setup '
echo conflicting-change >file2 &&
git add . &&
test_tick &&
- git commit -m "related commit"
+ git commit -m "related commit" &&
+ remove_progress_re="$(printf "s/.*\\r//")"
'
create_expected_success_am () {
@@ -48,8 +49,8 @@ create_expected_success_interactive () {
q_to_cr >expected <<-EOF
$(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
HEAD is now at $(git rev-parse --short feature-branch) third commit
- Rebasing (1/2)QRebasing (2/2)QApplied autostash.
- Q QSuccessfully rebased and updated refs/heads/rebased-feature-branch.
+ Applied autostash.
+ Successfully rebased and updated refs/heads/rebased-feature-branch.
EOF
}
@@ -67,13 +68,13 @@ create_expected_failure_am () {
}
create_expected_failure_interactive () {
- q_to_cr >expected <<-EOF
+ cat >expected <<-EOF
$(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
HEAD is now at $(git rev-parse --short feature-branch) third commit
- Rebasing (1/2)QRebasing (2/2)QApplying autostash resulted in conflicts.
+ Applying autostash resulted in conflicts.
Your changes are safe in the stash.
You can run "git stash pop" or "git stash drop" at any time.
- Q QSuccessfully rebased and updated refs/heads/rebased-feature-branch.
+ Successfully rebased and updated refs/heads/rebased-feature-branch.
EOF
}
@@ -109,7 +110,8 @@ testrebase () {
suffix=interactive
fi &&
create_expected_success_$suffix &&
- test_i18ncmp expected actual
+ sed "$remove_progress_re" <actual >actual2 &&
+ test_i18ncmp expected actual2
'
test_expect_success "rebase$type: dirty index, non-conflicting rebase" '
@@ -209,7 +211,8 @@ testrebase () {
suffix=interactive
fi &&
create_expected_failure_$suffix &&
- test_i18ncmp expected actual
+ sed "$remove_progress_re" <actual >actual2 &&
+ test_i18ncmp expected actual2
'
}
--
gitgitgadget
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] t3420: remove progress lines before comparing output
2019-07-02 17:23 ` Junio C Hamano
@ 2019-07-04 9:53 ` Phillip Wood
0 siblings, 0 replies; 8+ messages in thread
From: Phillip Wood @ 2019-07-04 9:53 UTC (permalink / raw)
To: Junio C Hamano
Cc: Phillip Wood via GitGitGadget, git, Johannes Schindelin,
Phillip Wood
On 02/07/2019 18:23, Junio C Hamano wrote:
> Phillip Wood <phillip.wood123@gmail.com> writes:
>
>>> As long as sed implementation used here does not do anything funny
>>> to CR, I think the approach to strip everything before the last CR
>>> on the line is sensible. As I am not familiar with how Windows port
>>> of sed wants to treat a CR byte in the pattern, I am not sure about
>>> the precondition of the above statement, though.
>>
>> I wondered about that too, but it passes the CI tests under windows.
>
> Hopefully Git for Windows, MinGW, and CygWin would all behave
> similarly.
>
>>> I also have to wonder if we can/want to do this without an extra
>>> printf process every time we sanitize the output, though I do not
>>> think I care too deeply about it.
>>
>> I could add 're="$(printf ...)"' to the setup at the top of the file
>> if you want
>
> As I do not care too deeply about it, we recently saw a lot about
> reducing number of processes in the tests, so apparently some folks
> care and I presume they want to see something like that to happen.
> I do not think $re is a good name for such a variable, though ;-)
Yes, $re was just a place holder - naming is hard ...
Best Wishes
Phillip
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-07-04 9:53 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-01 13:11 [PATCH 0/1] t3420 remove progress from output Phillip Wood via GitGitGadget
2019-07-01 13:11 ` [PATCH 1/1] t3420: remove progress lines before comparing output Phillip Wood via GitGitGadget
2019-07-01 21:01 ` Junio C Hamano
2019-07-02 15:54 ` Phillip Wood
2019-07-02 17:23 ` Junio C Hamano
2019-07-04 9:53 ` Phillip Wood
2019-07-04 9:47 ` [PATCH v2 0/1] t3420 remove progress from output Phillip Wood via GitGitGadget
2019-07-04 9:47 ` [PATCH v2 1/1] t3420: remove progress lines before comparing output Phillip Wood via GitGitGadget
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).