[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[COMMITTED] testsuite: fix dg-require and dg-nbd and adjust ndb tests ac
From: |
Jose E. Marchesi |
Subject: |
[COMMITTED] testsuite: fix dg-require and dg-nbd and adjust ndb tests accordingly |
Date: |
Tue, 03 Mar 2020 12:13:16 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
FYI.
Author: Jose E. Marchesi <address@hidden>
Date: Tue Mar 3 12:06:22 2020 +0100
testsuite: fix dg-require and dg-nbd and adjust ndb tests accordingly
This patch fixes two problems in the testsuite:
1. The poke_commands variable is cleared in poke-dg-test. However,
this procedure is _not_ executed when a test is marked as
UNSUPPORTED by a dg-require directive. Consequently, spurious
commands were being dragged from unsupported tests to the next
test. The solution is to make dg-command to not append to
poke_commands if the current test is marked as UNSUPPORTED. This
of course requires for dg-require directives to appear before any
dg-command directive in test files. This is now documented in
HACKING.
2. The dg-nbd procedure was trying to implicitly dg-require nbd. The
arguments to dg-require were wrong (the line number argument was
missing) and also the upvar variable wasn't referring to the global
variable. Also, the nbdkit command was executed regardless of the
availability of the capability "nbd". This patch changes dg-nbd by
testing for the NBDKIT environment variable before trying to launch
it.
After this patch, this is what I get in a system without libnbd
installed:
=== poke Summary ===
# of expected passes 3073
# of unsupported tests 3
Which is the expected output.
2020-03-03 Jose E. Marchesi <address@hidden>
* testsuite/lib/poke-dg.exp (dg-nbd): Run nbdkit only when
available.
(dg-command): Do not append to poke_commands if the current test
is being skipped as UNSUPPORTED.
* testsuite/poke.pkl/ios-nbd-1.pk: dg-require nbd.
* testsuite/poke.pkl/open-3.pk: Likewise.
* testsuite/poke.cmd/nbd-1.pk: Likewise.
* HACKING: Note that dg-require should be used before dg-command
directives.
diff --git a/ChangeLog b/ChangeLog
index f6680d9..683384b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2020-03-03 Jose E. Marchesi <address@hidden>
+
+ * testsuite/lib/poke-dg.exp (dg-nbd): Run nbdkit only when
+ available.
+ (dg-command): Do not append to poke_commands if the current test
+ is being skipped as UNSUPPORTED.
+ * testsuite/poke.pkl/ios-nbd-1.pk: dg-require nbd.
+ * testsuite/poke.pkl/open-3.pk: Likewise.
+ * testsuite/poke.cmd/nbd-1.pk: Likewise.
+ * HACKING: Note that dg-require should be used before dg-command
+ directives.
+
2020-03-03 Jose E. Marchesi <address@hidden>
* src/pk-utils.h (STREQ): Define.
diff --git a/HACKING b/HACKING
index facb137..3fabfbe 100644
--- a/HACKING
+++ b/HACKING
@@ -517,6 +517,9 @@ capability ``libtextstyle`` is not found in poke::
/* { dg-command {printf "%<foo:%i32d%>", 10} } */
/* { dg-output "<span class=\"foo\">10</span>" } */
+IMPORTANT NOTE: dg-require should appear before any dg-command
+directive in the test file.
+
The supported capabilities are:
libtextstyle
diff --git a/testsuite/lib/poke-dg.exp b/testsuite/lib/poke-dg.exp
index 0478c10..f7994fc 100644
--- a/testsuite/lib/poke-dg.exp
+++ b/testsuite/lib/poke-dg.exp
@@ -32,11 +32,19 @@ set poke_nbd_pids {}
proc dg-command { args } {
global poke_commands
+ upvar dg-do-what do-what
if { [llength $args] > 2 } {
error "[lindex $args 0]: too many arguments"
}
+ # If this test is unsupported, then do not append anything to
+ # poke_commands. This is needed because poke_commands doesn't get
+ # reset to {} in these cases.
+ if { [lindex ${do-what} 1] == N } {
+ return;
+ }
+
# Prepare the command for shell unquoting.
set cmd \"[string map \
{$ \\$ \\ \\\\ \" \\" ` \\`} \
@@ -166,13 +174,14 @@ proc dg-nbd { args } {
if { [llength $args] != 3 } {
error "[lindex $args 0]: invalid arguments"
}
- dg-require nbd
- set data [lindex $args 1]
- set sock [lindex $args 2]
+ if { $::env(NBDKIT) != "no"} {
+ set data [lindex $args 1]
+ set sock [lindex $args 2]
- set fh [open |[list nbdkit -f -U $sock data data=$data]]
- lappend poke_nbd_pids [pid $fh]
+ set fh [open |[list nbdkit -f -U $sock data data=$data]]
+ lappend poke_nbd_pids [pid $fh]
+ }
}
# We set LC_ALL and LANG to C so that we get the same error messages
diff --git a/testsuite/poke.cmd/nbd-1.pk b/testsuite/poke.cmd/nbd-1.pk
index 0d158cb..ca70d0d 100644
--- a/testsuite/poke.cmd/nbd-1.pk
+++ b/testsuite/poke.cmd/nbd-1.pk
@@ -1,4 +1,5 @@
/* { dg-do run } */
+/* { dg-require nbd } */
/* { dg-nbd {0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80} [dg-tmpdir]/nbd-1 } */
/* { dg-command ".nbd nbd+unix:///?socket=[dg-tmpdir]/nbd-1" } */
diff --git a/testsuite/poke.pkl/ios-nbd-1.pk b/testsuite/poke.pkl/ios-nbd-1.pk
index 4c49a77..93e979b 100644
--- a/testsuite/poke.pkl/ios-nbd-1.pk
+++ b/testsuite/poke.pkl/ios-nbd-1.pk
@@ -1,4 +1,5 @@
/* { dg-do run } */
+/* { dg-require nbd } */
/* { dg-nbd {0 0 0 0x10} [dg-tmpdir]/ios-nbd-1 } */
/* { dg-command { .set obase 10 } } */
diff --git a/testsuite/poke.pkl/open-3.pk b/testsuite/poke.pkl/open-3.pk
index d647bbd..a8be00a 100644
--- a/testsuite/poke.pkl/open-3.pk
+++ b/testsuite/poke.pkl/open-3.pk
@@ -1,4 +1,5 @@
/* { dg-do run } */
+/* { dg-require nbd } */
/* { dg-nbd {0x10} [dg-tmpdir]/open-3 } */
/* { dg-command { .set obase 10 } } */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [COMMITTED] testsuite: fix dg-require and dg-nbd and adjust ndb tests accordingly,
Jose E. Marchesi <=