Commit 291eada8

291eada83ae8Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · ~1 modified

Description

test: file_binread uses cwd-relative path for MSYS2 compatibility

The hardcoded /tmp/spinel_binread_test.bin resolved to different locations on MSYS2: the backtick-spawned shell creates it under MSYS2's /tmp (~/msys64/tmp), while the native-Windows-built spinel binary's fopen("/tmp/...") lands at C:\tmp. The latter doesn't exist, so spinel got a 0-byte read; out-of-bounds sp_IntArray_get on the empty array then printed uninitialized memory in CI:

Tests: 256 pass, 1 fail, 0 error
FAIL: file_binread

Switching to a cwd-relative path mirrors the fix already applied to test/fileio.rb and test/fileopen.rb. Both ruby and the spinel binary resolve relative paths against the harness's project-root cwd, so they read and write the same file.

Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]

Details

Commit
291eada83ae8
Parent
3c118c2093fc

test/file_binread.rbmodifiedView file

@@ -4,10 +4,15 @@
44 # helper that reads with the actual file size.
55 #
66 # `File.binread(path)` standalone is aliased to File.read.
7+#
8+# Uses a cwd-relative path so MSYS2 and the native-Windows-built
9+# spinel binary resolve to the same file (the harness runs each test
10+# from the project root). `/tmp/...` would land in different places
11+# on the two sides — see test/fileio.rb for the same workaround.
712
813 # Set up a binary file with embedded NULs via a shell command.
914 # spinel's File.write uses fputs and would stop at the first NUL.
10-path = "/tmp/spinel_binread_test.bin"
15+path = "spinel_binread_test.bin"
1116 `printf 'AB\\000CD\\000EF' > #{path}`
1217
1318 # Pattern-matched: emits sp_file_binread_bytes(path) which reads