Repository navigation
Extend system and bundled native library tests #447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
omajid
merged 1 commit into
redhat-developer:main
from
omajid:system-or-bundled-libraries
Nov 11, 2026
+372
−35
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 3 additions & 5 deletions
8
system-openssl/test.json → required-system-libraries/test.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,12 @@ | ||
| { | ||
| "name": "system-openssl", | ||
| "name": "required-system-libraries", | ||
| "enabled": true, | ||
| "requiresSdk": false, | ||
| "version": "2.1", | ||
| "version": "11.0", | ||
| "versionSpecific": false, | ||
| "type": "bash", | ||
| "cleanup": true, | ||
| "skipWhen": [ | ||
| "portable", // portable dlopen()s system openssl | ||
| ], | ||
| "ignoredRIDs":[ | ||
| "portable" // portable builds dlopen OpenSSL | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # Required system libraries | ||
| # | ||
| # This test checks the selected runtime's native libraries for direct ELF | ||
| # dependencies on system copies. | ||
| # | ||
| # These are the third-party libraries expected to be **directly linked** by | ||
| # these runtime binaries; platform libraries such as libc and the C++ runtime | ||
| # are not an exhaustive portability policy. | ||
|
|
||
| set -euo pipefail | ||
| IFS=$'\n\t' | ||
|
|
||
| framework_dir=$(../dotnet-directory --framework "$1") | ||
| dotnet_dir=$(realpath "$(../dotnet-directory)") | ||
| failed=0 | ||
|
|
||
| check_dependency() { | ||
| local file="$framework_dir/$1" library="$2" needed soname dependencies path | ||
| if [[ ! -f "$file" ]]; then | ||
| echo "FAIL: missing $file" | ||
| failed=1 | ||
| return | ||
| fi | ||
|
|
||
| # Check direct ELF dependencies, not just ldd's transitive dependencies: a | ||
| # transitive dependency does not prove that .NET uses the system library. | ||
| if ! needed=$(readelf -d "$file"); then | ||
| echo "FAIL: cannot read dependencies of $file" | ||
| failed=1 | ||
| return | ||
| fi | ||
| # Match the complete SONAME, including a possible ABI version. | ||
| soname=$(printf '%s\n' "$needed" | awk -v lib="$library" ' | ||
| /\(NEEDED\)/ { | ||
| name = $NF | ||
| gsub(/[][]/, "", name) | ||
| if (name == lib ".so" || index(name, lib ".so.") == 1) print name | ||
| }') | ||
| if [[ -z "$soname" || "$soname" == *$'\n'* ]]; then | ||
| echo "FAIL: $file must directly depend on $library.so (found: ${soname:-none})" | ||
| failed=1 | ||
| return | ||
| fi | ||
| if ! dependencies=$(ldd "$file"); then | ||
| echo "FAIL: ldd failed for $file" | ||
| failed=1 | ||
| return | ||
| fi | ||
| path=$(printf '%s\n' "$dependencies" | awk -v name="$soname" '$1 == name && $2 == "=>" {print $3}') | ||
| if [[ "$path" != /* || ! -e "$path" ]]; then | ||
| echo "FAIL: $soname is not resolved for $file" | ||
| failed=1 | ||
| return | ||
| fi | ||
| path=$(realpath "$path") | ||
| if [[ "$path" != /usr/* ]]; then | ||
| echo "FAIL: $soname resolves outside /usr: $path" | ||
| failed=1 | ||
| return | ||
| fi | ||
| if [[ "$path" == "$dotnet_dir" || "$path" == "$dotnet_dir/"* ]]; then | ||
| echo "FAIL: $soname resolves inside the .NET installation: $path" | ||
| failed=1 | ||
| return | ||
| fi | ||
| echo "PASS: $file directly links to system $soname ($path)" | ||
| } | ||
|
|
||
| # Source-built runtime dependencies which must not be statically bundled. | ||
| # brotli | ||
| check_dependency libSystem.IO.Compression.Native.so libbrotlidec | ||
| check_dependency libSystem.IO.Compression.Native.so libbrotlienc | ||
|
|
||
| # openssl | ||
| check_dependency libSystem.Security.Cryptography.Native.OpenSsl.so libcrypto | ||
| check_dependency libSystem.Security.Cryptography.Native.OpenSsl.so libssl | ||
|
|
||
| # zlib | ||
| check_dependency libSystem.IO.Compression.Native.so libz | ||
|
|
||
| # zstd | ||
| # Zstandard support was added in .NET 11. Compare major versions so that | ||
| # preview versions and future releases are covered too. | ||
| major_version=${1%%[!0-9]*} | ||
| if [[ -z "$major_version" ]]; then | ||
| echo "FAIL: cannot determine major version from $1" | ||
| failed=1 | ||
| elif (( 10#$major_version >= 11 )); then | ||
| check_dependency libSystem.IO.Compression.Native.so libzstd | ||
| fi | ||
|
|
||
| exit "$failed" |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was this deleted? Was it not supposed to be included?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "name": "system-or-bundled-libraries", | ||
| "enabled": true, | ||
| "requiresSdk": true, | ||
| "version": "11.0", | ||
| "versionSpecific": false, | ||
| "type": "bash", | ||
| "cleanup": true, | ||
| "skipWhen": [ | ||
| "os=alpine", // uses RPM specific packages | ||
| "vmr-ci" // uses packages | ||
| ], | ||
| "ignoredRIDs":[ | ||
| ] | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove .NET 8 and 9 from the matrix too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. Let me do a separate PR for that cleanup.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR is here: #44
Thanks!