Skip to content

Commit dc35f27

Browse files
authored
Merge branch 'master' into dubloom/process-tags-rc
2 parents a88c9cf + 8d49177 commit dc35f27

146 files changed

Lines changed: 14850 additions & 455 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/prof_correctness.yml

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
export DD_PROFILING_EXCEPTION_MESSAGE_ENABLED=1
8181
php -v
8282
php -d extension=target/profiler-release/libdatadog_php_profiling.so --ri datadog-profiling
83-
for test_case in "allocations" "time" "strange_frames" "timeline" "exceptions" "io"; do
83+
for test_case in "allocations" "time" "strange_frames" "timeline" "exceptions" "io" "allocation_time_combined"; do
8484
mkdir -p profiling/tests/correctness/"$test_case"/
8585
export DD_PROFILING_OUTPUT_PPROF=$PWD/profiling/tests/correctness/"$test_case"/test.pprof
8686
php -d extension="${PWD}/target/profiler-release/libdatadog_php_profiling.so" "profiling/tests/correctness/${test_case}.php"
@@ -98,7 +98,7 @@ jobs:
9898
export DD_PROFILING_EXCEPTION_MESSAGE_ENABLED=1
9999
php -v
100100
php -d extension=target/profiler-release/libdatadog_php_profiling.so --ri datadog-profiling
101-
for test_case in "allocations" "time" "strange_frames" "timeline" "exceptions" "io"; do
101+
for test_case in "allocations" "time" "strange_frames" "timeline" "exceptions" "io" "allocation_time_combined"; do
102102
mkdir -p profiling/tests/correctness/"$test_case"/
103103
export DD_PROFILING_OUTPUT_PPROF=$PWD/profiling/tests/correctness/"$test_case"/test.pprof
104104
php -d extension=$PWD/target/profiler-release/libdatadog_php_profiling.so profiling/tests/correctness/"$test_case".php
@@ -113,26 +113,6 @@ jobs:
113113
USE_ZEND_ALLOC=0 php -d extension=$PWD/target/profiler-release/libdatadog_php_profiling.so profiling/tests/correctness/allocations.php
114114
unset DD_PROFILING_ALLOCATION_SAMPLING_DISTANCE
115115
116-
- name: Run allocation_time_combined test (PHP 8.4+)
117-
if: fromJSON(matrix.php-version) >= 8.4
118-
run: |
119-
export DD_PROFILING_LOG_LEVEL=trace
120-
export DD_PROFILING_EXPERIMENTAL_FEATURES_ENABLED=1
121-
export DD_PROFILING_EXPERIMENTAL_EXCEPTION_SAMPLING_DISTANCE=1
122-
export DD_PROFILING_EXCEPTION_MESSAGE_ENABLED=1
123-
php -v
124-
php -d extension=target/profiler-release/libdatadog_php_profiling.so --ri datadog-profiling
125-
mkdir -p profiling/tests/correctness/allocation_time_combined/
126-
export DD_PROFILING_OUTPUT_PPROF=$PWD/profiling/tests/correctness/allocation_time_combined/test.pprof
127-
export DD_PROFILING_ALLOCATION_ENABLED=yes
128-
export DD_PROFILING_ALLOCATION_SAMPLING_DISTANCE=1
129-
export DD_PROFILING_WALL_TIME_ENABLED=yes
130-
export DD_PROFILING_EXPERIMENTAL_CPU_TIME_ENABLED=no
131-
export DD_PROFILING_ENDPOINT_COLLECTION_ENABLED=no
132-
export EXECUTION_TIME=5
133-
php -d extension=$PWD/target/profiler-release/libdatadog_php_profiling.so profiling/tests/correctness/allocation_time_combined.php
134-
unset DD_PROFILING_ALLOCATION_ENABLED DD_PROFILING_ALLOCATION_SAMPLING_DISTANCE DD_PROFILING_WALL_TIME_ENABLED DD_PROFILING_EXPERIMENTAL_CPU_TIME_ENABLED DD_PROFILING_ENDPOINT_COLLECTION_ENABLED EXECUTION_TIME
135-
136116
- name: Run ZTS tests
137117
if: matrix.phpts == 'zts'
138118
run: |
@@ -185,7 +165,6 @@ jobs:
185165
pprof_path: profiling/tests/correctness/timeline/
186166

187167
- name: Check profiler correctness for allocation_time_combined
188-
if: fromJSON(matrix.php-version) >= 8.4
189168
uses: Datadog/prof-correctness/analyze@main
190169
with:
191170
expected_json: profiling/tests/correctness/allocation_time_combined.json

.gitlab-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ appsec-trigger:
5757
strategy: depend
5858
variables:
5959
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
60-
GIT_SUBMODULE_PATHS: libdatadog appsec/third_party/cpp-base64 appsec/third_party/libddwaf appsec/third_party/msgpack-c
60+
GIT_SUBMODULE_PATHS: libdatadog appsec/third_party/cpp-base64 appsec/third_party/libddwaf appsec/third_party/libddwaf-rust appsec/third_party/msgpack-c
6161

