Compare commits

..

8 Commits

Author SHA1 Message Date
WebFreak001 1498ef1c1c update CI 2025-10-18 22:15:27 +02:00
WebFreak001 a739fffce0 generate OSX ARM binaries 2025-10-18 22:15:27 +02:00
Andrei Horodniceanu bd139c63d5 tests/extra/tc_ufcs_all_kinds: enforce a consistent locale
gdc can output error messages in the system language which can break
the regex mactches the code relies on.

Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
2025-10-18 14:48:58 +02:00
Andrei Horodniceanu c79850d38e dsymbol/tests.d: Increase memory threshold approximation
out of 200 runs 26 were above the current 5000 threshold, with the
highest being 5279.

Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
2025-10-18 14:48:58 +02:00
Andrei Horodniceanu 3b1f0abfd8 CI: test gdc
Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
2025-10-18 14:48:58 +02:00
Andrei Horodniceanu 45117876d8 tests/extra/tc_ufcs_all_kinds: support gdc
Change the format in which errors are printed to keep it consistent
across all the three major compilers (a style that they all support is
the gnu style) and make the matching code in generate_tests.d more
readable by using a regex.

Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
2025-10-18 14:48:58 +02:00
Andrei Horodniceanu dd28e52ec1 CI: use setup-dlang v2
Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
2025-10-18 14:48:58 +02:00
Andrei Horodniceanu 264c5ef6a9 CI: update ubuntu version
ubuntu-20.04 has been retired

Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
2025-10-18 14:48:58 +02:00
10 changed files with 84 additions and 35 deletions

View File

