diff options
author | Sverker Eriksson <[email protected]> | 2014-03-31 16:02:30 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2014-03-31 16:02:30 +0200 |
commit | 219785005b451dec785179a9e6d5ee2e7551f2b1 (patch) | |
tree | cf5c2254070b4d0ca039eccdf2ad3f5921c98b4c /lib/hipe/test/hipe_testsuite_driver.erl | |
parent | c319be4bc33ceb205c48ed708bf53874207621bb (diff) | |
parent | 257c21b8d7fbcc06b72da04e69fddbed3d0f939e (diff) | |
download | otp-219785005b451dec785179a9e6d5ee2e7551f2b1.tar.gz otp-219785005b451dec785179a9e6d5ee2e7551f2b1.tar.bz2 otp-219785005b451dec785179a9e6d5ee2e7551f2b1.zip |
Merge branch 'kostis/hipe-test-fix'
* kostis/hipe-test-fix:
Add support for testing the LLVM backend too
Ensure generated modules are properly included in the Emakefile
Diffstat (limited to 'lib/hipe/test/hipe_testsuite_driver.erl')
-rw-r--r-- | lib/hipe/test/hipe_testsuite_driver.erl | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/lib/hipe/test/hipe_testsuite_driver.erl b/lib/hipe/test/hipe_testsuite_driver.erl index c8fdf1600c..5f05a716bc 100644 --- a/lib/hipe/test/hipe_testsuite_driver.erl +++ b/lib/hipe/test/hipe_testsuite_driver.erl @@ -85,7 +85,7 @@ list_testcases(Dirname) -> list_dir(Dir, Extension, Dirs) -> case file:list_dir(Dir) of - {error, _} = Error-> Error; + {error, _} = Error -> Error; {ok, Filenames} -> FullFilenames = [filename:join(Dir, F) || F <- Filenames], Matches1 = case Dirs of @@ -173,10 +173,29 @@ run(TestCase, Dir, _OutDir) -> %% end, DataFiles), %% try ok = TestCase:test(), - HiPEOpts = try TestCase:hipe_options() catch _:_ -> [] end, + HiPEOpts = try TestCase:hipe_options() catch error:undef -> [] end, {ok, TestCase} = hipe:c(TestCase, HiPEOpts), - ok = TestCase:test(). + ok = TestCase:test(), + case is_llvm_opt_available() of + true -> + {ok, TestCase} = hipe:c(TestCase, [to_llvm|HiPEOpts]), + ok = TestCase:test(); + false -> ok + end. %% after %% lists:foreach(fun (DF) -> ok end, % = file:delete(DF) end, %% [filename:join(OutDir, D) || D <- DataFiles]) %% end. + + +%% This function, which is supposed to check whether the right LLVM +%% infrastructure is available, should be probably written in a better +%% and more portable way and moved to the hipe application. + +is_llvm_opt_available() -> + OptStr = os:cmd("opt -version"), + SubStr = "LLVM version ", N = length(SubStr), + case string:str(OptStr, SubStr) of + 0 -> false; + S -> P = S + N, string:sub_string(OptStr, P, P + 2) >= "3.4" + end. |