Skip to content

Commit 9c5dcaf

Browse files
committed
Test Connector C strict-aliasing variant on Windows
1 parent 6e1bffa commit 9c5dcaf

2 files changed

Lines changed: 115 additions & 0 deletions

File tree

.github/workflows/issue236-windows.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,44 @@ on:
1010
workflow_dispatch:
1111

1212
jobs:
13+
build-yggdrasil-variant:
14+
name: Build Yggdrasil variant / fno-strict-aliasing
15+
if: github.event_name == 'workflow_dispatch'
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 60
18+
steps:
19+
- uses: julia-actions/setup-julia@v2
20+
with:
21+
version: "1.12"
22+
23+
- uses: actions/checkout@v5
24+
with:
25+
repository: JuliaPackaging/Yggdrasil
26+
path: Yggdrasil
27+
28+
- name: Patch MariaDB Connector/C recipe
29+
shell: bash
30+
run: |
31+
set -euo pipefail
32+
cd Yggdrasil/M/MariaDB_Connector_C
33+
perl -0pi -e 's/\Q-Wno-error -Wno-incompatible-pointer-types\E/-Wno-error -Wno-incompatible-pointer-types -fno-strict-aliasing/' build_tarballs.jl
34+
grep -n 'fno-strict-aliasing' build_tarballs.jl
35+
36+
- name: Build Windows tarball
37+
shell: bash
38+
run: |
39+
set -euo pipefail
40+
cd Yggdrasil/M/MariaDB_Connector_C
41+
julia --project=../.. --startup-file=no build_tarballs.jl --verbose x86_64-w64-mingw32
42+
mkdir -p "$GITHUB_WORKSPACE/variant"
43+
cp products/MariaDB_Connector_C.v*.x86_64-w64-mingw32.tar.gz "$GITHUB_WORKSPACE/variant/"
44+
cp products/MariaDB_Connector_C-logs.v*.x86_64-w64-mingw32.tar.gz "$GITHUB_WORKSPACE/variant/"
45+
46+
- uses: actions/upload-artifact@v5
47+
with:
48+
name: mariadb-connector-c-fno-strict-aliasing
49+
path: variant/*.tar.gz
50+
1351
issue236:
1452
name: Windows ${{ matrix.os }} / ${{ matrix.connector }}
1553
runs-on: ${{ matrix.os }}
@@ -77,3 +115,70 @@ jobs:
77115
MYSQLJL_CONNECTOR: ${{ matrix.connector }}
78116
MYSQLJL_JLL_VERSION: ${{ matrix.connector == 'jll-3.3.9' && '3.3.9' || 'default' }}
79117
run: julia --startup-file=no test/issue236_windows.jl
118+
119+
issue236-yggdrasil-variant:
120+
name: Windows ${{ matrix.os }} / yggdrasil-fno-strict-aliasing
121+
if: github.event_name == 'workflow_dispatch'
122+
needs: build-yggdrasil-variant
123+
runs-on: ${{ matrix.os }}
124+
timeout-minutes: 30
125+
strategy:
126+
fail-fast: false
127+
matrix:
128+
os:
129+
- windows-2022
130+
- windows-2025
131+
132+
steps:
133+
- uses: actions/checkout@v5
134+
135+
- uses: julia-actions/setup-julia@v2
136+
with:
137+
version: "1"
138+
arch: x64
139+
140+
- name: Start MySQL
141+
uses: shogo82148/actions-setup-mysql@v1.51.0
142+
with:
143+
mysql-version: "8.4"
144+
root-password: root
145+
146+
- uses: actions/download-artifact@v5
147+
with:
148+
name: mariadb-connector-c-fno-strict-aliasing
149+
path: ${{ runner.temp }}/variant
150+
151+
- name: Use Yggdrasil variant
152+
shell: pwsh
153+
run: |
154+
$target = Join-Path $env:RUNNER_TEMP "mariadb-connector-c-fno-strict-aliasing"
155+
New-Item -ItemType Directory -Force -Path $target | Out-Null
156+
$tarball = Get-ChildItem (Join-Path $env:RUNNER_TEMP "variant") -Filter "MariaDB_Connector_C.v*.x86_64-w64-mingw32.tar.gz" | Select-Object -First 1
157+
if ($null -eq $tarball) {
158+
throw "Could not find built Connector/C tarball"
159+
}
160+
tar -xzf $tarball.FullName -C $target
161+
162+
$dll = Join-Path $target "bin/libmariadb.dll"
163+
$plugin = Join-Path $target "lib/mariadb/plugin"
164+
if (!(Test-Path $dll)) {
165+
throw "Could not find libmariadb.dll at $dll"
166+
}
167+
if (!(Test-Path (Join-Path $plugin "caching_sha2_password.dll"))) {
168+
throw "Could not find Connector/C plugin directory at $plugin"
169+
}
170+
171+
"MYSQLJL_LIBMARIADB_OVERRIDE=$dll" >> $env:GITHUB_ENV
172+
"MYSQLJL_PLUGIN_DIR_OVERRIDE=$plugin" >> $env:GITHUB_ENV
173+
"$(Split-Path -Parent $dll)" >> $env:GITHUB_PATH
174+
175+
- name: Run issue 236 diagnostic
176+
shell: pwsh
177+
env:
178+
MYSQLJL_HOST: 127.0.0.1
179+
MYSQLJL_PORT: "3306"
180+
MYSQLJL_USER: root
181+
MYSQLJL_PASSWORD: root
182+
MYSQLJL_CONNECTOR: yggdrasil-fno-strict-aliasing
183+
MYSQLJL_JLL_VERSION: default
184+
run: julia --startup-file=no test/issue236_windows.jl

test/issue236_windows.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ function logline(xs...)
3838
return nothing
3939
end
4040

41+
function log_mysql_bind_layout()
42+
names = fieldnames(MySQL.API.MYSQL_BIND)
43+
logline("MYSQL_BIND_SIZE ", sizeof(MySQL.API.MYSQL_BIND))
44+
for (i, name) in pairs(names)
45+
logline("MYSQL_BIND_FIELD ", name, " offset=", fieldoffset(MySQL.API.MYSQL_BIND, i))
46+
end
47+
return nothing
48+
end
49+
4150
function connect_root(; db=nothing)
4251
host = get(ENV, "MYSQLJL_HOST", "127.0.0.1")
4352
port = parse(Int, get(ENV, "MYSQLJL_PORT", "3306"))
@@ -148,6 +157,7 @@ function main()
148157
logline("CCALL_LIBMARIADB ", MySQL.API.libmariadb_for_ccall)
149158
logline("PLUGIN_DIR ", MySQL.API.PLUGIN_DIR)
150159
logline("LIBMARIADB_HANDLE ", Libdl.dlopen_e(MySQL.API.libmariadb_for_ccall))
160+
log_mysql_bind_layout()
151161

152162
conn = prepare_database()
153163
try

0 commit comments

Comments
 (0)