fixeria has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-hlr/+/44028?usp=email )
Change subject: tests/db_upgrade: fix test failure with sqlite3 >= 3.54.0
......................................................................
tests/db_upgrade: fix test failure with sqlite3 >= 3.54.0
Starting from sqlite3 3.54.0, the CLI prints the column name header
even if the query returns no rows. This results in unexpected header
lines being printed for empty tables, making the db_upgrade test fail.
Skip dumping contents of empty tables, so that the output is the same
regardless of the sqlite3 version.
Change-Id: I7353988516b274eb228818e694dbe857509cf536
---
M tests/db_upgrade/db_upgrade_test.sh
1 file changed, 5 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/28/44028/1
diff --git a/tests/db_upgrade/db_upgrade_test.sh
b/tests/db_upgrade/db_upgrade_test.sh
index 8e2b498..8f4dafd 100755
--- a/tests/db_upgrade/db_upgrade_test.sh
+++ b/tests/db_upgrade/db_upgrade_test.sh
@@ -18,8 +18,11 @@
sqlite3 -batch -header "$db_file" "SELECT
name,type,\"notnull\",dflt_value,pk FROM PRAGMA_TABLE_INFO('$table') order by
name;"
echo
echo "Table $table contents:"
- columns="$(sqlite3 -batch -noheader "$db_file" "SELECT name
FROM PRAGMA_TABLE_INFO('$table') order by name;")"
- sqlite3 -batch -header "$db_file" "SELECT $(echo $columns | sed
's/ /,/g') from $table;"
+ # sqlite3 >= 3.54 prints the header even for empty results, so
skip empty tables
+ if [ "$(sqlite3 -batch -noheader "$db_file" "SELECT COUNT(*)
FROM $table;")" != "0" ]; then
+ columns="$(sqlite3 -batch -noheader "$db_file" "SELECT
name FROM PRAGMA_TABLE_INFO('$table') order by name;")"
+ sqlite3 -batch -header "$db_file" "SELECT $(echo
$columns | sed 's/ /,/g') from $table;"
+ fi
done
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/44028?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Change-Id: I7353988516b274eb228818e694dbe857509cf536
Gerrit-Change-Number: 44028
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>