mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-04 18:36:12 +02:00
Allow for some automated testing using vagrant.
This commit is contained in:
parent
6d322fba7c
commit
031c62c663
11
Vagrantfile
vendored
Normal file
11
Vagrantfile
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
||||
VAGRANTFILE_API_VERSION = "2"
|
||||
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.box = "wheezy64"
|
||||
|
||||
config.vm.provision :shell, :path => "bootstrap.sh"
|
||||
end
|
||||
69
bootstrap.sh
Normal file
69
bootstrap.sh
Normal file
@ -0,0 +1,69 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main" > /etc/apt/sources.list.d/pgdg.list
|
||||
|
||||
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
|
||||
|
||||
apt-get update
|
||||
apt-get install -y postgresql-9.3 postgresql-contrib-9.3
|
||||
apt-get install -y sbcl libmysqlclient-dev git patch unzip
|
||||
|
||||
HBA=/etc/postgresql/9.3/main/pg_hba.conf
|
||||
echo "local all all trust" | sudo tee $HBA
|
||||
echo "host all all 127.0.0.1/32 trust" | sudo tee -a $HBA
|
||||
|
||||
sudo pg_ctlcluster 9.3 main reload
|
||||
createuser -U postgres -SdR `whoami`
|
||||
createdb pgloader
|
||||
|
||||
wget --quiet http://beta.quicklisp.org/quicklisp.lisp
|
||||
sbcl --load quicklisp.lisp <<EOF
|
||||
(quicklisp-quickstart:install)
|
||||
(ql:add-to-init-file)
|
||||
|
||||
(ql:quickload "buildapp")
|
||||
(buildapp:build-buildapp "/home/vagrant/buildapp")
|
||||
(quit)
|
||||
EOF
|
||||
|
||||
cd ~/quicklisp/local-projects/
|
||||
git clone -b empty-strings-and-nil https://github.com/dimitri/cl-csv.git
|
||||
git clone https://github.com/marijnh/Postmodern.git
|
||||
|
||||
cd ~/quicklisp/local-projects/Postmodern/
|
||||
patch -p1 < /vagrant/postmodern-send-copy-done.patch
|
||||
|
||||
cd ~
|
||||
|
||||
sbcl --load quicklisp/setup.lisp <<EOF
|
||||
(pushnew #p"/vagrant/" asdf:*central-registry*)
|
||||
(pushnew #p"/vagrant/lib/db3/" asdf:*central-registry*)
|
||||
(pushnew #p"/vagrant/lib/abnf/" asdf:*central-registry*)
|
||||
(ql:quickload "pgloader")
|
||||
(quit)
|
||||
EOF
|
||||
|
||||
REGISTRY=~/.config/common-lisp/source-registry.conf.d
|
||||
mkdir -p $REGISTRY
|
||||
echo "(:tree \"/vagrant/\")" > $REGISTRY/projects.conf
|
||||
|
||||
# echo "BUILDING PGLOADER SELF-CONTAINED BINARY"
|
||||
|
||||
# /home/vagrant/buildapp --logfile /tmp/build.log \
|
||||
# --asdf-tree ~/quicklisp/dists \
|
||||
# --asdf-tree /vagrant \
|
||||
# --load-system pgloader \
|
||||
# --entry pgloader:main \
|
||||
# --dynamic-space-size 4096 \
|
||||
# --output pgloader.exe
|
||||
|
||||
echo "TESTING"
|
||||
|
||||
/vagrant/pgloader.lisp --help
|
||||
|
||||
for test in /vagrant/test/*.load
|
||||
do
|
||||
echo " TEST: $test"
|
||||
/vagrant/pgloader.lisp $test
|
||||
echo
|
||||
done
|
||||
@ -1,4 +1,4 @@
|
||||
#! /usr/local/bin/sbcl --script
|
||||
#! /usr/bin/sbcl --script
|
||||
|
||||
;;; load the necessary components then parse the command line
|
||||
;;; and launch the work
|
||||
|
||||
29
postmodern-send-copy-done.patch
Normal file
29
postmodern-send-copy-done.patch
Normal file
@ -0,0 +1,29 @@
|
||||
diff --git a/cl-postgres/bulk-copy.lisp b/cl-postgres/bulk-copy.lisp
|
||||
index f8efdb3..0f020d6 100644
|
||||
--- a/cl-postgres/bulk-copy.lisp
|
||||
+++ b/cl-postgres/bulk-copy.lisp
|
||||
@@ -120,13 +120,18 @@
|
||||
(with-syncing
|
||||
(copy-done-message socket)
|
||||
(force-output socket)
|
||||
- (message-case socket
|
||||
- (#\C (let* ((command-tag (read-str socket))
|
||||
- (space (position #\Space command-tag :from-end t)))
|
||||
- (when space
|
||||
- (parse-integer command-tag :junk-allowed t :start (1+ space))))))
|
||||
+ (handler-case
|
||||
+ (message-case socket
|
||||
+ (#\C (let* ((command-tag (read-str socket))
|
||||
+ (space (position #\Space command-tag :from-end t)))
|
||||
+ (when space
|
||||
+ (parse-integer command-tag :junk-allowed t :start (1+ space))))))
|
||||
+ (condition (e)
|
||||
+ ;; In case of error in the COPY stream we need to wait for an
|
||||
+ ;; explicit ReadyForQuery message. Then we re-signal the error.
|
||||
+ (message-case socket (#\Z (read-uint1 socket)))
|
||||
+ (error e)))
|
||||
(loop (message-case socket
|
||||
(#\Z (read-uint1 socket)
|
||||
(return-from send-copy-done))
|
||||
(t :skip)))))
|
||||
-
|
||||
Loading…
x
Reference in New Issue
Block a user