-
Notifications
You must be signed in to change notification settings - Fork 182
Expand file tree
/
Copy pathgenerate-shared.php
More file actions
241 lines (226 loc) · 9.91 KB
/
Copy pathgenerate-shared.php
File metadata and controls
241 lines (226 loc) · 9.91 KB
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<?php
include "generate-common.php";
$switch_php_versions = ["debug", "debug-zts-asan", "nts", "zts"];
?>
stages:
- build
- test
"C components ASAN":
tags: [ "arch:amd64" ]
stage: test
image: "registry.ddbuild.io/ci/dd-trace-php/dd-trace-ci:${IMAGE}"
needs: []
parallel:
matrix:
- IMAGE:
- "centos-7"
- "php-compile-extension-alpine"
- "bookworm-10"
script:
- if [ -f "/opt/libuv/lib/pkgconfig/libuv.pc" ]; then export PKG_CONFIG_PATH="/opt/libuv/lib/pkgconfig:$PKG_CONFIG_PATH"; fi
- if [ -d "/opt/catch2" ]; then export CMAKE_PREFIX_PATH=/opt/catch2; fi
- mkdir -p tmp/build_php_components_asan && cd tmp/build_php_components_asan
- cmake $([ -f "/etc/debian_version" ] && echo "-DCMAKE_TOOLCHAIN_FILE=../../cmake/asan.cmake") -DCMAKE_BUILD_TYPE=Debug -DDATADOG_PHP_TESTING=ON ../../components
- make -j all
- mkdir -p "${CI_PROJECT_DIR}/artifacts"
- make test ARGS="--output-junit ${CI_PROJECT_DIR}/artifacts/components-asan-results.xml --output-on-failure"
after_script:
- mkdir -p tmp/artifacts
- cp tmp/build_php_components_asan/Testing/Temporary/LastTest.log tmp/artifacts/LastTestASan.log
- .gitlab/silent-upload-junit-to-datadog.sh "test.source.file:components-rs"
artifacts:
reports:
junit: "artifacts/*-results.xml"
paths:
- tmp/artifacts
- artifacts
when: "always"
"C components UBSAN":
tags: [ "arch:amd64" ]
stage: test
image: "registry.ddbuild.io/ci/dd-trace-php/dd-trace-ci:bookworm-10"
needs: []
script:
- if [ -f "/opt/libuv/lib/pkgconfig/libuv.pc" ]; then export PKG_CONFIG_PATH="/opt/libuv/lib/pkgconfig:$PKG_CONFIG_PATH"; fi
- mkdir -p tmp/build_php_components_ubsan && cd tmp/build_php_components_ubsan
- CMAKE_PREFIX_PATH=/opt/catch2 cmake -DCMAKE_TOOLCHAIN_FILE=../../cmake/ubsan.cmake -DCMAKE_BUILD_TYPE=Debug -DDATADOG_PHP_TESTING=ON ../../components
- make -j all
- mkdir -p "${CI_PROJECT_DIR}/artifacts"
- make test ARGS="--output-junit ${CI_PROJECT_DIR}/artifacts/components-ubsan-results.xml --output-on-failure --repeat until-fail:10" # channel is non-deterministic, so run tests a few more times. At the moment, Catch2 tests are not automatically adding labels, so run all tests instead of just channel's: https://github.com/catchorg/Catch2/issues/1590
after_script:
- mkdir -p tmp/artifacts
- cp tmp/build_php_components_ubsan/Testing/Temporary/LastTest.log tmp/artifacts/LastTestUBSan.log
- .gitlab/silent-upload-junit-to-datadog.sh "test.source.file:components-rs"
artifacts:
reports:
junit: "artifacts/*-results.xml"
paths:
- tmp/artifacts
- artifacts
when: "always"
"Build & Test Tea":
tags: [ "arch:amd64" ]
stage: build
image: "registry.ddbuild.io/ci/dd-trace-php/dd-trace-ci:php-${PHP_MAJOR_MINOR}_bookworm-10"
parallel:
matrix:
- PHP_MAJOR_MINOR: *no_asan_minor_major_targets
SWITCH_PHP_VERSION: <?= str_replace("-asan", "", json_encode($switch_php_versions)), "\n" ?>
- PHP_MAJOR_MINOR: *asan_minor_major_targets
SWITCH_PHP_VERSION: <?= json_encode($switch_php_versions), "\n" ?>
script:
- sh .gitlab/build-tea.sh $SWITCH_PHP_VERSION
- cd tmp/build-tea-${SWITCH_PHP_VERSION}
- mkdir -p "${CI_PROJECT_DIR}/artifacts"
- make test ARGS="--output-junit ${CI_PROJECT_DIR}/artifacts/tea-${SWITCH_PHP_VERSION}-results.xml --output-on-failure"
- grep -e "=== Total [0-9]+ memory leaks detected ===" Testing/Temporary/LastTest.log && exit 1 || true
after_script:
- mkdir -p tmp/artifacts/
- cp tmp/build-tea-${SWITCH_PHP_VERSION}/Testing/Temporary/LastTest.log tmp/artifacts/LastTest.log
- .gitlab/silent-upload-junit-to-datadog.sh "test.source.file:zend_abstract_interface"
artifacts:
reports:
junit: "artifacts/*-results.xml"
paths:
- tmp/tea
- tmp/artifacts
- artifacts
when: "always"
.tea_test:
tags: [ "arch:amd64" ]
stage: test
image: "registry.ddbuild.io/ci/dd-trace-php/dd-trace-ci:php-${PHP_MAJOR_MINOR}_bookworm-10"
interruptible: true
rules:
- if: $CI_COMMIT_BRANCH == "master"
interruptible: false
- when: on_success
after_script:
- mkdir -p tmp/artifacts
- cp tmp/build*/Testing/Temporary/LastTest.log tmp/artifacts/LastTest.log
- .gitlab/silent-upload-junit-to-datadog.sh "test.source.file:zend_abstract_interface"
artifacts:
reports:
junit: "artifacts/*-results.xml"
paths:
- tmp/artifacts
- artifacts
when: "always"
"Configuration Consistency":
tags: [ "arch:amd64" ]
stage: test
needs: []
variables:
PHP_MAJOR_MINOR: "<?= $all_minor_major_targets[count($all_minor_major_targets) - 1] ?>"
image: "registry.ddbuild.io/ci/dd-trace-php/dd-trace-ci:php-${PHP_MAJOR_MINOR}_bookworm-10"
script:
- |
if ! command -v cc >/dev/null 2>&1 && ! command -v clang >/dev/null 2>&1 && ! command -v gcc >/dev/null 2>&1; then
sudo apt-get update
sudo apt-get install -y build-essential
fi
- |
GENERATED_CONFIG_INPUTS="$(bash tooling/generate-supported-configurations.sh --print-input-files | tr '\n' ' ')"
BASELINE_CONFIG="$(mktemp)"
trap 'rm -f "$BASELINE_CONFIG"' EXIT
cp metadata/supported-configurations.json "$BASELINE_CONFIG"
bash tooling/generate-supported-configurations.sh --self-test
bash tooling/generate-supported-configurations.sh
if ! cmp -s "$BASELINE_CONFIG" metadata/supported-configurations.json; then
echo "ERROR: @metadata/supported-configurations.json got out of sync with implemented configurations. Please run tooling/generate-supported-configurations.sh locally."
echo "Generator inputs: $GENERATED_CONFIG_INPUTS"
diff -u "$BASELINE_CONFIG" metadata/supported-configurations.json || true
exit 1
fi
<?php
foreach ($all_minor_major_targets as $major_minor):
foreach ($switch_php_versions as $switch_php_version):
$toolchain = "";
if (version_compare($major_minor, "7.4", "<") && $switch_php_version == "debug-zts-asan") $switch_php_version = "debug-zts";
if ($switch_php_version == "debug-zts-asan") $toolchain="-DCMAKE_TOOLCHAIN_FILE=../../cmake/asan.cmake";
# PHP itself is only really ubsan compatible since 7.4
if ($switch_php_version == "debug" && version_compare($switch_php_version, "7.4", ">=")) $toolchain="-DCMAKE_TOOLCHAIN_FILE=../../cmake/ubsan.cmake";
?>
"Zend Abstract Interface Tests: [<?= $major_minor ?>, <?= $switch_php_version ?>]":
extends: .tea_test
variables:
PHP_MAJOR_MINOR: "<?= $major_minor ?>"
<?php if ($switch_php_version == "debug-zts-asan"): ?>
ASAN_OPTIONS: "detect_stack_use_after_return=0"
<?php endif; ?>
needs:
- job: "Build & Test Tea"
parallel:
matrix:
- PHP_MAJOR_MINOR: "<?= $major_minor ?>"
SWITCH_PHP_VERSION: "<?= $switch_php_version ?>"
artifacts: true
script:
- switch-php "<?= $switch_php_version ?>"
- mkdir -p tmp/build_zai && cd tmp/build_zai
- CMAKE_PREFIX_PATH=/opt/catch2 Tea_ROOT=../../tmp/tea/<?= $switch_php_version ?> cmake <?= $toolchain ?> -DCMAKE_BUILD_TYPE=Debug -DBUILD_ZAI_TESTING=ON -DPhpConfig_ROOT=$(php-config --prefix) ../../zend_abstract_interface
- make -j all
- mkdir -p "${CI_PROJECT_DIR}/artifacts"
- make test ARGS="--output-junit ${CI_PROJECT_DIR}/artifacts/zai-<?= $major_minor ?>-<?= $switch_php_version ?>-results.xml --output-on-failure"
- grep -e "=== Total [0-9]+ memory leaks detected ===" Testing/Temporary/LastTest.log && exit 1 || true
<?php
endforeach;
endforeach;
?>
<?php
foreach (["7.4", "8.0"] as $major_minor):
?>
"ZAI Shared Tests: [<?= $major_minor ?>]":
extends: .tea_test
image: "registry.ddbuild.io/ci/dd-trace-php/dd-trace-ci:php-<?= $major_minor ?>-shared-ext-10"
needs:
- job: "Build & Test Tea"
parallel:
matrix:
- PHP_MAJOR_MINOR: "<?= $major_minor ?>"
SWITCH_PHP_VERSION: nts
artifacts: true
script:
- switch-php nts
<?php if (version_compare($major_minor, "7.4", "<=")): ?>
- echo "extension=json.so" | sudo tee $(php -i | awk -F"=> " '/Scan this dir for additional .ini files/ {print $2}')/json.ini
<?php endif; ?>
- echo "extension=curl.so" | sudo tee $(php -i | awk -F"=> " '/Scan this dir for additional .ini files/ {print $2}')/curl.ini
- mkdir -p tmp/build_zai && cd tmp/build_zai
- CMAKE_PREFIX_PATH=/opt/catch2 Tea_ROOT=../../tmp/tea/nts cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_ZAI_TESTING=ON -DRUN_SHARED_EXTS_TESTS=1 -DPhpConfig_ROOT=$(php-config --prefix) ../../zend_abstract_interface
- make -j all
- TEA_INI_IGNORE=0 make test
- grep -e "=== Total [0-9]+ memory leaks detected ===" Testing/Temporary/LastTest.log && exit 1 || true
<?php
endforeach;
?>
<?php
foreach ($all_minor_major_targets as $major_minor):
foreach ($switch_php_versions as $switch_php_version):
$toolchain = "";
if (version_compare($major_minor, "7.4", "<") && $switch_php_version == "debug-zts-asan") $switch_php_version = "debug-zts";
if ($switch_php_version == "debug-zts-asan") $toolchain="-DCMAKE_TOOLCHAIN_FILE=../../cmake/asan.cmake";
?>
"Extension Tea Tests: [<?= $major_minor ?>, <?= $switch_php_version ?>]":
extends: .tea_test
variables:
PHP_MAJOR_MINOR: "<?= $major_minor ?>"
needs:
- job: "Build & Test Tea"
parallel:
matrix:
- PHP_MAJOR_MINOR: "<?= $major_minor ?>"
SWITCH_PHP_VERSION: "<?= $switch_php_version ?>"
artifacts: true
script:
- switch-php "<?= $switch_php_version ?>"
- make install # build ddtrace.so
- mkdir -p tmp/build_ext-tea && cd tmp/build_ext-tea
- CMAKE_PREFIX_PATH=/opt/catch2 Tea_ROOT=../../tmp/tea/<?= $switch_php_version ?> cmake <?= $toolchain ?> -DCMAKE_BUILD_TYPE=Debug -S ../../tests/tea
- cmake --build . --parallel
- make test ARGS="--output-on-failure"
- grep -e "=== Total [0-9]+ memory leaks detected ===" Testing/Temporary/LastTest.log && exit 1 || true
<?php
endforeach;
endforeach;
?>