diff options
author | Eric Wong <e@80x24.org> | 2023-01-08 04:27:33 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-01-09 07:25:53 +0000 |
commit | 2c7547e929737f28069eeea2b3cd4009a4f7867c (patch) | |
tree | 4700ba9f5c620aeb806b6cb9aedace6ae1b8dae5 | |
parent | 72a3769760252f4f2cddf1d63e939e4c9b505cdd (diff) | |
download | mwrap-2c7547e929737f28069eeea2b3cd4009a4f7867c.tar.gz |
Just disable the test if CSV import doesn't work with the currently-installed sqlite3.
-rw-r--r-- | t/httpd.t | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -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"); |