aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/test/sanity_SUITE_data/sanity_comp_timeout.erl
blob: 9f0830574fae4ed4555b7cd2a06c3793aa59db6b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
%%% -*- erlang-indent-level: 2 -*-
%%%----------------------------------------------------------------------
%%% Author: Kostis Sagonas
%%%
%%% Tests that when the native code compilation times out or gets killed
%%% for some other reason, the parent process does not also get killed.
%%%
%%% Problem discovered by Bjorn G. on 1/12/2003 and fixed by Kostis.
%%%----------------------------------------------------------------------

-module(sanity_comp_timeout).

-export([test/0, to_llvm/0]).

test() ->
  ok = write_dummy_mod(),
  error_logger:tty(false), % disable printouts of error reports
  Self = self(),           % get the parent process
  c:c(dummy_mod, [native, {hipe, [{timeout, 1}]}]), % This will kill the process
  Self = self(),           % make sure the parent process stays the same
  ok.

to_llvm() -> false.

write_dummy_mod() ->
  Prog = <<"-module(dummy_mod).\n-export([test/0]).\ntest() -> ok.\n">>,
  ok = file:write_file("dummy_mod.erl", Prog).