Skip to contentSkip to conversation

Test timeout fixes and URI code clean up

GIT PULL Applied Thomas Huth 2 participants 9 messages Jan 24, 2024 – Jan 25, 2024 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

Hi Peter!

The following changes since commit 09be34717190c1620f0c6e5c8765b8da354aeb4b:

Merge tag 'pull-request-2024-01-19' of https://gitlab.com/thuth/qemu into staging (2024-01-20 17:22:16 +0000)

are available in the Git repository at:

https://gitlab.com/thuth/qemu.git tags/pull-request-2024-01-24

for you to fetch changes up to e7b991451eecb58af34d6d3d17209e97f5e97f96:

util/uri: Remove unused macros ISA_RESERVED() and ISA_GEN_DELIM() (2024-01-24 09:54:05 +0100)

----------------------------------------------------------------
* Test timeout fixes
* Clean up URI code

----------------------------------------------------------------
Thomas Huth (7):
tests/qtest: Bump timeout of the boot-serial-test to 360 seconds tests/unit/test-iov: Fix timeout problem on NetBSD and OpenBSD tests/qtest: Bump timeouts of boot_sector_test()-based tests to 610 seconds util/uri: Remove uri_string_unescape()
util/uri: Remove unused functions uri_resolve() and uri_resolve_relative() util/uri: Remove the uri_string_escape() function
util/uri: Remove unused macros ISA_RESERVED() and ISA_GEN_DELIM()

 include/qemu/uri.h      |   4 -
 tests/unit/test-iov.c   |  20 +-
 util/uri.c              | 869 +-----------------------------------------------
 tests/qtest/meson.build |   8 +-
 4 files changed, 27 insertions(+), 874 deletions(-)
#1 lore raw

[PULL 4/7] util/uri: Remove uri_string_unescape()

uri_string_unescape() basically does the same as the glib function g_uri_unescape_segment(). So we can get rid of our implementation completely by simply using the glib function instead.

Message-ID: <[email protected]>

---
 include/qemu/uri.h |  1 -
 util/uri.c         | 97 ++++++----------------------------------------
 2 files changed, 11 insertions(+), 87 deletions(-)
include/qemu/uri.h +0 -1
index 1855b764f2..f0722b75da 100644
@@ -79,7 +79,6 @@ URI *uri_parse_raw(const char *str, int raw);
 int uri_parse_into(URI *uri, const char *str);
 char *uri_to_string(URI *uri);
 char *uri_string_escape(const char *str, const char *list);
-char *uri_string_unescape(const char *str, int len, char *target);
 void uri_free(URI *uri);
 
 /* Single web service query parameter 'name=value'. */
util/uri.c +11 -86

163 lines not on this page · raw message

Signature · 1 line
2.43.0
#2 lore raw

[PULL 2/7] tests/unit/test-iov: Fix timeout problem on NetBSD and OpenBSD

In reply to Thomas Huth

The test-iov code uses usleep() with small values (<= 30) in some nested loops with many iterations. This causes a small delay on OSes like Linux that have a precise sleeping mechanism, but on systems like NetBSD and OpenBSD, each usleep() call takes multiple microseconds, which then sum up in a total test time of multiple minutes!

Looking at the code, the usleep() does not really seem to be necessary here - if not enough data could be send, we should simply always use select() to wait 'til we can send more. Thus remove the usleep() and re-arrange the code a little bit to make it more clear what is going on here.

Message-ID: <[email protected]>

---
 tests/unit/test-iov.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
tests/unit/test-iov.c +11 -9
index 6f7623d310..75bc3be005 100644
@@ -197,15 +197,17 @@ static void test_io(void)
                    s = g_test_rand_int_range(0, j - k + 1);
                    r = iov_send(sv[1], iov, niov, k, s);
                    g_assert(memcmp(iov, siov, sizeof(*iov)*niov) == 0);
