-
Notifications
You must be signed in to change notification settings - Fork 2
/
.travis.yml
81 lines (68 loc) · 4.01 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
branches:
except:
- /^(\d)+(\.(\d)+)*[a-z]*$/
before_install:
# Retrieves and extracts the DB2 binaries
# If it does not work, change it according to the next page:
# http://www.ibm.com/support/fixcentral/swg/quickorder?parent=ibm%7EInformation%2BManagement&product=ibm/Information+Management/DB2&release=10.5.*&platform=Linux+64-bit,x86_64&function=fixId&fixids=DB2-linuxx64-server_t-10.5.0.5-FP005&includeRequisites=1&includeSupersedes=0&downloadMethod=http&source=fc
# Unfortunately IBM's download links are not persistent -> useless
# download DB2 from somewhere else instead
- cd /tmp ; wget "https://www.dropbox.com/s/mpzdxqxvpbovbpi/v10.5fp5_linuxx64_server_t.tar.xz?dl=1" -O db2.tar.xz ; tar xJf db2.tar.xz
# Retrieves and extract log4db2
- cd ; wget https://github.com/angoca/log4db2/releases/download/log4db2-1-Beta-A/log4db2.tar.gz ; tar zxvf log4db2.tar.gz
# Retrieves and extract db2unit
- cd
- wget https://github.com/angoca/db2unit/releases/download/db2unit-1/db2unit.tar.gz
- tar zxvf db2unit.tar.gz
# Retrieves the apr
- cd /tmp ; wget http://www.us.apache.org/dist/apr/apr-1.6.5.tar.gz ; tar zxf apr-1.6.5.tar.gz ; cd apr-1.6.5 ;
- cd /tmp ; wget http://www.us.apache.org/dist/apr/apr-util-1.6.1.tar.gz ; tar zxf apr-util-1.6.1.tar.gz ; cd apr-util-1.6.1 ;
# INSTALL
# Install the required libraries
- sudo apt-get update -qq
- sudo apt-get install libaio1 lib32stdc++6 -y
- sudo apt-get install -qq libpam-ldap:i386
- sudo ln -s /lib/i386-linux-gnu/libpam.so.0 /lib/libpam.so.0
- cd /tmp/apr-1.6.5 ; ./configure --prefix=/usr/local/apr CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ; sudo make ; sudo make install
- cd /tmp/apr-util-1.6.1 ; ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr ; sudo make ; sudo make install
# Checks the prerequisites
- cd /tmp/server_t ; ./db2prereqcheck -l
# Install DB2 and creates an instance (Response file)
- sudo ./db2setup -r ${TRAVIS_BUILD_DIR}/tests/travis/db2.rsp || cat /tmp/db2setup.log
- sudo chsh -s /bin/bash db2inst1
- id db2inst1 ; sudo usermod -a -G travis db2inst1 ; id db2inst1
# Creates the database
- sudo su - db2inst1 -c "db2 create db hash"
- echo "db2inst1:db2inst1" | sudo chpasswd
- . ~db2inst1/sqllib/db2profile ; db2 connect to hash user db2inst1 using db2inst1
# Install log4db2
- cd ; cd log4db2 ; . ./install
# Install db2unit
- cd ; cd db2unit ; . ./install
install:
- cd ${TRAVIS_BUILD_DIR}
# Modifies the installation file.
- sed -s 's/^#APRPATH=$/APRPATH=\/usr\/local\/apr\/bin/' makertn | sed -s 's/^#APUPATH=$/APUPATH=\/usr\/local\/apr-util\/bin/' | sed -s 's/\$D_C_FLAGS$/\$D_C_FLAGS -fpic/' > makertn.cpy ; mv makertn.cpy makertn ; chmod 770 makertn
# Changes the rights in some directories
- sudo chmod 777 /home/db2inst1/sqllib/function/unfenced /home/db2inst1/sqllib/function ${TRAVIS_BUILD_DIR}
- sudo chmod 777 ${TRAVIS_BUILD_DIR}/makertn
# Compiles the routines as db2inst1
- sudo su - db2inst1 -c "cd ${TRAVIS_BUILD_DIR} ; bash ./makertn"
#- ls -lR /home/db2inst1/sqllib/function
# Regiters the functions ans stored procedures.
- db2 set current schema db2inst1; db2 -tf register.ddl
# Create the tests.
- db2 -tf tests/tests.sql
script:
# Executes the tests twice.
- db2 "CALL DB2UNIT.RANDOM_SORT(FALSE)"
- db2 -r /tmp/db2unit.output -v "call db2unit.run_suite('DB2_HASH')" ; bash -c "exit $(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print $4}')"
- db2 "CALL DB2UNIT.RANDOM_SORT(TRUE)"
- db2 -r /tmp/db2unit.output -v "call db2unit.run_suite('DB2_HASH')" ; bash -c "exit $(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print $4}')"
- db2 -r /tmp/db2unit.output -v "call db2unit.run_suite('DB2_HASH')" ; bash -c "exit $(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print $4}')"
after_failure:
# If there is any error, shows the logs
- cat /home/db2inst1/sqllib/db2dump/db2diag.log
- db2 "call logadmin.logs(LENGTH=>120)"
- db2 "select * from DB2UNIT_1.EXECUTION_REPORTS"
- db2 "select * from DB2_HASH.REPORT_TESTS"