6262
profiler-trigger:
6363
stage: tests
@@ -92,6 +92,6 @@ package-trigger:
9292
strategy: depend
9393
variables:
9494
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
95-
GIT_SUBMODULE_PATHS: libdatadog appsec/third_party/cpp-base64 appsec/third_party/libddwaf appsec/third_party/msgpack-c
95+
GIT_SUBMODULE_PATHS: libdatadog appsec/third_party/cpp-base64 appsec/third_party/libddwaf appsec/third_party/libddwaf-rust appsec/third_party/msgpack-c
9696
NIGHTLY_BUILD: $NIGHTLY_BUILD
9797
RELIABILITY_ENV_BRANCH: $RELIABILITY_ENV_BRANCH

.gitlab/add_final_status.xsl

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3+
4+
<!-- Identity transform: copy everything as-is by default -->
5+
<xsl:template match="@*|node()">
6+
<xsl:copy>
7+
<xsl:apply-templates select="@*|node()"/>
8+
</xsl:copy>
9+
</xsl:template>
10+
11+
<!-- For testcase elements missing dd_tags[test.final_status] inside their properties block -->
12+
<xsl:template match="testcase[not(properties/property[@name='dd_tags[test.final_status]'])]">
13+
<xsl:copy>
14+
<xsl:apply-templates select="@*"/>
15+
<xsl:variable name="status">
16+
<xsl:choose>
17+
<xsl:when test="failure or error">fail</xsl:when>
18+
<xsl:when test="skipped">skip</xsl:when>
19+
<xsl:otherwise>pass</xsl:otherwise>
20+
</xsl:choose>
21+
</xsl:variable>
22+
<xsl:choose>
23+
<xsl:when test="properties">
24+
<!-- Inject into existing properties block, preserving child order -->
25+
<xsl:for-each select="node()">
26+
<xsl:choose>
27+
<xsl:when test="self::properties">
28+
<properties>
29+
<xsl:apply-templates select="@*|node()"/>
30+
<property name="dd_tags[test.final_status]" value="{$status}"/>
31+
</properties>
32+
</xsl:when>
33+
<xsl:otherwise>
34+
<xsl:apply-templates select="."/>
35+
</xsl:otherwise>
36+
</xsl:choose>
37+
</xsl:for-each>
38+
</xsl:when>
39+
<xsl:otherwise>
40+
<!-- No properties block: create one before other children -->
41+
<properties>
42+
<property name="dd_tags[test.final_status]" value="{$status}"/>
43+
</properties>
44+
<xsl:apply-templates select="node()"/>
45+
</xsl:otherwise>
46+
</xsl:choose>
47+
</xsl:copy>
48+
</xsl:template>
49+
50+
</xsl:stylesheet>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
set -e -o pipefail
3+
4+
MAKE_JOBS=${MAKE_JOBS:-$(nproc)}
5+
6+
mkdir -p appsec_$(uname -m)
7+
8+
git config --global --add safe.directory '*'
9+
10+
cd appsec/helper-rust
11+
12+
export CARGO_TARGET_DIR=/tmp/cargo-target
13+
RUST_TARGET=$(uname -m)-unknown-linux-musl
14+
15+
# Build using nightly toolchain with unstable features
16+
# -Z build-std: Rebuild std library for musl
17+
# -Z build-std-features=llvm-libunwind: Use LLVM libunwind instead of libgcc_s
18+
cargo +nightly-"$RUST_TARGET" build \
19+
--release \
20+
-Zhost-config \
21+
-Ztarget-applies-to-host \
22+
--target "$RUST_TARGET"
23+
24+
# Remove musl libc dependency using patchelf (makes binary work on both musl and glibc)
25+
BINARY_PATH="/tmp/cargo-target/$RUST_TARGET/release/libddappsec_helper_rust.so"
26+
ARCH=$(uname -m)
27+
if [ "$ARCH" = "x86_64" ]; then
28+
patchelf --remove-needed libc.musl-x86_64.so.1 "$BINARY_PATH" 2>/dev/null || true
29+
elif [ "$ARCH" = "aarch64" ]; then
30+
patchelf --remove-needed libc.musl-aarch64.so.1 "$BINARY_PATH" 2>/dev/null || true
31+
fi
32+
33+
# Copy to output
34+
cp -v "$BINARY_PATH" "../../appsec_$(uname -m)/libddappsec-helper-rust.so"
35+
36+
# Run tests
37+
cargo +nightly-"$RUST_TARGET" test \
38+
--release \
39+
-Zhost-config \
40+
-Ztarget-applies-to-host \
41+
--target "$RUST_TARGET"

0 commit comments

Comments
 (0)