Add MySQL (MariaDB) support in tests.

This commit is contained in:
Dimitri Fontaine 2013-12-03 22:06:10 +01:00
parent f02eb641b4
commit b84541367d
3 changed files with 48 additions and 10 deletions

View File

@ -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

View File

@ -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

View File

@ -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) $<