summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvoisin2017-09-21 16:19:44 +0200
committerjvoisin2017-09-22 17:45:32 +0200
commit3ba2b7e37cb24f951f557c4a4f62920154a7c0d2 (patch)
treec904d0acf0e7eddb0a3697baff59cc237a7d6250
parent6487590b4fd55dddd59b43f1fcf2ebd8d56f20ac (diff)
Improve a bit the .travis.yml file
-rw-r--r--.travis.yml24
-rw-r--r--Makefile7
-rw-r--r--src/config.m413
-rw-r--r--src/sp_utils.c7
4 files changed, 29 insertions, 22 deletions
diff --git a/.travis.yml b/.travis.yml
index 057c080..0a14f8f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,21 +3,25 @@ language: php
3php: 3php:
4 - '7.0' 4 - '7.0'
5 - '7.1' 5 - '7.1'
6 6 - '7.2'
7env: 7 - nightly
8 - CC=gcc
9 - CC=clang
10 8
11addons: 9addons:
12 apt: 10 apt:
13 packages: 11 packages:
14 - gdb
15 - gcc 12 - gcc
16 - lcov 13 - lcov
17 - valgrind
18 - libpcre3
19 - libpcre3-dev
20 14
21script: 15script:
22 - php-config --configure-options 16 - cd src
23 - make debug 17 - phpize
18 - ./configure --enable-snuffleupagus --enable-coverage
19 - make
20 - make test
21
22after_success:
23 - git clone https://github.com/linux-test-project/lcov.git --depth 1
24 - ./lcov/bin/lcov -c -o ./COV.info --rc lcov_branch_coverage=1 --base-directory . --directory .
25 - ./lcov/bin/lcov --remove ./COV.info '/usr/*' --remove ./COV.info '*tweetnacl.c' -o ./COV.info --rc lcov_branch_coverage=1
26 - ./lcov/bin/genhtml -o ./COV.html ./COV.info --branch-coverage
27 - bash <(curl -s https://codecov.io/bash)
diff --git a/Makefile b/Makefile
index 040809e..117fe80 100644
--- a/Makefile
+++ b/Makefile
@@ -10,13 +10,12 @@ debug:
10 10
11coverage: 11coverage:
12 cd src; phpize 12 cd src; phpize
13 export CFLAGS="--coverage -fprofile-arcs -ftest-coverage -O0"; export LDFLAGS="--coverage"; cd src; ./configure --enable-snuffleupagus --enable-coverage 13 export CFLAGS="--coverage"; cd src; ./configure --enable-snuffleupagus --enable-coverage
14 make -C src 14 make -C src
15 lcov --base-directory src --directory ./src --zerocounters -q --rc lcov_branch_coverage=1
16 rm -Rf src/COV.html 15 rm -Rf src/COV.html
17 TEST_PHP_ARGS='-q' REPORT_EXIT_STATUS=1 make -C src test 16 TEST_PHP_ARGS='-q' REPORT_EXIT_STATUS=1 make -C src test
18 lcov --base-directory ./src --directory src -c -o ./src/COV.info --rc lcov_branch_coverage=1 2>/dev/null 1>/dev/null 17 lcov --base-directory ./src --directory ./src -c -o ./src/COV.info --rc lcov_branch_coverage=1
19 lcov --remove src/COV.info '/usr/*' --remove src/COV.info '*tweetnacl.c' -o src/COV.info --rc lcov_branch_coverage=1 2>/dev/null 1>/dev/null 18 lcov --remove src/COV.info '/usr/*' --remove src/COV.info '*tweetnacl.c' -o src/COV.info --rc lcov_branch_coverage=1
20 genhtml -o src/COV.html ./src/COV.info --branch-coverage 19 genhtml -o src/COV.html ./src/COV.info --branch-coverage
21 20
22tests: joomla 21tests: joomla
diff --git a/src/config.m4 b/src/config.m4
index 84ca2f4..4f70871 100644
--- a/src/config.m4
+++ b/src/config.m4
@@ -19,8 +19,9 @@ PHP_ARG_ENABLE(debug, whether to enable debug messages,
19CFLAGS="$CFLAGS -lpcre" 19CFLAGS="$CFLAGS -lpcre"
20CFLAGS="$CFLAGS -D_DEFAULT_SOURCE=1 -std=c99" 20CFLAGS="$CFLAGS -D_DEFAULT_SOURCE=1 -std=c99"
21CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused-parameter" 21CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused-parameter"
22CFLAGS="$CFLAGS --coverage"
22 23
23LFLAGS="$LFLAGS -lpcre" 24LDFLAGS="$LDFLAGS -lpcre --coverage"
24 25
25if test "$PHP_DEBUG" = "yes"; then 26if test "$PHP_DEBUG" = "yes"; then
26 AC_DEFINE(SP_DEBUG, 1, [Wether you want to enable debug messages]) 27 AC_DEFINE(SP_DEBUG, 1, [Wether you want to enable debug messages])
@@ -28,12 +29,14 @@ fi
28 29
29AC_CHECK_LIB(pcre, pcre_compile, AC_DEFINE(HAVE_PCRE, 1, [have pcre])) 30AC_CHECK_LIB(pcre, pcre_compile, AC_DEFINE(HAVE_PCRE, 1, [have pcre]))
30 31
31if test "$PHP_SNUFFLEUPAGUS" != "no"; then 32if test "$PHP_SNUFFLEUPAGUS" = "yes"; then
32 if test "$PHP_COVERAGE" != "no"; then 33 if test "$PHP_COVERAGE" = "yes"; then
33 CFLAGS="$CFLAGS --coverage -fprofile-arcs -ftest-coverage" 34 CFLAGS="$CFLAGS --coverage"
34 LDFLAGS="$LDFLAGS --coverage" 35 LDFLAGS="$LDFLAGS --coverage"
35 PHP_NEW_EXTENSION(snuffleupagus, $sources, $ext_shared,-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -g -fprofile-arcs -ftest-coverage -lgcov) 36 PHP_NEW_EXTENSION(snuffleupagus, $sources, $ext_shared,-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -g --coverage -lgcov)
36 else 37 else
38 CFLAGS="$CFLAGS --coverage"
39 LDFLAGS="$LDFLAGS --coverage"
37 PHP_NEW_EXTENSION(snuffleupagus, $sources, $ext_shared,-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) 40 PHP_NEW_EXTENSION(snuffleupagus, $sources, $ext_shared,-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
38 fi 41 fi
39fi 42fi
diff --git a/src/sp_utils.c b/src/sp_utils.c
index 56512df..2370a6d 100644
--- a/src/sp_utils.c
+++ b/src/sp_utils.c
@@ -39,7 +39,7 @@ int compute_hash(const char* const filename, char* file_hash) {
39 php_stream_open_wrapper(filename, "rb", REPORT_ERRORS, NULL); 39 php_stream_open_wrapper(filename, "rb", REPORT_ERRORS, NULL);
40 if (!stream) { 40 if (!stream) {
41 sp_log_err("hash_computation", "Can not open the file %s to compute its hash.\n", filename); 41 sp_log_err("hash_computation", "Can not open the file %s to compute its hash.\n", filename);
42 return -1; 42 return FAILURE;
43 } 43 }
44 44
45 PHP_SHA256Init(&context); 45 PHP_SHA256Init(&context);
@@ -49,7 +49,7 @@ int compute_hash(const char* const filename, char* file_hash) {
49 PHP_SHA256Final(digest, &context); 49 PHP_SHA256Final(digest, &context);
50 php_stream_close(stream); 50 php_stream_close(stream);
51 make_digest_ex(file_hash, digest, SHA256_SIZE); 51 make_digest_ex(file_hash, digest, SHA256_SIZE);
52 return 0; 52 return SUCCESS;
53} 53}
54 54
55static void construct_filename(char* filename, const char* folder) { 55static void construct_filename(char* filename, const char* folder) {
@@ -123,7 +123,7 @@ int sp_log_request(const char* folder) {
123 123
124 // Allocate and copy the data 124 // Allocate and copy the data
125 // FIXME Why are we even allocating? 125 // FIXME Why are we even allocating?
126 param = pecalloc(params_len, 1, 0); 126 param = ecalloc(params_len, 1);
127 NCAT_AND_DEC(param, zones[i].str, params_len); 127 NCAT_AND_DEC(param, zones[i].str, params_len);
128 NCAT_AND_DEC(param, ":", params_len); 128 NCAT_AND_DEC(param, ":", params_len);
129 ZEND_HASH_FOREACH_STR_KEY_VAL(ht, variable_key, variable_value) { 129 ZEND_HASH_FOREACH_STR_KEY_VAL(ht, variable_key, variable_value) {
@@ -138,6 +138,7 @@ int sp_log_request(const char* folder) {
138 138
139 fputs(param, file); 139 fputs(param, file);
140 fputs("\n", file); 140 fputs("\n", file);
141 efree(param);
141 } 142 }
142 fclose(file); 143 fclose(file);
143 144