Skip to content

Commit

Permalink
Trying to solve ci macos issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
viferga committed Aug 23, 2023
1 parent 79a17a2 commit f8345c2
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 38 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/macos-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ jobs:
RUBY_FRAMEWORK_DIR=$(xcrun --sdk macosx --show-sdk-path)/System/Library/Frameworks/Ruby.framework
sudo rm -rf $RUBY_FRAMEWORK_DIR
- name: Uninstall Go
run: |
brew uninstall --force go
brew autoremove
sudo rm -rf /usr/local/Cellar/go
- name: Uninstall Java
run: |
sudo rm -rf /Library/Java/JavaVirtualMachines/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,43 +26,6 @@
class metacall_rb_call_bench : public benchmark::Fixture
{
public:
void SetUp(benchmark::State &state)
{
metacall_print_info();

metacall_log_null();

if (metacall_initialize() != 0)
{
state.SkipWithError("Error initializing MetaCall");
}

/* Ruby */
#if defined(OPTION_BUILD_LOADERS_RB)
{
static const char tag[] = "rb";

static const char int_mem_type[] =
"#!/usr/bin/env ruby\n"
"def int_mem_type(left: Fixnum, right: Fixnum)\n"
"\treturn 0\n"
"end\n";

if (metacall_load_from_memory(tag, int_mem_type, sizeof(int_mem_type), NULL) != 0)
{
state.SkipWithError("Error loading int_mem_type function");
}
}
#endif /* OPTION_BUILD_LOADERS_RB */
}

void TearDown(benchmark::State &state)
{
if (metacall_destroy() != 0)
{
state.SkipWithError("Error destroying MetaCall");
}
}
};

BENCHMARK_DEFINE_F(metacall_rb_call_bench, call_va_args)
Expand Down Expand Up @@ -175,4 +138,72 @@ BENCHMARK_REGISTER_F(metacall_rb_call_bench, call_array_args)
->Iterations(1)
->Repetitions(5);

BENCHMARK_MAIN();
/* Use main for initializing MetaCall once. There's a bug in Ruby 3.2 on MacOS which prevents reinitialization */
/*
Stack trace (most recent call last):
#18 Object "metacall-rb-call-bench", at 0x100363520, in main + 48
#17 Object "metacall-rb-call-bench", at 0x1003647f8, in benchmark::RunSpecifiedBenchmarks() + 40
#16 Object "metacall-rb-call-bench", at 0x10036561f, in benchmark::RunSpecifiedBenchmarks(benchmark::BenchmarkReporter*, benchmark::BenchmarkReporter*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) + 3567
#15 Object "metacall-rb-call-bench", at 0x10037e408, in benchmark::internal::BenchmarkRunner::DoOneRepetition() + 136
#14 Object "metacall-rb-call-bench", at 0x10037d97a, in benchmark::internal::BenchmarkRunner::DoNIterations() + 890
#13 Object "metacall-rb-call-bench", at 0x10037dea7, in benchmark::internal::(anonymous namespace)::RunInThread(benchmark::internal::BenchmarkInstance const*, unsigned long long, int, benchmark::internal::ThreadManager*, benchmark::internal::PerfCountersMeasurement*) + 87
#12 Object "metacall-rb-call-bench", at 0x10036af5f, in benchmark::internal::BenchmarkInstance::Run(unsigned long long, int, benchmark::internal::ThreadTimer*, benchmark::internal::ThreadManager*, benchmark::internal::PerfCountersMeasurement*) const + 79
#11 Object "metacall-rb-call-bench", at 0x100363573, in benchmark::Fixture::Run(benchmark::State&) + 19
#10 Object "metacall-rb-call-bench", at 0x100363605, in metacall_rb_call_bench::SetUp(benchmark::State&) + 69
#9 Object "libmetacall.dylib", at 0x10050a077, in loader_impl_load_from_memory + 135
#8 Object "libmetacall.dylib", at 0x10050955f, in loader_impl_initialize + 287
#7 Object "librb_loader.so", at 0x10058b978, in rb_loader_impl_initialize + 56
#6 Object "libruby.3.2.dylib", at 0x100c683d7, in ruby_init + 13
#5 Object "libruby.3.2.dylib", at 0x100c6837b, in ruby_setup + 304
#4 Object "libruby.3.2.dylib", at 0x100c90ff1, in rb_call_inits + 19
#3 Object "libruby.3.2.dylib", at 0x100da121e, in Init_TransientHeap + 79
#2 Object "libsystem_platform.dylib", at 0x7ff8088fbdfc, in _sigtramp + 28
#1 Object "libbacktrace_plugin.so", at 0x100571b5d, in backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 13
#0 Object "libbacktrace_plugin.so", at 0x100571bc6, in backward::SignalHandling::handleSignal(int, __siginfo*, void*) + 70
*/
int main(int argc, char *argv[])
{
metacall_print_info();

metacall_log_null();

if (metacall_initialize() != 0)
{
return 1;
}

/* Ruby */
#if defined(OPTION_BUILD_LOADERS_RB)
{
static const char tag[] = "rb";

static const char int_mem_type[] =
"#!/usr/bin/env ruby\n"
"def int_mem_type(left: Fixnum, right: Fixnum)\n"
"\treturn 0\n"
"end\n";

if (metacall_load_from_memory(tag, int_mem_type, sizeof(int_mem_type), NULL) != 0)
{
state.SkipWithError("Error loading int_mem_type function");
}
}
#endif /* OPTION_BUILD_LOADERS_RB */

::benchmark::Initialize(&argc, argv);

if (::benchmark::ReportUnrecognizedArguments(argc, argv))
{
return 3;
}

::benchmark::RunSpecifiedBenchmarks();
::benchmark::Shutdown();

if (metacall_destroy() != 0)
{
return 4;
}

return 0;
}

0 comments on commit f8345c2

Please sign in to comment.