Skip to content

Commit 07967dd

Browse files
committed
test: reproduce an alpine symbol issue
see sparklemotion/sqlite3-ruby#434
1 parent ef9bb33 commit 07967dd

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

test/rcd_test/ext/mri/rcd_test_ext.c

+14
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,19 @@ rcdt_darwin_builtin_available_eh(VALUE self)
4040
#endif
4141
}
4242

43+
static VALUE
44+
rcdt_largefile_op_removed_from_musl(VALUE self)
45+
{
46+
// Reference a symbol that was removed in Musl 1.24 🙄
47+
// https://github.com/sparklemotion/sqlite3-ruby/issues/434
48+
#ifdef __linux__
49+
posix_fallocate(STDERR_FILENO, 0, 0);
50+
return Qtrue;
51+
#else
52+
return Qfalse;
53+
#endif
54+
}
55+
4356
void
4457
Init_rcd_test_ext(void)
4558
{
@@ -48,4 +61,5 @@ Init_rcd_test_ext(void)
4861
rb_define_singleton_method(rb_mRcdTest, "darwin_builtin_available?", rcdt_darwin_builtin_available_eh, 0);
4962
rb_define_singleton_method(rb_mRcdTest, "isinf?", rcdt_isinf_eh, 1);
5063
rb_define_singleton_method(rb_mRcdTest, "isnan?", rcdt_isnan_eh, 1);
64+
rb_define_singleton_method(rb_mRcdTest, "largefile_op_removed_from_musl", rcdt_largefile_op_removed_from_musl, 0);
5165
}

test/rcd_test/ext/mri/rcd_test_ext.h

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#ifndef RCD_TEST_EXT_H
22
#define RCD_TEST_EXT_H 1
33

4+
// see rcdt_largefile_op_removed_from_musl
5+
#define _LARGEFILE_SOURCE 1
6+
#define _FILE_OFFSET_BITS 64
7+
#include <fcntl.h>
8+
49
#include "ruby.h"
510

611
#endif /* RCD_TEST_EXT_H */

test/rcd_test/test/test_basic.rb

+7
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,17 @@ def test_check_darwin_compiler_rt_symbol_resolution
2222

2323
def test_floating_point_classification_macros
2424
skip("jruby should not run libc-specific tests") if RUBY_ENGINE == "jruby"
25+
2526
refute(RcdTest.isinf?(42.0))
2627
assert(RcdTest.isinf?(Float::INFINITY))
2728
refute(RcdTest.isnan?(42.0))
2829
assert(RcdTest.isnan?(Float::NAN))
2930
end
3031

32+
def test_largefile_op_removed_from_musl
33+
skip("jruby should not run libc-specific tests") if RUBY_ENGINE == "jruby"
34+
35+
is_linux = RUBY_PLATFORM.include?("linux")
36+
assert_equal(is_linux, RcdTest.largefile_op_removed_from_musl)
37+
end
3138
end

0 commit comments

Comments
 (0)