Skip to content

Commit 628b55d

Browse files
committed
Support Travis-CI.
- Add Makefile.local to fix make test's exit status.
1 parent ec8b884 commit 628b55d

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
extension/*
22
!extension/config.m4
3+
!extension/Makefile.local
34
!extension/php_xhprof.h
45
!extension/tests/
56
!extension/xhprof.c

.travis.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
language: php
2+
3+
notifications:
4+
email: false
5+
6+
php:
7+
- 5.5
8+
- 5.4
9+
- 5.3
10+
- 5.3.3
11+
12+
env:
13+
global:
14+
- TEST_PHP_ARGS="-q"
15+
- REPORT_EXIT_STATUS=1
16+
17+
before_script:
18+
- cd extension
19+
- phpize
20+
- ./configure
21+
- make -j4
22+
23+
script: make -f Makefile.local test_with_exit_status

extension/Makefile.local

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
include Makefile
2+
3+
GOODPHP = $(shell $(PHP_EXECUTABLE) -r 'echo version_compare(phpversion(), "5.5.0", ">=");')
4+
ifeq ($(GOODPHP), 1)
5+
TESTTARGET = test
6+
else
7+
TESTTARGET = test_from_php55
8+
endif
9+
10+
test_with_exit_status: $(TESTTARGET)
11+
12+
# Fixed test target from PHP 5.5.
13+
test_from_php55:
14+
@if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
15+
INI_FILE=`$(PHP_EXECUTABLE) -d 'display_errors=stderr' -r 'echo php_ini_loaded_file();' 2> /dev/null`; \
16+
if test "$$INI_FILE"; then \
17+
$(EGREP) -h -v $(PHP_DEPRECATED_DIRECTIVES_REGEX) "$$INI_FILE" > $(top_builddir)/tmp-php.ini; \
18+
else \
19+
echo > $(top_builddir)/tmp-php.ini; \
20+
fi; \
21+
INI_SCANNED_PATH=`$(PHP_EXECUTABLE) -d 'display_errors=stderr' -r '$$a = explode(",\n", trim(php_ini_scanned_files())); echo $$a[0];' 2> /dev/null`; \
22+
if test "$$INI_SCANNED_PATH"; then \
23+
INI_SCANNED_PATH=`$(top_srcdir)/build/shtool path -d $$INI_SCANNED_PATH`; \
24+
$(EGREP) -h -v $(PHP_DEPRECATED_DIRECTIVES_REGEX) "$$INI_SCANNED_PATH"/*.ini >> $(top_builddir)/tmp-php.ini; \
25+
fi; \
26+
TEST_PHP_EXECUTABLE=$(PHP_EXECUTABLE) \
27+
TEST_PHP_SRCDIR=$(top_srcdir) \
28+
CC="$(CC)" \
29+
$(PHP_EXECUTABLE) -n -c $(top_builddir)/tmp-php.ini $(PHP_TEST_SETTINGS) $(top_srcdir)/run-tests.php -n -c $(top_builddir)/tmp-php.ini -d extension_dir=$(top_builddir)/modules/ $(PHP_TEST_SHARED_EXTENSIONS) $(TESTS); \
30+
TEST_RESULT_EXIT_CODE=$$?; \
31+
rm $(top_builddir)/tmp-php.ini; \
32+
exit $$TEST_RESULT_EXIT_CODE; \
33+
else \
34+
echo "ERROR: Cannot run tests without CLI sapi."; \
35+
fi

0 commit comments

Comments
 (0)