-                   if (r >= 0) {
-                       k += r;
-                       usleep(g_test_rand_int_range(0, 30));
-                   } else if (errno == EAGAIN) {
-                       select(sv[1]+1, NULL, &fds, NULL, NULL);
-                       continue;
-                   } else {
-                       perror("send");
-                       exit(1);
+                   if (r < 0) {
+                        if (errno == EAGAIN) {
+                            r = 0;
+                        } else {
+                            perror("send");
+                            exit(1);
+                        }
+                   }
+                   k += r;
+                   if (k < j) {
+                        select(sv[1] + 1, NULL, &fds, NULL, NULL);
                    }
                } while(k < j);
            }
Signature · 1 line
2.43.0
#3 lore raw

[PULL 1/7] tests/qtest: Bump timeout of the boot-serial-test to 360 seconds

In reply to Thomas Huth

On the slow k8s CI runner, the test sometimes takes more than 240 seconds. See for example this run here where it took ~ 267 seconds:

https://gitlab.com/qemu-project/qemu/-/jobs/5806087027#L4769

Thus we have to bump the timeout here even further to be on the safe side. Let's use 360 seconds which should hopefully really be high enough now.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2097
Message-ID: <[email protected]>

---
 tests/qtest/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qtest/meson.build +1 -1
index d22434b14e..d22aec6734 100644
@@ -9,7 +9,7 @@ slow_qtests = {
   'test-hmp' : 240,
   'pxe-test': 600,
   'prom-env-test': 360,
-  'boot-serial-test': 240,
+  'boot-serial-test': 360,
   'qos-test': 120,
 }
 
Signature · 1 line
2.43.0
#4 lore raw

[PULL 7/7] util/uri: Remove unused macros ISA_RESERVED() and ISA_GEN_DELIM()

In reply to Thomas Huth

They are not used anywhere, so there's no need to keep them around.

Message-ID: <[email protected]>

---
 util/uri.c | 13 -------------
 1 file changed, 13 deletions(-)
util/uri.c +0 -13
index 350835b03f..573174bf47 100644
@@ -163,19 +163,6 @@ static void uri_clean(URI *uri);
      ((*(p) == '+')) || ((*(p) == ',')) || ((*(p) == ';')) ||                  \
      ((*(p) == '=')) || ((*(p) == '\'')))
 
-/*
- *    gen-delims    = ":" / "/" / "?" / "#" / "[" / "]" / "@"
- */
-#define ISA_GEN_DELIM(p)                                                       \
-    (((*(p) == ':')) || ((*(p) == '/')) || ((*(p) == '?')) ||                  \
-     ((*(p) == '#')) || ((*(p) == '[')) || ((*(p) == ']')) ||                  \
-     ((*(p) == '@')))
-
-/*
- *    reserved      = gen-delims / sub-delims
- */
-#define ISA_RESERVED(p) (ISA_GEN_DELIM(p) || (ISA_SUB_DELIM(p)))
-
 /*
  *    unreserved    = ALPHA / DIGIT / "-" / "." / "_" / "~"
  */
Signature · 1 line
2.43.0
#5 lore raw

[PULL 5/7] util/uri: Remove unused functions uri_resolve() and uri_resolve_relative()

In reply to Thomas Huth

These rather complex functions have never been used since they've been introduced in 2012, so looks like they are not really useful for QEMU. And since the static normalize_uri_path() function is also only used by uri_resolve(), we can remove that function now, too.

Message-ID: <[email protected]>

---
 include/qemu/uri.h |   2 -
 util/uri.c         | 689 ---------------------------------------------
 2 files changed, 691 deletions(-)
include/qemu/uri.h +0 -2
index f0722b75da..899ce852f5 100644
@@ -72,8 +72,6 @@ typedef struct URI {
 } URI;
 
 URI *uri_new(void);
