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