@ -5,3 +5,8 @@ indent_size = 4
tab_width = 4 tab_width = 4
trim_trailing_whitespace = true trim_trailing_whitespace = true
indent_style = tab indent_style = tab
[.github/workflows/*.yml]
indent_size = 2
tab_width = 2
indent_style = space

View File

@ -12,7 +12,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
# use older ubuntu / linux version for glibc compatibility # use older ubuntu / linux version for glibc compatibility
os: [ubuntu-20.04, windows-latest, macos-latest] os: [ubuntu-22.04, windows-latest]
dc: dc:
- ldc-latest - ldc-latest
- dmd-latest - dmd-latest
@ -27,20 +27,48 @@ jobs:
dc: ldc-latest dc: ldc-latest
build: debug build: debug
libdparse-version: min libdparse-version: min
# macos only with LDC
- { os: macos-latest, dc: ldc-latest, libdparse-version: min, build: debug, arch: x86_64 }
- { os: macos-latest, dc: ldc-latest, libdparse-version: min, build: release, arch: x86_64 }
- { os: macos-latest, dc: ldc-latest, libdparse-version: max, build: debug, arch: x86_64 }
- { os: macos-latest, dc: ldc-latest, libdparse-version: max, build: release, arch: x86_64 }
- { os: macos-latest, dc: ldc-latest, libdparse-version: min, build: debug, arch: aarch64 }
- { os: macos-latest, dc: ldc-latest, libdparse-version: min, build: release, arch: aarch64 }
- { os: macos-latest, dc: ldc-latest, libdparse-version: max, build: debug, arch: aarch64 }
- { os: macos-latest, dc: ldc-latest, libdparse-version: max, build: release, arch: aarch64 }
# old compiler tests # old compiler tests
- { os: ubuntu-20.04, dc: dmd-2.095.1, libdparse-version: min, build: debug, arch: x86_64 } - { os: ubuntu-22.04, dc: dmd-2.095.1, libdparse-version: min, build: debug, arch: x86_64 }
- { os: ubuntu-20.04, dc: ldc-1.25.0, libdparse-version: min, build: debug, arch: x86_64 } - { os: ubuntu-22.04, dc: ldc-1.25.0, libdparse-version: min, build: debug, arch: x86_64 }
# gdc
- { os: ubuntu-24.04, dc: gdc-14, libdparse-version: min, build: debug, arch: x86_64 }
- { os: ubuntu-24.04, dc: gdc-14, libdparse-version: max, build: debug, arch: x86_64 }
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
submodules: recursive submodules: recursive
- name: Setup D tools (gdc only)
if: ${{ startsWith(matrix.dc, 'gdc') }}
uses: dlang-community/setup-dlang@v2
- name: Setup D - name: Setup D
uses: dlang-community/setup-dlang@v1 uses: dlang-community/setup-dlang@v2
with: with:
compiler: ${{ matrix.dc }} compiler: ${{ matrix.dc }}
- name: Set gdc specific environment variables
if: ${{ startsWith(matrix.dc, 'gdc') }}
run: |
tee -a ${GITHUB_ENV} <<<"DC=${DMD}" # need gdmd for -run
# Linking errors without -allinst
# No other easy way to pass this to dub, using DFLAGS in the
# environment disables unittests
cat <<-EOF | sudo tee -a /etc/dmd.conf
[Environment]
DFLAGS=-allinst
EOF
# Build # Build
- name: Build - name: Build
@ -52,7 +80,6 @@ jobs:
- name: Build DSymbol - name: Build DSymbol
env: env:
DC: ${{matrix.dc}}
LIBDPARSE_VERSION: ${{ matrix.libdparse-version }} LIBDPARSE_VERSION: ${{ matrix.libdparse-version }}
run: | run: |
cd dsymbol cd dsymbol
@ -60,7 +87,6 @@ jobs:
- name: Test DSymbol - name: Test DSymbol
env: env:
DC: ${{matrix.dc}}
LIBDPARSE_VERSION: ${{ matrix.libdparse-version }} LIBDPARSE_VERSION: ${{ matrix.libdparse-version }}
run: | run: |
cd dsymbol cd dsymbol

View File

@ -10,7 +10,7 @@ on:
jobs: jobs:
intro_comment: intro_comment:
name: Make intro comment name: Make intro comment
runs-on: ubuntu-20.04 runs-on: ubuntu-latest
steps: steps:
- name: 'Prepare sticky comment' - name: 'Prepare sticky comment'
# commit of v2.5.0 # commit of v2.5.0

View File

@ -9,24 +9,22 @@ on:
jobs: jobs:
comment: comment:
name: PR Info name: PR Info
runs-on: ubuntu-20.04 runs-on: ubuntu-latest
if: > if: >
github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success' github.event.workflow_run.conclusion == 'success'
steps: steps:
# from https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ # from https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
- name: 'Download artifact' - name: 'Download artifact'
uses: actions/github-script@v3.1.0 uses: actions/github-script@v8
with: with:
script: | script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({ var { data: artifacts } = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }}, run_id: ${{github.event.workflow_run.id }},
}); });
var matchArtifact = artifacts.data.artifacts.filter((artifact) => { var matchArtifact = artifacts.artifacts.filter((artifact) => artifact.name === "pr")[0];
return artifact.name == "pr"
})[0];
var download = await github.actions.downloadArtifact({ var download = await github.actions.downloadArtifact({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,

View File

@ -18,12 +18,12 @@ jobs:
# Compiler to test with # Compiler to test with
- name: Prepare compiler - name: Prepare compiler
uses: dlang-community/setup-dlang@v1 uses: dlang-community/setup-dlang@v2
with: with:
compiler: dmd-latest compiler: dmd-latest
- name: Prepare compiler - name: Prepare compiler
uses: dlang-community/setup-dlang@v1 uses: dlang-community/setup-dlang@v2
with: with:
compiler: ldc-latest compiler: ldc-latest

View File

@ -9,11 +9,14 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
# use older ubuntu / linux version for glibc compatibility # use older ubuntu / linux version for glibc compatibility
os: [ubuntu-20.04, windows-latest, macos-latest] os: [ubuntu-22.04, windows-latest]
dc: dc:
- ldc-latest - ldc-latest
arch: arch:
- x86_64 - x86_64
include:
- os: macos-latest
arch: aarch64
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -21,7 +24,7 @@ jobs:
submodules: recursive submodules: recursive
- name: Setup D - name: Setup D
uses: dlang-community/setup-dlang@v1 uses: dlang-community/setup-dlang@v2
with: with:
compiler: ${{ matrix.dc }} compiler: ${{ matrix.dc }}

2
.gitignore vendored
View File

@ -31,6 +31,8 @@ stdout.txt
# script-generated expected with absolute file paths # script-generated expected with absolute file paths
tests/tc_locate_ufcs_function/expected.txt tests/tc_locate_ufcs_function/expected.txt
tests/tc_recursive_public_import/expected.txt tests/tc_recursive_public_import/expected.txt
# other script-generated files
tests/extra/tc_ufcs_all_kinds/generate_tests
# Dub files # Dub files
.dub .dub

View File

@ -576,7 +576,7 @@ version (linux) unittest
} }
const rssAfter = getRSS(); const rssAfter = getRSS();
// check the process memory increase with some eyeballed threshold // check the process memory increase with some eyeballed threshold
assert(rssAfter - rssBefore < 5000); assert(rssAfter - rssBefore < 6_000);
} }
// this is for testing that internString data is always on the same address // this is for testing that internString data is always on the same address

View File

@ -129,29 +129,27 @@ int main(string[] args)
fs.write("proc_test.d", code); fs.write("proc_test.d", code);
auto output = executeShell("$DC -verrors=0 -c proc_test.d").output; auto output = executeShell("$DC -verrors=0 $ERROR_STYLE -c proc_test.d").output;
size_t numErrors = 0; size_t numErrors = 0;
string[][string] variableIncompatibilities; string[][string] variableIncompatibilities;
// Example of a line we want to match: `proc_test.d:2568:22: error: [...]'
auto errRegex = regex(`proc_test\.d:([0-9]*):[0-9]*: error`, "i");
foreach (err; output.lineSplitter) foreach (err; output.lineSplitter)
{ {
if (!err.startsWith("proc_test.d(")) if (auto m = matchFirst(err, errRegex)) {
continue; auto lineNo = to!int(m[1]);
err = err["proc_test.d(".length .. $]; string line = lines[lineNo - 1];
auto lineNo = err.parse!int; enforce(line.endsWith("();"), "Unexpected error in line " ~ lineNo.to!string);
if (!err.startsWith("): Error: ")) line = line[0 .. $ - 3];
continue; string varName = line.findSplit(".")[0];
err = err["): Error: ".length .. $]; string funcName = line.findSplit(".")[2];
string line = lines[lineNo - 1]; // writeln("variable type ", varLookup[varName], " can't call ", funcLookup[funcName]);
enforce(line.endsWith("();"), "Unexpected error in line " ~ lineNo.to!string); variableIncompatibilities[varName] ~= funcName;
line = line[0 .. $ - 3]; numErrors++;
string varName = line.findSplit(".")[0]; }
string funcName = line.findSplit(".")[2];
// writeln("variable type ", varLookup[varName], " can't call ", funcLookup[funcName]);
variableIncompatibilities[varName] ~= funcName;
numErrors++;
} }
enforce(numErrors > 1_000, "compiler didn't error as expected, need to adjust tests!"); enforce(numErrors > 1_000, "compiler didn't error as expected, need to adjust tests!");

View File

@ -4,4 +4,21 @@ if [ -z "${DC:-}" ]; then
DC=dmd DC=dmd
fi fi
DC="$DC" "$DC" -run generate_tests.d "$1" DCBASE=$(basename "${DC}")
# Set up ERROR_STYLE to make all compilers output errors in the same
# format to make matching easier in generate_tests.d.
if [[ ${DCBASE} =~ gdmd ]]; then
ERROR_STYLE=
elif [[ ${DCBASE} =~ dmd|ldc ]]; then
ERROR_STYLE='-verror-style=gnu -vcolumns'
else
echo "unknonwn compiler ${DC}"
exit 1
fi
export DC ERROR_STYLE
# gdc uses language specific error message
export LC_ALL=${LC_ALL:-"C.UTF-8"}
${DC} -run generate_tests.d "${1}"