forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbefore_script.sh
executable file
·72 lines (57 loc) · 2.47 KB
/
before_script.sh
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
#!/usr/bin/env bash
# Copyright © 2016 Magento. All rights reserved.
# See COPYING.txt for license details.
set -e
trap '>&2 echo Error: Command \`$BASH_COMMAND\` on line $LINENO failed with exit code $?' ERR
# prepare for test suite
case $TEST_SUITE in
integration)
cd dev/tests/integration
test_set_list=$(find testsuite/* -maxdepth 1 -mindepth 1 -type d | sort)
test_set_size=$(($(printf "$test_set_list" | wc -l)/INTEGRATION_SETS))
echo "==> preparing integration testsuite on index $INTEGRATION_INDEX with set size of $test_set_size"
cp phpunit.xml.dist phpunit.xml
# remove memory usage tests if from any set other than the first
if [[ $INTEGRATION_INDEX > 1 ]]; then
echo " - removing testsuite/Magento/MemoryUsageTest.php"
perl -pi -0e 's#^\s+<!-- Memory(.*?)</testsuite>\n##ims' phpunit.xml
fi
# divide test sets up by indexed testsuites
i=0; j=1
for test_set in $test_set_list; do
test_xml[j]+=" <directory suffix=\"Test.php\">$test_set</directory>\n"
if [[ $j -eq $INTEGRATION_INDEX ]]; then
echo " + including $test_set"
else
echo " - excluding $test_set"
fi
i=$((i+1))
if [ $i -eq $test_set_size ] && [ $j -lt $INTEGRATION_SETS ]; then
j=$((j+1))
i=0
fi
done
# replace test sets for current index into testsuite
perl -pi -e "s#\s+<directory.*>testsuite</directory>#${test_xml[INTEGRATION_INDEX]}#g" phpunit.xml
echo "==> testsuite preparation complete"
# create database and move db config into place
mysql -uroot -e '
SET @@global.sql_mode = NO_ENGINE_SUBSTITUTION;
CREATE DATABASE magento_integration_tests;
'
mv etc/install-config-mysql.travis.php.dist etc/install-config-mysql.php
cd ../../..
;;
static)
cd dev/tests/static
echo "==> preparing changed files list"
changed_files_ce="$TRAVIS_BUILD_DIR/dev/tests/static/testsuite/Magento/Test/_files/changed_files_ce.txt"
php get_github_changes.php \
--output-file="$changed_files_ce" \
--base-path="$TRAVIS_BUILD_DIR" \
--repo='https://github.com/magento/magento2.git' \
--branch='develop'
cat "$changed_files_ce" | sed 's/^/ + including /'
cd ../../..
;;
esac