about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-01-08 04:27:33 +0000
committerEric Wong <e@80x24.org>2023-01-09 07:25:53 +0000
commit2c7547e929737f28069eeea2b3cd4009a4f7867c (patch)
tree4700ba9f5c620aeb806b6cb9aedace6ae1b8dae5
parent72a3769760252f4f2cddf1d63e939e4c9b505cdd (diff)
downloadmwrap-2c7547e929737f28069eeea2b3cd4009a4f7867c.tar.gz
Just disable the test if CSV import doesn't work with the
currently-installed sqlite3.
-rw-r--r--t/httpd.t19
1 files changed, 14 insertions, 5 deletions
diff --git a/t/httpd.t b/t/httpd.t
index 125ae3b..bf9100e 100644
--- a/t/httpd.t
+++ b/t/httpd.t
@@ -135,19 +135,28 @@ SKIP: {
 
 SKIP: {
         skip 'no reset w/o curl --unix-socket', 1 if !$curl_unix;
-
+        my ($sqlite_v) = (`sqlite3 --version` =~ /([\d+\.]+)/);
+        if ($?) {
+                diag 'sqlite3 missing or broken';
+                $sqlite_v = 0;
+        } else {
+                my @v = split(/\./, $sqlite_v);
+                $sqlite_v = ($v[0] << 16) | ($v[1] << 8) | $v[2];
+                diag 'sqlite_v='.sprintf('0x%x', $sqlite_v);
+        }
         $rc = system(@curl, "http://0/$pid/each/100.csv");
         is($rc, 0, '.csv retrieved') or skip 'CSV failed', 1;
         my $db = "$mwrap_tmp/t.sqlite3";
-        $rc = system(qw(sqlite3), $db, ".import --csv $cout mwrap_each");
-        if ($rc == -1) {
-                diag 'sqlite3 missing';
-        } else {
+
+        if ($sqlite_v >= 0x32000) {
+                $rc = system(qw(sqlite3), $db,".import --csv $cout mwrap_each");
                 is($rc, 0, 'sqlite3 import');
                 my $n = `sqlite3 $db 'SELECT COUNT(*) FROM mwrap_each'`;
                 is($?, 0, 'sqlite3 count');
                 my $exp = split(/\n/, slurp($cout));
                 is($n + 1, $exp, 'imported all rows into sqlite');
+        } else {
+                diag "sqlite 3.32.0+ needed for `.import --csv'";
         }
 
         $rc = system(@curl, qw(-d x=y), "http://0/$pid/reset");