~ubuntu-branches/ubuntu/trusty/erlang/trusty

« back to all changes in this revision

Viewing changes to lib/common_test/test/ct_config_SUITE_data/config/test/config_static_SUITE.erl

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum
  • Date: 2011-05-05 15:48:43 UTC
  • mfrom: (3.5.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110505154843-0om6ekzg6m7ugj27
Tags: 1:14.b.2-dfsg-3ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to.
  - 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.
  - debian/patches/series: Do what I meant, and enable build-options.patch
    instead.
* Additional changes:
  - Drop erlang-wx from -et
* Dropped Changes:
  - patches/pcre-crash.patch: CVE-2008-2371: outer level option with
    alternatives caused crash. (Applied Upstream)
  - fix for ssl certificate verification in newSSL: 
    ssl_cacertfile_fix.patch (Applied Upstream)
  - debian/patches/series: Enable native.patch again, to get stripped beam
    files and reduce the package size again. (build-options is what
    actually accomplished this)
  - Remove build-options.patch on advice from upstream and because it caused
    odd build failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%%
 
2
%% %CopyrightBegin%
 
3
%%
 
4
%% Copyright Ericsson AB 2010. All Rights Reserved.
 
5
%%
 
6
%% The contents of this file are subject to the Erlang Public License,
 
7
%% Version 1.1, (the "License"); you may not use this file except in
 
8
%% compliance with the License. You should have received a copy of the
 
9
%% Erlang Public License along with this software. If not, it can be
 
10
%% retrieved online at http://www.erlang.org/.
 
11
%%
 
12
%% Software distributed under the License is distributed on an "AS IS"
 
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 
14
%% the License for the specific language governing rights and limitations
 
15
%% under the License.
 
16
%%
 
17
%% %CopyrightEnd%
 
18
%%
 
19
 
 
20
%%%-------------------------------------------------------------------
 
21
%%% File: config_static_SUITE
 
22
%%%
 
23
%%% Description:
 
24
%%% Test suite for common_test which tests the get_config and require
 
25
%%% functionality
 
26
%%%-------------------------------------------------------------------
 
27
-module(config_static_SUITE).
 
28
 
 
29
-compile(export_all).
 
30
 
 
31
-include_lib("common_test/include/ct.hrl").
 
32
 
 
33
% The config contains variables:
 
34
% x - atom
 
35
% gen_cfg - list with two key-values tagged with a and b
 
36
% gen_cfg2 - list of five key-values tagged with c, d, e, f and g
 
37
% gen_cfg3 - list of two complex key-values taggen with:
 
38
%       h: three elements inside - i, j and k
 
39
%       l: m inside, contains n and o
 
40
 
 
41
suite() ->
 
42
    [
 
43
     {timetrap, {seconds,10}},
 
44
     %% x1 doesn't exist in cfg-file!
 
45
     {require, x1, x},
 
46
     {require, gen_cfg3},
 
47
     {require, alias, gen_cfg},
 
48
     %% x1 default value
 
49
     {x1, {x,suite}}
 
50
    ].
 
51
 
 
52
init_per_suite(Config) ->
 
53
    Config.
 
54
 
 
55
end_per_suite(_) ->
 
56
    ok.
 
57
 
 
58
all() -> [test_get_config_simple, test_get_config_nested, test_default_suitewide,
 
59
          test_config_name_already_in_use1, test_default_tclocal,
 
60
          test_config_name_already_in_use2, test_alias_tclocal,
 
61
          test_get_config_undefined].
 
62
 
 
63
init_per_testcase(_, Config) ->
 
64
    Config.
 
65
 
 
66
end_per_testcase(_, _) ->
 
67
    ok.
 
68
 
 
69
%% test getting a simple value
 
70
test_get_config_simple(_)->
 
71
    suite = ct:get_config(x),
 
72
    ok.
 
73
 
 
74
%% test getting a nested value
 
75
test_get_config_nested(_)->
 
76
    a_value = ct:get_config({gen_cfg, a}),
 
77
    ok.
 
78
 
 
79
%% test suite-wide default value
 
80
test_default_suitewide(_)->
 
81
    suite = ct:get_config(x1),
 
82
    ok.
 
83
 
 
84
%% should get skipped
 
85
test_config_name_already_in_use1() ->
 
86
    [{timetrap, {seconds,2}},
 
87
     {require, x1, x},
 
88
     {x1, {x,test2}}].
 
89
test_config_name_already_in_use1(_) ->
 
90
    ct:fail("Test should've been skipped, you shouldn't see this!"),
 
91
    ok.
 
92
 
 
93
%% test defaults in a testcase
 
94
test_default_tclocal() ->
 
95
    [{timetrap, {seconds,3}},
 
96
     {require, y1, y},
 
97
     {y1, {y,test3}}].
 
98
test_default_tclocal(_) ->
 
99
    test3 = ct:get_config(y1),
 
100
    ok.
 
101
 
 
102
%% should get skipped
 
103
test_config_name_already_in_use2() ->
 
104
    [{require,alias,something},
 
105
     {alias,{something,else}},
 
106
     {require, x1, x},
 
107
     {x1, {x,test4}}].
 
108
test_config_name_already_in_use2(_) ->
 
109
    ct:fail("Test should've been skipped, you shouldn't see this!"),
 
110
    ok.
 
111
 
 
112
%% test aliases
 
113
test_alias_tclocal() ->
 
114
    [{require,newalias,gen_cfg}].
 
115
test_alias_tclocal(_) ->
 
116
    A = [{a,a_value},{b,b_value}] = ct:get_config(newalias),
 
117
    A = ct:get_config(gen_cfg),
 
118
    ok.
 
119
 
 
120
%% test for getting undefined variables
 
121
test_get_config_undefined(_) ->
 
122
    undefined = ct:get_config(y1),
 
123
    ok.