Skip to content

Commit 2681407

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

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-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: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
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
10+
11+
h_file = File.read("tmp/mig_test_rpc.h")
12+
assert_match /Request_mig_test_call/, h_file
13+
14+
c_file = File.read("tmp/mig_test_rpc.c")
15+
assert_match /Reply__mig_test_call/, c_file
16+
end
17+
18+
def test_mig_compile_x86_64_darwin
19+
test_mig_compile('x86_64-darwin')
20+
end
21+
22+
def test_mig_compile_arm64_darwin
23+
test_mig_compile('arm64-darwin')
24+
end
25+
end

0 commit comments

Comments
 (0)