Skip to content

test1148: tolerate progress updates better (again)#5194

Closed
jay wants to merge 1 commit intocurl:masterfrom
jay:fix_test1148
Closed

test1148: tolerate progress updates better (again)#5194
jay wants to merge 1 commit intocurl:masterfrom
jay:fix_test1148

Conversation

@jay
Copy link
Copy Markdown
Member

@jay jay commented Apr 7, 2020

  • Ignore intermediate progress updates.

  • Support locales that use a character other than period as decimal
    separator (eg 100,0%).

test1148 checks that the progress finishes at 100% and has the right
bar width. Prior to this change the test assumed that the only progress
reported for such a quick transfer was 100%, however in rare instances
(like in the CI where transfer time can slow considerably) there may be
intermediate updates. For example, below is stderrlog1148 from a failed
CI run with explicit \r and \n added (it is one line; broken up so that
it's easier to understand).

\r
\r##################################                                        48.3%
\r######################################################################## 100.0%
\n

Closes #xxxx


The improvements made in 6cbe969 (#2488) didn't go far enough.

CI failure: https://github.com/jay/curl/runs/565278274#step:6:2297

To reproduce:

diff --git a/src/tool_cb_prg.c b/src/tool_cb_prg.c
index aad451b..77d892e 100644
--- a/src/tool_cb_prg.c
+++ b/src/tool_cb_prg.c
@@ -194,6 +194,8 @@ int tool_progress_cb(void *clientp,
       num = MAX_BARLENGTH;
     memset(line, '#', num);
     line[num] = '\0';
+    /* !checksrc! disable LONGLINE 1 */
+    fprintf(bar->out, "%s", "\r##################################                                        48.3%");
     msnprintf(format, sizeof(format), "\r%%-%ds %%5.1f%%%%", barwidth);
     fprintf(bar->out, format, line, percent);
   }

- Ignore intermediate progress updates.

- Support locales that use a character other than period as decimal
  separator (eg 100,0%).

test1148 checks that the progress finishes at 100% and has the right
bar width. Prior to this change the test assumed that the only progress
reported for such a quick transfer was 100%, however in rare instances
(like in the CI where transfer time can slow considerably) there may be
intermediate updates. For example, below is stderrlog1148 from a failed
CI run with explicit \r and \n added (it is one line; broken up so that
it's easier to understand).

\r
\r##################################                                        48.3%
\r######################################################################## 100.0%
\n

Closes #xxxx
@jay jay added the tests label Apr 7, 2020
Copy link
Copy Markdown
Member

@MarcelRaad MarcelRaad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
Why didn't I just to it this way in #2786? I think you can also remove the chkdecimalpoint stuff now.

@bagder
Copy link
Copy Markdown
Member

bagder commented Apr 8, 2020

Hm, I could apparently approve it twice! 😁

@jay jay closed this in 17c18fb Apr 11, 2020
@jay jay deleted the fix_test1148 branch April 11, 2020 06:53
vszakats added a commit to vszakats/curl that referenced this pull request Jul 21, 2025
No longer necessary after a previous change made sure to strip
the '100.0%' number from the result, before checking it. The
dot is a regex character catching any decimal characters.

Follow-up to 17c18fb curl#5194
Ref: curl#2436
vszakats added a commit to vszakats/curl that referenced this pull request Jul 22, 2025
No longer necessary after a previous change made sure to strip
the '100.0%' number from the result, before checking it. The dot is
a regex character catching any decimal character.

Follow-up to 17c18fb curl#5194
Ref: curl#2436
Cherry-picked from curl#17988
vszakats added a commit that referenced this pull request Jul 22, 2025
No longer necessary after a previous change made sure to strip
the '100.0%' number from the result, before checking it. The dot is
a regex character catching any decimal separator.

Follow-up to 17c18fb #5194
Ref: #2436
Cherry-picked from #17988
Closes #17993
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants