]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
test1148: tolerate progress updates better (again)
authorJay Satiro <raysatiro@yahoo.com>
Tue, 7 Apr 2020 04:50:11 +0000 (00:50 -0400)
committerJay Satiro <raysatiro@yahoo.com>
Sat, 11 Apr 2020 06:51:50 +0000 (02:51 -0400)
- 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 https://github.com/curl/curl/pull/5194

tests/data/test1148

index ba498698ae98c63373b88cb8dba547bba4ca7f1c..c4232f083a926ca18e981141731de78b4c13f9bf 100644 (file)
@@ -37,9 +37,6 @@ progress-bar
  <command>
 http://%HOSTIP:%HTTPPORT/1148 -# --stderr log/stderrlog1148
 </command>
-<precheck>
-perl -e '$ENV{"LC_NUMERIC"} = "en_US.UTF-8"; print "Test requires point as decimal separator" if system("./libtest/chkdecimalpoint");'
-</precheck>
 <setenv>
 LC_ALL=
 LC_NUMERIC=en_US.UTF-8
@@ -57,13 +54,16 @@ Host: %HOSTIP:%HTTPPORT
 Accept: */*\r
 \r
 </protocol>
-# This allows the last 4 letters of the bar to get updated without it
-# matters. We're mostly checking the width of it anyway.
+
+# Check that the progress finished at 100% and has the right bar width.
+# Note the dot in 100.0% is regex to match any character since different
+# locales use different separators.
 <file name="log/stderrlog1148" mode="text">
-\rbar 100.0%
+correct
 </file>
 <stripfile>
-s/####################################################################..../bar/
+s/.*\r#{72} 100.0%/correct/
 </stripfile>
+
 </verify>
 </testcase>