~statik/ubuntu/maverick/erlang/erlang-merge-testing

« back to all changes in this revision

Viewing changes to lib/common_test/src/ct_testspec.erl

  • Committer: Elliot Murphy
  • Date: 2010-06-08 03:55:44 UTC
  • mfrom: (3.5.6 squeeze)
  • Revision ID: elliot@elliotmurphy.com-20100608035544-dd8zh2swk7jr5rz2
* Merge with Debian unstable; remaining Ubuntu changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to. (LP #438365)
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.
* Added missing symlinks to /usr/include for a few new header files.
* Fixed generation of ${erlang-base:Depends} and ${erlang-x11:Depends}
  substitution variables.
* Added a fix for a re:compile/2 crash on a long regular expression.
* Changed urgency to medium as the change fixes a security bug.
* Manpages in section 1 are needed even if only arch-dependent packages are
  built. So, re-enabled them.
* Fixed HiPE architecture recognition for powerpc Debian architecture.
* Moved xsltproc and fop to build-depends-indep and do not build
  documentation if only architecture-specific packages are built.
* Refreshed all patches.
* Made Emacs look in man5 and man7 for Erlang manpages and added code
  skeleton files to erlang-mode package.
* New upstream release.
* Moved manpages from incorrect sections 4 and 6 to correct 5 and 7
  (closes: #498492).
* Made manpages regexp in Emacs mode match only 3erl pages in section 3.
* Removed docb_gen script which is no longer needed to build manpages.
* Added erlang-doc package which contains documentation in HTML and PDF
  formats. This package replaces erlang-doc-html package and it's easier
  to synchronize it with the main Erlang packages as it's built from
  a single source package (closes: #558451).
* Removed RPATH from ssl and crypto application binaries as required by
  Debian policy.
* Added libwxgtk2.4-dev and libwxgtk2.6-dev to build conflicts.
* Added a few dpendencies for erlang-dialyzer, erlang-et, erlang-observer
  and erlang-examples packages which now call functions from more modules
  than in 1:13.b.3.
* Added a workaround which disables vfork() for hppa architecture
  (closes: #562218).
* Strictened check for JDK 1.5 adding a call to String(int[], int, int)
  because GCJ 4.4 doesn't implement it and OpenJDK isn't available for all
  architectures.
* Fixed erlang-manpages package section.
* Made erlang-depends add only substvars which are requested in
  debian/control file. This minimizes number of warnings from dh_gencontrol.
  Also, improved descriptions of the functions in erlang-depends escript.
* Added erlang-erl-docgen package to erlang-nox dependencies.
* Made dummy packages erlang-nox and erlang-x11 architecture all.
* Cleaned up working with custom substitution variables in debian/rules.
* Reorganized debian/rules to ensure that manpages arent built twice, and
  aren't built at all if only architecture-dependent packages are requested.
* Fixed project links in README.Debian.
* Added a new package erlang-jinterface which provides tools for
  communication of Java programs with Erlang processes. This adds build
  depandency on default-jdk and as a result enables Java module for IDL
  compiler.
* Bumped standards version to 3.8.4.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
%%
2
2
%% %CopyrightBegin%
3
 
%% 
4
 
%% Copyright Ericsson AB 2006-2009. All Rights Reserved.
5
 
%% 
 
3
%%
 
4
%% Copyright Ericsson AB 2006-2010. All Rights Reserved.
 
5
%%
6
6
%% The contents of this file are subject to the Erlang Public License,
7
7
%% Version 1.1, (the "License"); you may not use this file except in
8
8
%% compliance with the License. You should have received a copy of the
9
9
%% Erlang Public License along with this software. If not, it can be
10
10
%% retrieved online at http://www.erlang.org/.
11
 
%% 
 
11
%%
12
12
%% Software distributed under the License is distributed on an "AS IS"
13
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
14
%% the License for the specific language governing rights and limitations
15
15
%% under the License.
16
 
%% 
 
16
%%
17
17
%% %CopyrightEnd%
18
18
%%
19
19
 
231
231
    catch collect_tests_from_file1(Specs,#testspec{nodes=NodeRefs},Relaxed).
232
232
 
233
233
collect_tests_from_file1([Spec|Specs],TestSpec,Relaxed) ->
 
234
    SpecDir = filename:dirname(filename:absname(Spec)),
234
235
    case file:consult(Spec) of
235
236
        {ok,Terms} ->       
236
 
            TestSpec1 = collect_tests(Terms,TestSpec,Relaxed),
 
237
            TestSpec1 = collect_tests(Terms,TestSpec#testspec{spec_dir=SpecDir},
 
238
                                      Relaxed),
237
239
            collect_tests_from_file1(Specs,TestSpec1,Relaxed);
238
240
        {error,Reason} ->
239
241
            throw({error,{Spec,Reason}})
249
251
    collect_tests_from_list(Terms,[node()],Relaxed).
250
252
 
251
253
collect_tests_from_list(Terms,Nodes,Relaxed) when is_list(Nodes) ->
 
254
    {ok,Cwd} = file:get_cwd(),
252
255
    NodeRefs = lists:map(fun(N) -> {undefined,N} end, Nodes),
253
 
    case catch collect_tests(Terms,#testspec{nodes=NodeRefs},Relaxed) of
 
256
    case catch collect_tests(Terms,#testspec{nodes=NodeRefs,
 
257
                                             spec_dir=Cwd},
 
258
                             Relaxed) of
254
259
        E = {error,_} ->
255
260
            E;
256
261
        TS ->
265
270
    put(relaxed,Relaxed),
266
271
    TestSpec1 = get_global(Terms,TestSpec),
267
272
    TestSpec2 = get_all_nodes(Terms,TestSpec1),
 
273
    case catch evaluate(Terms,TestSpec2) of
 
274
        {error,{Node,{M,F,A},Reason}} ->
 
275
            io:format("Error! Common Test failed to evaluate ~w:~w/~w on ~w. "
 
276
                      "Reason: ~p~n~n", [M,F,A,Node,Reason]);
 
277
        _ -> ok
 
278
    end,
268
279
    add_tests(Terms,TestSpec2).
269
280
    
 
281
evaluate([{eval,NodeRef,{M,F,Args}}|Ts],Spec) ->
 
282
    Node = ref2node(NodeRef,Spec#testspec.nodes),
 
283
    case rpc:call(Node,M,F,Args) of
 
284
        {badrpc,Reason} ->
 
285
            throw({error,{Node,{M,F,length(Args)},Reason}});
 
286
        _ ->
 
287
            ok
 
288
    end,
 
289
    evaluate(Ts,Spec);
 
290
evaluate([{eval,{M,F,Args}}|Ts],Spec) ->
 
291
    case catch apply(M,F,Args) of
 
292
        {'EXIT',Reason} ->
 
293
            throw({error,{node(),{M,F,length(Args)},Reason}});
 
294
        _ ->
 
295
            ok
 
296
    end,
 
297
    evaluate(Ts,Spec);
 
298
evaluate([],_Spec) ->
 
299
    ok.
 
300
 
270
301
get_global([{alias,Ref,Dir}|Ts],Spec=#testspec{alias=Refs}) ->
271
 
    get_global(Ts,Spec#testspec{alias=[{Ref,get_absname(Dir)}|Refs]});
 
302
    get_global(Ts,Spec#testspec{alias=[{Ref,get_absdir(Dir,Spec)}|Refs]});
272
303
get_global([{node,Ref,Node}|Ts],Spec=#testspec{nodes=Refs}) ->
273
304
    get_global(Ts,Spec#testspec{nodes=[{Ref,Node}|lists:keydelete(Node,2,Refs)]});
274
305
get_global([_|Ts],Spec) -> get_global(Ts,Spec);
275
306
get_global([],Spec) -> Spec.
276
307
 
277
 
get_absname(TestDir) ->
278
 
    AbsName = filename:absname(TestDir),
 
308
get_absfile(FullName,#testspec{spec_dir=SpecDir}) ->
 
309
    File = filename:basename(FullName),
 
310
    Dir = get_absname(filename:dirname(FullName),SpecDir),
 
311
    filename:join(Dir,File).
 
312
 
 
313
get_absdir(Dir,#testspec{spec_dir=SpecDir}) ->
 
314
    get_absname(Dir,SpecDir).
 
315
 
 
316
get_absname(TestDir,SpecDir) ->
 
317
    AbsName = filename:absname(TestDir,SpecDir),
279
318
    TestDirName = filename:basename(AbsName),
280
319
    Path = filename:dirname(AbsName),
281
320
    TopDir = filename:basename(Path),
345
384
%% --- logdir ---
346
385
add_tests([{logdir,all_nodes,Dir}|Ts],Spec) ->
347
386
    Dirs = Spec#testspec.logdir,
348
 
    Tests = [{logdir,N,Dir} || N <- list_nodes(Spec),
349
 
                               lists:keymember(ref2node(N,Spec#testspec.nodes),
350
 
                                               1,Dirs) == false],
 
387
    Tests = [{logdir,N,get_absdir(Dir,Spec)} || 
 
388
                N <- list_nodes(Spec),
 
389
                lists:keymember(ref2node(N,Spec#testspec.nodes),
 
390
                                1,Dirs) == false],
351
391
    add_tests(Tests++Ts,Spec);
352
392
add_tests([{logdir,Nodes,Dir}|Ts],Spec) when is_list(Nodes) ->
353
393
    Ts1 = separate(Nodes,logdir,[Dir],Ts,Spec#testspec.nodes),
354
394
    add_tests(Ts1,Spec);    
355
395
add_tests([{logdir,Node,Dir}|Ts],Spec) ->
356
396
    Dirs = Spec#testspec.logdir,
357
 
    Dirs1 = [{ref2node(Node,Spec#testspec.nodes),Dir} |
 
397
    Dirs1 = [{ref2node(Node,Spec#testspec.nodes),get_absdir(Dir,Spec)} |
358
398
             lists:keydelete(ref2node(Node,Spec#testspec.nodes),1,Dirs)],
359
399
    add_tests(Ts,Spec#testspec{logdir=Dirs1});
360
400
add_tests([{logdir,Dir}|Ts],Spec) ->
369
409
    add_tests(Ts1,Spec);    
370
410
add_tests([{cover,Node,File}|Ts],Spec) ->
371
411
    CoverFs = Spec#testspec.cover,
372
 
    CoverFs1 = [{ref2node(Node,Spec#testspec.nodes),File} |
 
412
    CoverFs1 = [{ref2node(Node,Spec#testspec.nodes),get_absfile(File,Spec)} |
373
413
                lists:keydelete(ref2node(Node,Spec#testspec.nodes),1,CoverFs)],
374
414
    add_tests(Ts,Spec#testspec{cover=CoverFs1});
375
415
add_tests([{cover,File}|Ts],Spec) ->
385
425
add_tests([{config,Node,[F|Fs]}|Ts],Spec) when is_list(F) ->
386
426
    Cfgs = Spec#testspec.config,
387
427
    Node1 = ref2node(Node,Spec#testspec.nodes),
388
 
    add_tests([{config,Node,Fs}|Ts],Spec#testspec{config=[{Node1,F}|Cfgs]});
 
428
    add_tests([{config,Node,Fs}|Ts],
 
429
              Spec#testspec{config=[{Node1,get_absfile(F,Spec)}|Cfgs]});
389
430
add_tests([{config,_Node,[]}|Ts],Spec) ->
390
431
    add_tests(Ts,Spec);
391
432
add_tests([{config,Node,F}|Ts],Spec) ->
451
492
add_tests([{include,Node,[D|Ds]}|Ts],Spec) when is_list(D) ->
452
493
    Dirs = Spec#testspec.include,
453
494
    Node1 = ref2node(Node,Spec#testspec.nodes),
454
 
    add_tests([{include,Node,Ds}|Ts],Spec#testspec{include=[{Node1,D}|Dirs]});
 
495
    add_tests([{include,Node,Ds}|Ts],
 
496
              Spec#testspec{include=[{Node1,get_absdir(D,Spec)}|Dirs]});
455
497
add_tests([{include,_Node,[]}|Ts],Spec) ->
456
498
    add_tests(Ts,Spec);
457
499
add_tests([{include,Node,D}|Ts],Spec) ->