Using Common Test with test suites in LFE

57 views
Skip to first unread message

Robert Virding

unread,
Nov 14, 2015, 6:30:00 PM11/14/15
to Lisp Flavoured Erlang
You can use LFE together with Common Test but you need to do some work.

First all the test suite files need to be named xxxx_SUITE with the corresponding module name. LFE no longer enforces this coupling but Erlang and CT depend on it.

Second CT by default compiles all .erl files in the directory, but I have not found any way to get it to compile files with other extensions. This means you have to compile all the .lfe files first. And any .lfe support files as well.

Then you have to tell CT not to try and compile the files when you start it. You do this with the ct_run option -no_auto_compile. Configuration files have to be in Erlang syntax. Everything should then work according to the manual.

The LFE release contains some CT test suites but these are not complete. There was a bug in the compiler which made in crash when trying to compile guard_SUITE.lfe but this has been fixed. There is a rudimentary include file test_server.lfe containing some the standard CT macros in LFE form. It needs to be extended and probably moved to lfe/include to make it easier to use.

So

ct_run -pa ../ebin -no_auto_compile -suite andor_SUITE guard_SUITE ms_transform_SUITE eval_SUITE

will run all the test suites. You need the -pa ../ebin so it finds LFE unless you have LFE in your ERL_LIBS.

Robert


Robert Virding

unread,
Nov 14, 2015, 6:44:53 PM11/14/15
to Lisp Flavoured Erlang
A final comment, for now anyway. Common Test creates very much log information so create a log directory and use the -logdir option.

Robert

mko_io

unread,
Aug 1, 2018, 8:00:38 PM8/1/18
to Lisp Flavoured Erlang
Hi Robert,
I'm following your guide, it works but the log shows ct_run still try to compile or locate the test suites which paused for 15secs, then everything runs fine here's the command and the log

$ ls                                                  
log my1st_SUITE
.lfe


$ls
..
ebin include priv src test



$ct_run
-pa ../ebin -no_auto_compile -suite my1st_SUITE -logdir log


Erlang/OTP 21 [erts-10.0.4] [source] [64-bit] [smp:24:24] [ds:24:24:10] [async-threads:1] [hipe] [dtrace]


Converting "ebin" to "/Users/nome/Repo/lfe/proto/ebin" and re-inserting with add_patha/1




Common Test v1.16 starting (cwd is /Users/nome/Repo/lfe/proto)


Eshell V10.0.4  (abort with ^G)
(ct@Nome)1>
Suite my1st_SUITE not found in directory /Users/nome/Repo/lfe/proto


Failed to compile or locate one or more test suites
Press 'c' to continue or 'a' to abort.
Will continue in 15 seconds if no answer is given!
(c/a) c    
(ct@Nome)1>
CWD
set to: "/Users/nome/Repo/lfe/proto/test/log/ct_r...@Nome.2018-08-02_11.55.19"


TEST INFO
: 1 test(s), 1 case(s) in 1 suite(s)


Testing lfe.proto.my1st_SUITE: Starting test, 1 test cases
Testing lfe.proto.my1st_SUITE: TEST COMPLETE, 1 ok, 0 failed of 1 test cases


Updating /Users/nome/Repo/lfe/proto/test/log/index.html ... done
Updating /Users/nome/Repo/lfe/proto/test/log/all_runs.html ... done

I want to ask is there a way to skip the 15secs waiting part?

mko
Reply all
Reply to author
Forward
0 new messages