Skip to content

Commit 09b7ca2

Browse files
committed
Add a test case for mig tool on darwon platforms
1 parent c439304 commit 09b7ca2

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

test/fixtures/mig_test_rpc.defs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include <mach/std_types.defs>
2+
#include <mach/mach_types.defs>
3+
4+
subsystem mig_test_ipc 1;
5+
6+
routine mig_test_call(
7+
server_port : mach_port_t;
8+
out returnvalue : int);

test/test_mig.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
require 'rake_compiler_dock'
2+
require 'test/unit'
3+
4+
class TestMigCompile < Test::Unit::TestCase
5+
TEST_PLATFORM = ENV["TEST_PLATFORM"]
6+
7+
def test_mig_compile(platform)
8+
omit "only on #{platform} platform" unless TEST_PLATFORM == platform
9+
10+
RakeCompilerDock::Starter.sh "mig -header tmp/mig_test_rpc.h -user tmp/mig_test_rpc.c -sheader /dev/null -server /dev/null -I. test/fixtures/mig_test_rpc.defs ", platform: platform, verbose: false
11+
12+
h_file = File.read("tmp/mig_test_rpc.h")
13+
assert_match /Request_mig_test_call/, h_file
14+
15+
c_file = File.read("tmp/mig_test_rpc.c")
16+
assert_match /Reply__mig_test_call/, c_file
17+
end
18+
19+
def test_mig_compile_x86_64_darwin
20+
test_mig_compile('x86_64-darwin')
21+
end
22+
23+
def test_mig_compile_arm64_darwin
24+
test_mig_compile('arm64-darwin')
25+
end
26+
end

0 commit comments

Comments
 (0)