aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/test/basic_SUITE_data/basic_module_info.erl
blob: cab48b10ba8208c7ebe8877ce70bbf5830c9976c (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
29
30
31
32
%%% -*- erlang-indent-level: 2 -*-
%%%-------------------------------------------------------------------
%%% Author: Kostis Sagonas
%%% Date: Oct 25, 2003
%%%
%%% Tests whether calling module_info from the same module works.
%%% This seems trivial, but the problem is that the module_info/[0,1]
%%% functions that the BEAM file contains used to be dummy functions
%%% containing crap. So, these functions could not be used for
%%% compilation to native code and the functions that the BEAM loader
%%% generates should have been used instead. This was a HiPE bug
%%% reported by Dan Wallin.
%%%-------------------------------------------------------------------
-module(basic_module_info).

-export([test/0]).

test() ->
  L = test_local_mi0_call(),
  E = test_remote_mi1_call(),
  {3, 3} = {L, E},
  ok.

test_local_mi0_call() ->
  ModInfo = module_info(),
  %% io:format("ok, ModInfo=~w\n", [ModInfo]),
  {exports, FunList} = lists:keyfind(exports, 1, ModInfo),
  length(FunList).

test_remote_mi1_call() ->
  FunList = ?MODULE:module_info(exports),
  length(FunList).