-char *uri_resolve(const char *URI, const char *base);
-char *uri_resolve_relative(const char *URI, const char *base);
 URI *uri_parse(const char *str);
 URI *uri_parse_raw(const char *str, int raw);
 int uri_parse_into(URI *uri, const char *str);
util/uri.c +0 -689

701 lines not on this page · raw message

Signature · 1 line
2.43.0
#6 lore raw

[PULL 3/7] tests/qtest: Bump timeouts of boot_sector_test()-based tests to 610 seconds

In reply to Thomas Huth

We're still seeing timeouts in qtests that use a TCG payload with TCI on a slow k8s runner:

https://gitlab.com/qemu-project/qemu/-/jobs/5990992722

So we should bump the timeout of cdrom-test to see whether that fixes the issue.
Now, cdrom-test, as bios-tables-test, pxe-test and vmgenid-test use the boot_sector_test() function for running a TCG payload. That function already uses an internal timeout of 600 seconds with the remark that the test could be slow with TCI.
Thus from the outer meson test runner side, we should not use less than 600 seconds as timeout values for these tests. Let's bump them on the meson side to 610 seconds so that the tests themselves can run with their internal 600 seconds timeout and have some additional seconds on top for reporting the outcome.

Message-ID: <[email protected]>

---
 tests/qtest/meson.build | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tests/qtest/meson.build +4 -2
index d22aec6734..84a055a7d9 100644
@@ -1,16 +1,18 @@
 slow_qtests = {
   'aspeed_smc-test': 360,
-  'bios-tables-test' : 540,
+  'bios-tables-test' : 610,
+  'cdrom-test' : 610,
   'device-introspect-test' : 720,
   'migration-test' : 480,
   'npcm7xx_pwm-test': 300,
   'npcm7xx_watchdog_timer-test': 120,
   'qom-test' : 900,
   'test-hmp' : 240,
-  'pxe-test': 600,
+  'pxe-test': 610,
   'prom-env-test': 360,
   'boot-serial-test': 360,
   'qos-test': 120,
+  'vmgenid-test': 610,
 }
 
 qtests_generic = [
Signature · 1 line
2.43.0
#7 lore raw

[PULL 6/7] util/uri: Remove the uri_string_escape() function

In reply to Thomas Huth

Now that uri_resolve_relative() has been removed, this function is not used in QEMU anymore - and if somebody needs this functionality, they can simply use g_uri_escape_string() from the glib instead.

Message-ID: <[email protected]>

---
 include/qemu/uri.h |  1 -
 util/uri.c         | 70 ----------------------------------------------
 2 files changed, 71 deletions(-)
include/qemu/uri.h +0 -1
index 899ce852f5..255e61f452 100644
@@ -76,7 +76,6 @@ URI *uri_parse(const char *str);
 URI *uri_parse_raw(const char *str, int raw);
 int uri_parse_into(URI *uri, const char *str);
 char *uri_to_string(URI *uri);
-char *uri_string_escape(const char *str, const char *list);
 void uri_free(URI *uri);
 
 /* Single web service query parameter 'name=value'. */
util/uri.c +0 -70

76 lines not on this page · raw message

Signature · 1 line
2.43.0
#8 lore raw
In reply to Thomas Huth
Quoted 11 lines · Thomas Huth

Hi Peter!

The following changes since commit 09be34717190c1620f0c6e5c8765b8da354aeb4b:

Merge tag 'pull-request-2024-01-19' of https://gitlab.com/thuth/qemu into staging (2024-01-20 17:22:16 +0000)

are available in the Git repository at:

https://gitlab.com/thuth/qemu.git tags/pull-request-2024-01-24

Quoted 8 lines

for you to fetch changes up to e7b991451eecb58af34d6d3d17209e97f5e97f96:

util/uri: Remove unused macros ISA_RESERVED() and ISA_GEN_DELIM() (2024-01-24 09:54:05 +0100)

----------------------------------------------------------------
* Test timeout fixes
* Clean up URI code

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/9.0
for any user-visible changes.

-- PMM