-
Notifications
You must be signed in to change notification settings - Fork 2
/
.travis.yml
136 lines (121 loc) · 13.7 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
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/log4db2/wiki/DB2-Download-link
- LINK=$(curl --url https://raw.githubusercontent.com/wiki/angoca/log4db2/DB2-Download-link.md -s | tail -1)
- cd /tmp ; aria2c -x 16 ${LINK} ; tar zxvf *.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
# 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
# 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 log4db2 ; db2 connect to log4db2 ; db2 grant dbadm on database to user $USER"
- . ~db2inst1/sqllib/db2profile ; db2 connect to log4db2 ; db2 update db cfg using CATALOGCACHE_SZ 2048
install:
# Install log4db2
- cd ${TRAVIS_BUILD_DIR}
- bash -c "if [ '$ENV' = 'release' ]; then mvn ; . ~db2inst1/sqllib/db2profile ; db2 connect to log4db2 ; cd target/log4db2/log4db2 ; . ./install ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then . ~db2inst1/sqllib/db2profile ; db2 connect to log4db2 ; cd src/test/scripts ; . ./init-dev ; cd ../../main/scripts ; . ./install ; fi"
# Install db2unit
- db2 "CREATE TABLESPACE SYSTOOLSPACE IN IBMCATGROUP MANAGED BY AUTOMATIC STORAGE USING STOGROUP IBMSTOGROUP EXTENTSIZE 4"
- bash -c "if [ '$ENV' = 'test' ]; then . ~db2inst1/sqllib/db2profile ; db2 connect to log4db2 ; cd ; cd db2unit ; . ./install ; fi"
- cd src/test/scripts ; . ./init-dev ; cd ../sql-pl
# TODO delete next line, it will be included in the next db2unit release
#- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to log4db2 ; db2 \"ALTER MODULE DB2UNIT_1.DB2UNIT PUBLISH PROCEDURE REGISTER_SUITE (IN SCHMA VARCHAR(128)) INSERT INTO DB2UNIT_1B.SUITES (SUITE_NAME) VALUES (SCHMA)\" ; fi"
# Install the tests
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to log4db2 ; db2 -tf Tests_LOG4DB2_APPENDERS.sql ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to log4db2 ; db2 -tf Tests_LOG4DB2_APPENDERS_IMPLEMENTATION.sql ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to log4db2 ; db2 -tf Tests_LOG4DB2_CACHE_CONFIGURATION.sql ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to log4db2 ; db2 -tf Tests_LOG4DB2_CACHE_LEVELS.sql ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to log4db2 ; db2 -tf Tests_LOG4DB2_CACHE_LOGGERS.sql ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to log4db2 ; db2 -tf Tests_LOG4DB2_CASCADE_CALL_LIMIT.sql ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to log4db2 ; db2 -tf Tests_LOG4DB2_CONF_APPENDERS.sql ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to log4db2 ; db2 -tf Tests_LOG4DB2_CONFIGURATION.sql ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to log4db2 ; db2 -tf Tests_LOG4DB2_CONF_LOGGERS.sql ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to log4db2 ; db2 -tf Tests_LOG4DB2_CONF_LOGGERS_DELETE.sql ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to log4db2 ; db2 -tf Tests_LOG4DB2_CONF_LOGGERS_EFFECTIVE.sql ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to log4db2 ; db2 -tf Tests_LOG4DB2_CONF_LOGGERS_EFFECTIVE_CASES.sql ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to log4db2 ; db2 -tf Tests_LOG4DB2_DYNAMIC_APPENDERS.sql ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to log4db2 ; db2 -tf Tests_LOG4DB2_FUNCTION_GET_DEFINED_PARENT_LOGGER.sql ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to log4db2 ; db2 -tf Tests_LOG4DB2_GET_LOGGER.sql ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to log4db2 ; db2 -tf Tests_LOG4DB2_GET_LOGGER_NAME.sql ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to log4db2 ; db2 -tf Tests_LOG4DB2_HIERARCHY.sql ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to log4db2 ; db2 -tf Tests_LOG4DB2_LAYOUT.sql ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to log4db2 ; db2 -tf Tests_LOG4DB2_LEVELS.sql ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to log4db2 ; db2 -tf Tests_LOG4DB2_LOGS.sql ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to log4db2 ; db2 -tf Tests_LOG4DB2_MESSAGES.sql ; fi"
- bash -c "if [ '$ENV' = 'test' ]; then db2 connect to log4db2 ; db2 -tf Tests_LOG4DB2_REFERENCES.sql ; fi"
- bash -c "if [ '$TESTS' = 'random' ]; then db2 connect to log4db2 ; 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 log4db2 ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('LOG4DB2_APPENDERS')\" ; db2 \"call db2unit.get_last_execution_order()\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\" ; fi"
- bash -c "if [ '$TESTS' = 'seq' ]; then db2 connect to log4db2 ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('LOG4DB2_APPENDERS_IMPLEMENTATION')\" ; db2 \"call db2unit.get_last_execution_order()\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\" ; fi"
- bash -c "if [ '$TESTS' = 'seq' ]; then db2 connect to log4db2 ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('LOG4DB2_CACHE_CONFIGURATION')\" ; db2 \"call db2unit.get_last_execution_order()\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\" ; fi"
- bash -c "if [ '$TESTS' = 'seq' ]; then db2 connect to log4db2 ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('LOG4DB2_CACHE_LEVELS')\" ; db2 \"call db2unit.get_last_execution_order()\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\" ; fi"
- bash -c "if [ '$TESTS' = 'seq' ]; then db2 connect to log4db2 ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('LOG4DB2_CACHE_LOGGERS')\" ; db2 \"call db2unit.get_last_execution_order()\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\" ; fi"
- bash -c "if [ '$TESTS' = 'seq' ]; then db2 connect to log4db2 ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('LOG4DB2_CASCADE_CALL_LIMIT')\" ; db2 \"call db2unit.get_last_execution_order()\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\" ; fi"
- bash -c "if [ '$TESTS' = 'seq' ]; then db2 connect to log4db2 ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('LOG4DB2_CONF_APPENDERS')\" ; db2 \"call db2unit.get_last_execution_order()\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\" ; fi"
- bash -c "if [ '$TESTS' = 'seq' ]; then db2 connect to log4db2 ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('LOG4DB2_CONFIGURATION')\" ; db2 \"call db2unit.get_last_execution_order()\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\" ; fi"
- bash -c "if [ '$TESTS' = 'seq' ]; then db2 connect to log4db2 ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('LOG4DB2_CONF_LOGGERS')\" ; db2 \"call db2unit.get_last_execution_order()\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\" ; fi"
- bash -c "if [ '$TESTS' = 'seq' ]; then db2 connect to log4db2 ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('LOG4DB2_CONF_LOGGERS_DELETE')\" ; db2 \"call db2unit.get_last_execution_order()\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\" ; fi"
- bash -c "if [ '$TESTS' = 'seq' ]; then db2 connect to log4db2 ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('LOG4DB2_CONF_LOGGERS_EFFECTIVE')\" ; db2 \"call db2unit.get_last_execution_order()\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\" ; fi"
- bash -c "if [ '$TESTS' = 'seq' ]; then db2 connect to log4db2 ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('LOG4DB2_CONF_LOGGERS_EFFECTIVE_CASES')\" ; db2 \"call db2unit.get_last_execution_order()\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\" ; fi"
- bash -c "if [ '$TESTS' = 'seq' ]; then db2 connect to log4db2 ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('LOG4DB2_DYNAMIC_APPENDERS')\" ; db2 \"call db2unit.get_last_execution_order()\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\" ; fi"
- bash -c "if [ '$TESTS' = 'seq' ]; then db2 connect to log4db2 ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('LOG4DB2_FUNCTION_GET_DEFINED_PARENT_LOGGER')\" ; db2 \"call db2unit.get_last_execution_order()\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\" ; fi"
- bash -c "if [ '$TESTS' = 'seq' ]; then db2 connect to log4db2 ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('LOG4DB2_GET_LOGGER')\" ; db2 \"call db2unit.get_last_execution_order()\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\" ; fi"
- bash -c "if [ '$TESTS' = 'seq' ]; then db2 connect to log4db2 ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('LOG4DB2_GET_LOGGER_NAME')\" ; db2 \"call db2unit.get_last_execution_order()\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\" ; fi"
- bash -c "if [ '$TESTS' = 'seq' ]; then db2 connect to log4db2 ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('LOG4DB2_HIERARCHY')\" ; db2 \"call db2unit.get_last_execution_order()\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\" ; fi"
- bash -c "if [ '$TESTS' = 'seq' ]; then db2 connect to log4db2 ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('LOG4DB2_LAYOUT')\" ; db2 \"call db2unit.get_last_execution_order()\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\" ; fi"
- bash -c "if [ '$TESTS' = 'seq' ]; then db2 connect to log4db2 ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('LOG4DB2_LEVELS')\" ; db2 \"call db2unit.get_last_execution_order()\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\" ; fi"
- bash -c "if [ '$TESTS' = 'seq' ]; then db2 connect to log4db2 ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('LOG4DB2_LOGS')\" ; db2 \"call db2unit.get_last_execution_order()\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\" ; fi"
- bash -c "if [ '$TESTS' = 'seq' ]; then db2 connect to log4db2 ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('LOG4DB2_MESSAGES')\" ; db2 \"call db2unit.get_last_execution_order()\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\" ; fi"
- bash -c "if [ '$TESTS' = 'seq' ]; then db2 connect to log4db2 ; db2 -r /tmp/db2unit.output \"call db2unit.run_suite('LOG4DB2_REFERENCES')\" ; db2 \"call db2unit.get_last_execution_order()\" ; bash -c \"exit \$(tail -1 /tmp/db2unit.output | awk '/Return Status/ {print \$4}')\" ; fi"
- bash -c "if [ '$TESTS' = 'random' ]; then db2 connect to log4db2 ; . /tmp/listOfTestSuites ; /tmp/returnCode ; fi"
after_script:
- . ~db2inst1/sqllib/db2profile ; db2 "CALL DB2UNIT.REPORT_RECENT_EXECUTIONS"
- cat /home/db2inst1/sqllib/db2dump/db2diag.log
after_failure:
# If there is any error, shows the logs
- db2 "call logadmin.logs"
- db2 "select * from DB2UNIT_2_BETA.EXECUTION_REPORTS"
- db2 "select * from LOG4DB2_APPENDERS.REPORT_TESTS"
- db2 "select * from LOG4DB2_APPENDERS_IMPLEMENTATION.REPORT_TESTS"
- db2 "select * from LOG4DB2_CACHE_CONFIGURATION.REPORT_TESTS"
- db2 "select * from LOG4DB2_CACHE_LEVELS.REPORT_TESTS"
- db2 "select * from LOG4DB2_CACHE_LOGGERS.REPORT_TESTS"
- db2 "select * from LOG4DB2_CASCADE_CALL_LIMIT.REPORT_TESTS"
- db2 "select * from LOG4DB2_CONF_APPENDERS.REPORT_TESTS"
- db2 "select * from LOG4DB2_CONFIGURATION.REPORT_TESTS"
- db2 "select * from LOG4DB2_CONF_LOGGERS.REPORT_TESTS"
- db2 "select * from LOG4DB2_CONF_LOGGERS_DELETE.REPORT_TESTS"
- db2 "select * from LOG4DB2_CONF_LOGGERS_EFFECTIVE.REPORT_TESTS"
- db2 "select * from LOG4DB2_CONF_LOGGERS_EFFECTIVE_CASES.REPORT_TESTS"
- db2 "select * from LOG4DB2_DYNAMIC_APPENDERS.REPORT_TESTS"
- db2 "select * from LOG4DB2_FUNCTION_GET_DEFINED_PARENT_LOGGER.REPORT_TESTS"
- db2 "select * from LOG4DB2_GET_LOGGER.REPORT_TESTS"
- db2 "select * from LOG4DB2_GET_LOGGER_NAME.REPORT_TESTS"
- db2 "select * from LOG4DB2_HIERARCHY.REPORT_TESTS"
- db2 "select * from LOG4DB2_LAYOUT.REPORT_TESTS"
- db2 "select * from LOG4DB2_LEVELS.REPORT_TESTS"
- db2 "select * from LOG4DB2_LOGS.REPORT_TESTS"
- db2 "select * from LOG4DB2_MESSAGES.REPORT_TESTS"
- db2 "select * from LOG4DB2_REFERENCES.REPORT_TESTS"
- db2 "export to /tmp/sorts.txt of del select * from db2unit_1.sorts" ; cat /tmp/sorts.txt