Skip to content

Commit

Permalink
compiler tests: Test the 'inline' option better
Browse files Browse the repository at this point in the history
Clone some test suites and compile them with the 'inline' option
to test inlining more thorughly.
  • Loading branch information
bjorng committed Mar 26, 2010
1 parent 57cb16f commit e74235d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ a.out.dSYM/

/lib/compiler/test/*_no_opt_SUITE.erl
/lib/compiler/test/*_post_opt_SUITE.erl
/lib/compiler/test/*_inline_SUITE.erl

# debugger

Expand Down
26 changes: 24 additions & 2 deletions lib/compiler/test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,21 @@ NO_OPT= \
record \
trycatch

INLINE= \
andor \
apply \
bs_bincomp \
bs_bit_binaries \
bs_construct \
core_fold \
float \
fun \
match \
misc \
num_bif \
receive \
record

CORE_MODULES = \
bs_shadowed_size_var \
nested_call_in_case
Expand All @@ -62,6 +77,8 @@ NO_OPT_MODULES= $(NO_OPT:%=%_no_opt_SUITE)
NO_OPT_ERL_FILES= $(NO_OPT_MODULES:%=%.erl)
POST_OPT_MODULES= $(NO_OPT:%=%_post_opt_SUITE)
POST_OPT_ERL_FILES= $(POST_OPT_MODULES:%=%.erl)
INLINE_MODULES= $(INLINE:%=%_inline_SUITE)
INLINE_ERL_FILES= $(INLINE_MODULES:%=%.erl)

ERL_FILES= $(MODULES:%=%.erl)

Expand Down Expand Up @@ -90,13 +107,15 @@ EBIN = .
# Targets
# ----------------------------------------------------

make_emakefile: $(NO_OPT_ERL_FILES) $(POST_OPT_ERL_FILES)
make_emakefile: $(NO_OPT_ERL_FILES) $(POST_OPT_ERL_FILES) $(INLINE_ERL_FILES)
$(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) -o$(EBIN) $(MODULES) \
> $(EMAKEFILE)
$(ERL_TOP)/make/make_emakefile +no_copt +no_postopt $(ERL_COMPILE_FLAGS) \
-o$(EBIN) $(NO_OPT_MODULES) >> $(EMAKEFILE)
$(ERL_TOP)/make/make_emakefile +no_copt $(ERL_COMPILE_FLAGS) \
-o$(EBIN) $(POST_OPT_MODULES) >> $(EMAKEFILE)
$(ERL_TOP)/make/make_emakefile +inline $(ERL_COMPILE_FLAGS) \
-o$(EBIN) $(INLINE_MODULES) >> $(EMAKEFILE)

tests debug opt: make_emakefile
erl $(ERL_MAKE_FLAGS) -make
Expand All @@ -118,6 +137,9 @@ docs:
%_post_opt_SUITE.erl: %_SUITE.erl
sed -e 's;-module($(basename $<));-module($(basename $@));' $< > $@

%_inline_SUITE.erl: %_SUITE.erl
sed -e 's;-module($(basename $<));-module($(basename $@));' $< > $@

# ----------------------------------------------------
# Release Target
# ----------------------------------------------------
Expand All @@ -130,7 +152,7 @@ release_tests_spec: make_emakefile
$(INSTALL_DATA) compiler.dynspec compiler.cover \
$(EMAKEFILE) $(ERL_FILES) $(CORE_FILES) $(RELSYSDIR)
$(INSTALL_DATA) $(NO_OPT_ERL_FILES) $(POST_OPT_ERL_FILES) \
$(RELSYSDIR)
$(INLINE_ERL_FILES) $(RELSYSDIR)
chmod -f -R u+w $(RELSYSDIR)
@tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -)

Expand Down
4 changes: 3 additions & 1 deletion lib/compiler/test/test_lib.erl
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ opt_opts(Mod) ->
(no_gc_bifs) -> true;
(no_stack_trimming) -> true;
(debug_info) -> true;
(inline) -> true;
(_) -> false
end, Opts).

Expand All @@ -68,5 +69,6 @@ opt_opts(Mod) ->
get_data_dir(Config) ->
Data0 = ?config(data_dir, Config),
{ok,Data1,_} = regexp:sub(Data0, "_no_opt_SUITE", "_SUITE"),
{ok,Data,_} = regexp:sub(Data1, "_post_opt_SUITE", "_SUITE"),
{ok,Data2,_} = regexp:sub(Data1, "_post_opt_SUITE", "_SUITE"),
{ok,Data,_} = regexp:sub(Data2, "_inline_SUITE", "_SUITE"),
Data.

0 comments on commit e74235d

Please sign in to comment.