[CI] Add the `-no_warn_duplicate_libraries` ldflag when running inv test on `XCode >15`
What does this PR do?
This PR adds the -no_warn_duplicate_libraries flag when running inv test on XCode >15.
Motivation
If you currently run the inv test invoke task on a MacOS machine with XCode 15 you’ll encounter some warning messages. Warnings should in theory be fine but we’re using gotestsum which is handling warning as errors, breaking its run [1]. Examples:
> inv -e test --rerun-fails=2 --coverage
=== FAIL: comp/trace/config TestMockConfig (2.29s)
writer.go:40: [Fx] ...
config_test.go:2526:
Error Trace: /Users/alexandre.menasria/datadog-agent/comp/trace/config/config_test.go:2526
Error: Should not be: "foo"
Test: TestMockConfig
=== Errors
ld: warning: ignoring duplicate libraries: '-ldatadog-agent-rtloader', '-ldl'
...
ld: warning: ignoring duplicate libraries: '-ldatadog-agent-rtloader', '-ldl'
> inv -e test --rerun-fails=2 --coverage
Using default modules and targets
--- Setting rtloader paths to lib:/Users/alexandre.menasria/datadog-agent/dev/lib | header:/Users/alexandre.menasria/datadog-agent/dev/include | common headers:
--- Flavor base: unit tests
----- Module '/Users/alexandre.menasria/datadog-agent'
cd /Users/alexandre.menasria/datadog-agent && gotestsum --jsonfile "module_test_output.json" --format pkgname --rerun-fails=2 --packages="./pkg/... ./cmd/... ./comp/..." --raw-command /Users/alexandre.menasria/datadog-agent/test_with_coverage.sh -- -mod=mod -tags "kubelet ec2 oracle apm clusterchecks kubeapiserver consul jmx process gce fargateprocess python test orchestrator etcd otlp zlib zk" -gcflags="" -ldflags="-X github.com/DataDog/datadog-agent/pkg/version.Commit=165f0d4a19 -X github.com/DataDog/datadog-agent/pkg/version.AgentVersion=7.53.0-devel+git.191.165f0d4 -X github.com/DataDog/datadog-agent/pkg/serializer.AgentPayloadVersion=v5.0.105 -X github.com/DataDog/datadog-agent/pkg/config/setup.ForceDefaultPython=true -X github.com/DataDog/datadog-agent/pkg/config/setup.DefaultPython=3 -r /Users/alexandre.menasria/datadog-agent/dev/lib '-extldflags=-Wl,-bind_at_load ' " -vet=off -timeout 180s -short -covermode=count
✓ pkg/aggregator (6.615s) (coverage: 67.5% of statements)
✓ pkg/aggregator/internal/tags (683ms) (coverage: 91.4% of statements)
✓ pkg/aggregator/internal/util (328ms) (coverage: 100.0% of statements)
✓ pkg/aggregator/mocksender (744ms) (coverage: 61.7% of statements)
∅ pkg/aggregator/sender
✓ pkg/autodiscovery (1.051s) (coverage: 70.7% of statements)
✓ pkg/autodiscovery/common/types (312ms) (coverage: 46.3% of statements)
✓ pkg/autodiscovery/common/utils (686ms) (coverage: 84.1% of statements)
✓ pkg/autodiscovery/configresolver (776ms) (coverage: 87.5% of statements)
✓ pkg/autodiscovery/integration (339ms) (coverage: 64.0% of statements)
✓ pkg/autodiscovery/listeners (3.006s) (coverage: 41.7% of statements)
∅ pkg/autodiscovery/providers/names
✓ pkg/autodiscovery/scheduler (680ms) (coverage: 80.0% of statements)
∅ pkg/autodiscovery/telemetry
∅ pkg/cli/standalone
# github.com/DataDog/datadog-agent/pkg/cli/subcommands/check.test
ld: warning: ignoring duplicate libraries: '-ldatadog-agent-rtloader', '-ldl'
✓ pkg/cli/subcommands/check (1.03s) (coverage: 12.4% of statements)
✓ pkg/autodiscovery/providers (6.094s) (coverage: 60.8% of statements)
# github.com/DataDog/datadog-agent/pkg/cli/subcommands/clusterchecks.test
ld: warning: ignoring duplicate libraries: '-ldatadog-agent-rtloader', '-ldl'
✓ pkg/cli/subcommands/clusterchecks (882ms) (coverage: 26.2% of statements)
✓ pkg/cli/subcommands/config (1.238s) (coverage: 20.3% of statements)
# github.com/DataDog/datadog-agent/pkg/cli/subcommands/dcaconfigcheck.test
ld: warning: ignoring duplicate libraries: '-ldatadog-agent-rtloader', '-ldl'
# github.com/DataDog/datadog-agent/pkg/cli/subcommands/dcaflare.test
ld: warning: ignoring duplicate libraries: '-ldatadog-agent-rtloader', '-ldl'
✓ pkg/cli/subcommands/dcaconfigcheck (897ms) (coverage: 85.7% of statements)
This most likely happens because the -ldl and -ldatadig-agent-rtloader flags are added in several places (e.g in pkg/collector/python/aggregator.go and in pkg/collector/python/datadog_agent.go).
From this article it seems that this warning was not silent anymore since Xcode 15.
[1] Runs are broken like this:
- If no test fails but the warning appears
gotestsumwill return an exit code != 0. - If a test fails and the warning appears
gotestsumwon’t rerun the test (because it doesn’t rerun on failure outside of the test).
Additional Notes
Possible Drawbacks / Trade-offs
Describe how to test/QA your changes
Bloop Bleep... Dogbot Here
Regression Detector Results
Run ID: 765e71c4-afe0-4e42-b894-6fa23fb1ad5a Baseline: d6a7e7927b96c58b1ca37d5a45453a1a457e3958 Comparison: 15893bcec33487d71f9d3eadf3d77bc225e9eb42
Performance changes are noted in the perf column of each table:
- ✅ = significantly better comparison variant performance
- ❌ = significantly worse comparison variant performance
- ➖ = no significant change in performance
No significant changes in experiment optimization goals
Confidence level: 90.00% Effect size tolerance: |Δ mean %| ≥ 5.00%
There were no significant changes in experiment optimization goals at this confidence level and effect size tolerance.
Experiments ignored for regressions
Regressions in experiments with settings containing erratic: true are ignored.
| perf | experiment | goal | Δ mean % | Δ mean % CI |
|---|---|---|---|---|
| ➖ | file_to_blackhole | % cpu utilization | +0.27 | [-6.30, +6.84] |
Fine details of change detection per experiment
| perf | experiment | goal | Δ mean % | Δ mean % CI |
|---|---|---|---|---|
| ➖ | uds_dogstatsd_to_api_cpu | % cpu utilization | +2.00 | [+0.54, +3.46] |
| ➖ | process_agent_standard_check | memory utilization | +0.78 | [+0.74, +0.83] |
| ➖ | file_to_blackhole | % cpu utilization | +0.27 | [-6.30, +6.84] |
| ➖ | file_tree | memory utilization | +0.20 | [+0.12, +0.28] |
| ➖ | trace_agent_json | ingress throughput | +0.02 | [-0.01, +0.05] |
| ➖ | trace_agent_msgpack | ingress throughput | +0.00 | [-0.01, +0.02] |
| ➖ | uds_dogstatsd_to_api | ingress throughput | +0.00 | [-0.00, +0.00] |
| ➖ | tcp_dd_logs_filter_exclude | ingress throughput | -0.00 | [-0.00, -0.00] |
| ➖ | process_agent_real_time_mode | memory utilization | -0.26 | [-0.31, -0.21] |
| ➖ | process_agent_standard_check_with_stats | memory utilization | -0.29 | [-0.34, -0.25] |
| ➖ | tcp_syslog_to_blackhole | ingress throughput | -0.67 | [-0.73, -0.62] |
| ➖ | idle | memory utilization | -0.86 | [-0.90, -0.82] |
| ➖ | otel_to_otel_logs | ingress throughput | -1.50 | [-2.15, -0.85] |
| ➖ | basic_py_check | % cpu utilization | -1.63 | [-3.81, +0.54] |
Explanation
A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".
For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:
-
Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.
-
Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.
-
Its configuration does not mark it "erratic".
Tested this locally and it worked properly, no more ld warnings 👍
/merge
:steam_locomotive: MergeQueue
Pull request added to the queue.
This build is going to start soon! (estimated merge in less than 27m)
Use /merge -c to cancel this operation!