-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.travis.yml
77 lines (62 loc) · 3.94 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
env:
- ENV=release
- ENV=test TESTS=seq
- ENV=test TESTS=random
before_install:
# Parallel download
- mvn > /dev/null &
- sudo apt-get update -qq
- sudo apt-get install aria2 curl -y
- sudo ./src/test/travis/update.sh > /dev/null
# Retrieves and extracts the DB2 binaries
# If it does not work, change the wiki https://github.com/angoca/db2unit/wiki/DB2-Download-link
- LINK=$(curl --url https://raw.githubusercontent.com/wiki/angoca/db2unit/docs/DB2-Download-link.md -s | tail -1)
- echo ${LINK}
- cd /tmp ; aria2c -x 16 ${LINK} ; tar zxvf *.tar.gz
# 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
# INSTALL
# Install the required libraries
- 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
# Checks the prerequisites
- cd /tmp/server_t ; ./db2prereqcheck -l -i
# Install DB2 and creates an instance (Response file)
- sudo ./db2setup -r ${TRAVIS_BUILD_DIR}/src/test/travis/db2.rsp || cat /tmp/db2setup.log
# Changes the security
- sudo usermod -a -G db2iadm1 $USER
- sudo chsh -s /bin/bash db2inst1
- sudo su - db2inst1 -c "db2 update dbm cfg using SYSADM_GROUP db2iadm1 ; db2stop ; db2start"
# Creates the database
- sudo su - db2inst1 -c "db2 create db db2unit ; db2 connect to db2unit ; db2 grant dbadm on database to user $USER"
- . ~db2inst1/sqllib/db2profile ; db2 connect to db2unit
install:
# Install log4db2
- cd ; cd log4db2 ; . ./install
# Install db2unit
- cd ${TRAVIS_BUILD_DIR}
- bash -c "if [ '$ENV' = 'release' ]; then mvn ; db2 connect to db2unit ; cd target/db2unit/db2unit ; . ./install ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to db2unit ; cd src/test/scripts ; . ./init-dev ; cd ../../main/scripts ; . ./install ; fi"
- cd src/test/scripts ; . ./init-dev
- db2 "CREATE TABLESPACE SYSTOOLSPACE IN IBMCATGROUP MANAGED BY AUTOMATIC STORAGE USING STOGROUP IBMSTOGROUP EXTENTSIZE 4"
# Install the tests
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to db2unit ; db2 -tf ../sql-pl/Tests_DB2UNIT_EMPTY.sql ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to db2unit ; db2 -tf ../sql-pl/Tests_DB2UNIT_EXECUTION.sql ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to db2unit ; db2 -tf ../sql-pl/Tests_DB2UNIT_ASSERTIONS.sql ; fi"
- bash -c "if [ '$TESTS' = 'random' ]; then db2 connect to db2unit ; db2 \"call db2unit.export_tests_list\"; sudo chmod +x /tmp/listOfTestSuites ; sudo chmod +x /tmp/returnCode ; cat /tmp/listOfTestSuites ; fi"
script:
- bash -c "if [ '$TESTS' = 'seq' ]; then db2 connect to db2unit ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('DB2UNIT_EMPTY')\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\"; fi"
- bash -c "if [ '$TESTS' = 'seq' ]; then db2 connect to db2unit ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('DB2UNIT_EXECUTION')\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\"; fi"
- bash -c "if [ '$TESTS' = 'seq' ]; then db2 connect to db2unit ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('DB2UNIT_ASSERTIONS')\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\"; fi"
- bash -c "if [ '$TESTS' = 'random' ]; then db2 connect to db2unit ; . /tmp/listOfTestSuites ; /tmp/returnCode ; fi"
after_script:
- cat $(db2 get dbm cfg | awk '/\(DIAGPATH\)/ {print $7}')/DIAG0000/db2diag.log
after_failure:
# If there is any error, shows the logs
- db2 "call logadmin.logs"
- db2 "select * from DB2UNIT_1.EXECUTION_REPORTS"
- db2 "select * from DB2UNIT_EMPTY.REPORT_TESTS"
- db2 "select * from DB2UNIT_EXECUTION.REPORT_TESTS"
- db2 "select * from DB2UNIT_ASSERTIONS.REPORT_TESTS"
- db2 "export to /tmp/sorts.txt of del select * from db2unit_1.sorts" ; cat /tmp/sorts.txt