From b84541367dab5ac804fe50f9262c8efcd42c100a Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Tue, 3 Dec 2013 22:06:10 +0100 Subject: [PATCH] Add MySQL (MariaDB) support in tests. --- Makefile | 10 ++++++++++ bootstrap.sh | 22 +++++++++++++++++++++- test/Makefile | 26 +++++++++++++++++--------- 3 files changed, 48 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index f8fd730..d7ae27b 100644 --- a/Makefile +++ b/Makefile @@ -78,6 +78,16 @@ $(PGLOADER): $(MANIFEST) $(BUILDAPP) pgloader: $(PGLOADER) ; +new-vm: + vagrant destroy -f + vagrant up + +vm: + vagrant up + +vm-build: vm + vagrant ssh -c "make -C /vagrant" + test: $(MAKE) PGLOADER=$(realpath $(PGLOADER)) -C test all diff --git a/bootstrap.sh b/bootstrap.sh index 72faf86..a68e2ec 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,17 +1,37 @@ #!/usr/bin/env bash +# PostgreSQL +sidsrc=/etc/apt/sources.list.d/sid-src.list +echo "deb-src http://ftp.fr.debian.org/debian/ sid main" | sudo tee $sidsrc + pgdg=/etc/apt/sources.list.d/pgdg.list pgdgkey=https://www.postgresql.org/media/keys/ACCC4CF8.asc echo "deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main" | sudo tee $pgdg wget --quiet -O - ${pgdgkey} | sudo apt-key add - +# MariaDB +sudo apt-get install -y python-software-properties +sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db +sudo add-apt-repository 'deb http://mirrors.linsrv.net/mariadb/repo/10.0/debian wheezy main' + sudo apt-get update sudo apt-get install -y postgresql-9.3 postgresql-contrib-9.3 \ postgresql-9.3-ip4r \ sbcl \ git patch unzip \ - libmysqlclient-dev libsqlite3-dev + libsqlite3-dev + +sudo DEBIAN_FRONTEND=noninteractive \ + apt-get install -y --allow-unauthenticated mariadb-server + +# SBCL +# +# we need to backport SBCL from sid to have a recent enough version of the +# compiler and run time we depend on +sudo apt-get -y build-dep sbcl +sudo apt-get source -b sbcl > /dev/null 2>&1 # too verbose +sudo dpkg -i *.deb HBA=/etc/postgresql/9.3/main/pg_hba.conf echo "local all all trust" | sudo tee $HBA diff --git a/test/Makefile b/test/Makefile index f68ee56..5f75cad 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,3 +1,4 @@ +TMPDIR ?= /tmp TESTS = $(wildcard *.load) OUT = $(TESTS:.load=.out) @@ -12,11 +13,6 @@ remote: prepare $(REMOTE:.load=.out) all: prepare $(OUT) -sakila: ; -# unzip data/sakila-db.zip -# echo "SOURCE data/sakila-db/sakila-schema.sql" | mysql -u root -# echo "SOURCE data/sakila-db/sakila-data.sql" | mysql -u root - prepare: bossa.sql sakila -dropdb -U postgres pgloader -dropdb -U postgres stocks @@ -28,10 +24,6 @@ prepare: bossa.sql sakila -psql -U postgres -d ip4r -c 'create extension ip4r' -psql -d stocks -f bossa.sql -# Some special cases where we expect errors and want to continue testing -sakila.out: sakila.load - @echo "no MySQL installation here." - errors.out: errors.load -$(PGLOADER) $< @echo @@ -40,6 +32,22 @@ nofile.out: nofile.load -$(PGLOADER) $< @echo +# sakila needs preparing a MySQL database too +$(TMPDIR)/sakila-db/sakila-schema.sql: data/sakila-db.zip + rm -rf $(TMPDIR)/sakila-db + unzip $< -d $(TMPDIR) + +sakila: $(TMPDIR)/sakila-db/sakila-schema.sql + -dropdb -U postgres sakila + -createdb -U postgres -O `whoami` sakila + -echo "DROP DATABASE sakila" | mysql -u root + echo "SOURCE $(TMPDIR)/sakila-db/sakila-schema.sql" | mysql -u root + echo "SOURCE $(TMPDIR)/sakila-db/sakila-data.sql" | mysql -u root + +sakila.out: sakila sakila.load + -$(PGLOADER) sakila.load + @echo + # General case where we do NOT expect any error %.out: %.load $(PGLOADER) $<