[aur-dev] [PATCH] test/setup.sh: Error out on missing SQLite schema

Lukas Fleischer lfleischer at archlinux.org
Fri Mar 3 19:32:52 UTC 2017


Instead of making all tests fail, error out during initialization if the
SQLite schema has not been generated.

Signed-off-by: Lukas Fleischer <lfleischer at archlinux.org>
---
 test/setup.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/test/setup.sh b/test/setup.sh
index 64ba88f..b71e73e 100644
--- a/test/setup.sh
+++ b/test/setup.sh
@@ -105,8 +105,10 @@ SSH_TTY=/dev/pts/0
 export SSH_CLIENT SSH_CONNECTION SSH_TTY
 
 # Initialize the test database.
+DBSCHEMA="$TOPLEVEL/schema/aur-schema-sqlite.sql"
+[ -f "$DBSCHEMA" ] || error 'SQLite database schema not found'
 rm -f aur.db
-sqlite3 aur.db <"$TOPLEVEL/schema/aur-schema-sqlite.sql"
+sqlite3 aur.db <"$DBSCHEMA"
 
 echo "INSERT INTO Users (ID, UserName, Passwd, Email, AccountTypeID) VALUES (1, 'user', '!', 'user at localhost', 1);" | sqlite3 aur.db
 echo "INSERT INTO Users (ID, UserName, Passwd, Email, AccountTypeID) VALUES (2, 'tu', '!', 'tu at localhost', 2);" | sqlite3 aur.db
-- 
2.12.0


More information about the aur-dev mailing list