Permalink
Browse files

Merge branch 'alind/asn1/parallel-tests' into maint

* alind/asn1/parallel-tests:
  [asn1] Refactor test cases and remove extra suites
  [asn1] Replace 'driver' option with 'nif'
  [asn1] Correct test suite dependencies
  [asn1] Parallelize test suites
  [asn1] Make tables and processes unnamed
  [asn1] Abstract out table access to new module
  [asn1] Run asn1 compilation in a separate process
  • Loading branch information...
Adam Lindberg
Adam Lindberg committed Feb 29, 2012
2 parents cc3122a + 9ec0a0b commit eda0a2d866060b18af6f06abbc9ea9e920de43b7
Showing with 2,537 additions and 4,951 deletions.
  1. +2 −2 lib/asn1/c_src/asn1_erl_nif.c
  2. +58 −36 lib/asn1/doc/src/asn1ct.xml
  3. +3 −2 lib/asn1/src/Makefile
  4. +118 −139 lib/asn1/src/asn1_db.erl
  5. +214 −219 lib/asn1/src/asn1ct.erl
  6. +22 −37 lib/asn1/src/asn1ct_check.erl
  7. +5 −6 lib/asn1/src/asn1ct_gen.erl
  8. +2 −2 lib/asn1/src/asn1ct_gen_ber_bin_v2.erl
  9. +41 −48 lib/asn1/src/asn1ct_name.erl
  10. +27 −10 lib/asn1/src/asn1ct_parser2.erl
  11. +76 −0 lib/asn1/src/asn1ct_table.erl
  12. +43 −36 lib/asn1/src/asn1ct_value.erl
  13. +4 −40 lib/asn1/test/Makefile
  14. +1,511 −0 lib/asn1/test/asn1_SUITE.erl
  15. +0 −2,392 lib/asn1/test/asn1_SUITE.erl.src
  16. +2 −2 lib/asn1/test/asn1_app_test.erl
  17. +0 −2 lib/asn1/test/asn1_bin_particular_SUITE.erl.src
  18. +0 −95 lib/asn1/test/asn1_common_SUITE.erl.src
  19. +0 −10 lib/asn1/test/asn1_particular_SUITE.erl.src
  20. +58 −2 lib/asn1/test/asn1_test_lib.erl
  21. +2 −11 lib/asn1/test/ber_decode_error.erl
  22. +20 −122 lib/asn1/test/h323test.erl
  23. +20 −274 lib/asn1/test/{asn1_bin_v2_particular_SUITE.erl.src → pem_performance.erl}
  24. +1 −11 lib/asn1/test/testChoExtension.erl
  25. +7 −7 lib/asn1/test/testChoExternal.erl
  26. +1 −14 lib/asn1/test/testChoOptional.erl
  27. +1 −13 lib/asn1/test/testChoOptionalImplicitTag.erl
  28. +1 −12 lib/asn1/test/testChoPrim.erl
  29. +1 −12 lib/asn1/test/testChoRecursive.erl
  30. +1 −13 lib/asn1/test/testChoTypeRefCho.erl
  31. +1 −13 lib/asn1/test/testChoTypeRefPrim.erl
  32. +1 −12 lib/asn1/test/testChoTypeRefSeq.erl
  33. +1 −12 lib/asn1/test/testChoTypeRefSet.erl
  34. +1 −14 lib/asn1/test/testChoiceIndefinite.erl
  35. +1 −19 lib/asn1/test/testCompactBitString.erl
  36. +1 −14 lib/asn1/test/testConstraints.erl
  37. +5 −15 lib/asn1/test/testContextSwitchingTypes.erl
  38. +1 −10 lib/asn1/test/testDER.erl
  39. +2 −15 lib/asn1/test/testDeepTConstr.erl
  40. +1 −12 lib/asn1/test/testDef.erl
  41. +1 −13 lib/asn1/test/testDoubleEllipses.erl
  42. +1 −10 lib/asn1/test/testEnumExt.erl
  43. +0 −35 lib/asn1/test/testExternal.erl
  44. +2 −13 lib/asn1/test/testINSTANCE_OF.erl
  45. +2 −38 lib/asn1/test/testInfObj.erl
  46. +2 −14 lib/asn1/test/testInfObjectClass.erl
  47. +8 −15 lib/asn1/test/testMegaco.erl
  48. +2 −20 lib/asn1/test/testMergeCompile.erl
  49. +0 −44 lib/asn1/test/testMvrasn6.erl
  50. +16 −71 lib/asn1/test/testNBAPsystem.erl
  51. +1 −12 lib/asn1/test/testOpenTypeImplicitTag.erl
  52. +1 −19 lib/asn1/test/testParamBasic.erl
  53. +2 −12 lib/asn1/test/testParameterizedInfObj.erl
  54. +1 −14 lib/asn1/test/testPrim.erl
  55. +1 −12 lib/asn1/test/testPrimExternal.erl
  56. +1 −18 lib/asn1/test/testPrimStrings.erl
  57. +0 −52 lib/asn1/test/testRANAP.erl
  58. +0 −36 lib/asn1/test/testROSE.erl
  59. +25 −46 lib/asn1/test/testSSLspecs.erl
  60. +1 −10 lib/asn1/test/testSelectionTypes.erl
  61. +1 −10 lib/asn1/test/testSeq2738.erl
  62. +1 −11 lib/asn1/test/testSeqDefault.erl
  63. +1 −12 lib/asn1/test/testSeqExtension.erl
  64. +1 −10 lib/asn1/test/testSeqIndefinite.erl
  65. +1 −14 lib/asn1/test/testSeqOf.erl
  66. +1 −13 lib/asn1/test/testSeqOfCho.erl
  67. +1 −33 lib/asn1/test/testSeqOfIndefinite.erl
  68. +1 −14 lib/asn1/test/testSeqOfTag.erl
  69. +1 −12 lib/asn1/test/testSeqOptional.erl
  70. +1 −11 lib/asn1/test/testSeqPrim.erl
  71. +1 −10 lib/asn1/test/testSeqSetDefaultVal.erl
  72. +1 −12 lib/asn1/test/testSeqTag.erl
  73. +1 −12 lib/asn1/test/testSeqTypeRefCho.erl
  74. +1 −11 lib/asn1/test/testSeqTypeRefSeq.erl
  75. +1 −11 lib/asn1/test/testSeqTypeRefSet.erl
  76. +1 −12 lib/asn1/test/testSetDefault.erl
  77. +1 −13 lib/asn1/test/testSetExternal.erl
  78. +1 −10 lib/asn1/test/testSetIndefinite.erl
  79. +1 −11 lib/asn1/test/testSetOf.erl
  80. +1 −11 lib/asn1/test/testSetOfCho.erl
  81. +1 −11 lib/asn1/test/testSetOfExternal.erl
  82. +1 −11 lib/asn1/test/testSetOfTag.erl
  83. +2 −14 lib/asn1/test/testSetOptional.erl
  84. +1 −11 lib/asn1/test/testSetPrim.erl
  85. +1 −12 lib/asn1/test/testSetTag.erl
  86. +1 −11 lib/asn1/test/testSetTypeRefCho.erl
  87. +1 −11 lib/asn1/test/testSetTypeRefPrim.erl
  88. +1 −11 lib/asn1/test/testSetTypeRefSeq.erl
  89. +1 −11 lib/asn1/test/testSetTypeRefSet.erl
  90. +14 −24 lib/asn1/test/testTCAP.erl
  91. +41 −49 lib/asn1/test/testTcapsystem.erl
  92. +1 −7 lib/asn1/test/testTimer.erl
  93. +37 −54 lib/asn1/test/testTypeValueNotation.erl
  94. +14 −25 lib/asn1/test/testX420.erl
  95. +0 −29 lib/asn1/test/test_bad_values.erl
  96. +2 −11 lib/asn1/test/test_compile_options.erl
  97. +5 −18 lib/asn1/test/test_driver_load.erl
  98. +33 −48 lib/asn1/test/test_inline.erl
  99. +2 −10 lib/asn1/test/test_modified_x420.erl
  100. +4 −35 lib/asn1/test/test_partial_incomplete_decode.erl
  101. +4 −7 lib/asn1/test/test_selective_decode.erl
  102. +2 −17 lib/asn1/test/test_special_decode_performance.erl
  103. +24 −36 lib/asn1/test/test_undecoded_rest.erl
  104. +1 −16 lib/asn1/test/test_x691.erl
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
* Copyright Ericsson AB 2002-2011. All Rights Reserved.
* Copyright Ericsson AB 2002-2012. All Rights Reserved.
*
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
@@ -1197,7 +1197,7 @@ static ERL_NIF_TERM encode_per_complete(ErlNifEnv* env, int argc,
ErlNifBinary out_binary;
int complete_len;
if (!enif_inspect_iolist_as_binary(env, argv[0], &in_binary))
return enif_make_atom(env, "badarg");
return enif_make_badarg(env);
if (!enif_alloc_binary(in_binary.size, &out_binary))
return enif_make_atom(env, "alloc_binary_failed");
@@ -4,7 +4,7 @@
<erlref>
<header>
<copyright>
<year>1997</year><year>2011</year>
<year>1997</year><year>2012</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -44,15 +44,15 @@
</description>
<funcs>
<func>
<name>compile(Asn1module) -> ok | {error,Reason}</name>
<name>compile(Asn1module , Options) -> ok | {error,Reason}</name>
<name>compile(Asn1module) -> ok | {error, Reason}</name>
<name>compile(Asn1module, Options) -> ok | {error, Reason}</name>
<fsummary>Compile an ASN.1 module and generate encode/decode functions according to the encoding rules BER or PER.</fsummary>
<type>
<v>Asn1module = atom() | string()</v>
<v>Options = [Option| OldOption]</v>
<v>Option = ber_bin | per_bin | uper_bin | der | compact_bit_string |
noobj | {n2n,EnumTypeName} |{outdir,Dir} | {i,IncludeDir} | optimize |
nif | asn1config | undec_rest | {inline,OutputName} | inline |
<v>Option = ber_bin | per_bin | uper_bin | der | compact_bit_string |
noobj | {n2n, EnumTypeName} |{outdir, Dir} | {i, IncludeDir} | optimize |
nif | asn1config | undec_rest | {inline, OutputName} | inline |
{macro_name_prefix, Prefix} | {record_name_prefix, Prefix} | verbose | warnings_as_errors</v>
<v>OldOption = ber | per</v>
<v>Reason = term()</v>
@@ -158,7 +158,7 @@ File3.asn </pre>
of the BIT STRING type in Erlang. The notation:
</p>
<pre>
BitString = {Unused,Binary},
BitString = {Unused, Binary},
Unused = integer(),
Binary = binary()
</pre>
@@ -172,7 +172,7 @@ Binary = binary()
</seealso>.
</p>
</item>
<tag><c>{n2n,EnumTypeName}</c></tag>
<tag><c>{n2n, EnumTypeName}</c></tag>
<item>
<p>
Tells the compiler to generate functions for conversion between
@@ -190,17 +190,17 @@ Binary = binary()
<c>.erl</c> file. If this option is omitted the generated Erlang module
will be compiled.</p>
</item>
<tag><c>{i,IncludeDir}</c></tag>
<tag><c>{i, IncludeDir}</c></tag>
<item>
<p>Adds <c>IncludeDir</c> to the search-path for
<c>.asn1db</c> and asn1 source files. The compiler tries
to open a <c>.asn1db</c> file when a module imports
definitions from another ASN.1 module. If no
<c>.asn1db</c> file is found the asn1 source file is
parsed. Several <c>{i,IncludeDir}</c> can be given.
parsed. Several <c>{i, IncludeDir}</c> can be given.
</p>
</item>
<tag><c>{outdir,Dir}</c></tag>
<tag><c>{outdir, Dir}</c></tag>
<item>
<p>Specifies the directory <c>Dir</c> where all generated files
shall be placed. If omitted the files are placed in the
@@ -251,11 +251,11 @@ Binary = binary()
also have some following bytes. Now it is possible to get
those following bytes returned together with the decoded
value. If an asn1 spec is compiled with this option a tuple
<c>{ok,Value,Rest}</c> is returned. <c>Rest</c> may be a
<c>{ok, Value, Rest}</c> is returned. <c>Rest</c> may be a
list or a binary. Earlier versions of the compiler ignored
those following bytes.</p>
</item>
<tag><c>{inline,OutputName}</c></tag>
<tag><c>{inline, OutputName}</c></tag>
<item>
<p>Compiling with this option gives one output module
containing all asn1 run-time functionality. The asn1 specs
@@ -267,7 +267,7 @@ Binary = binary()
by the <c>igor</c> module of <c>syntax_tools</c>. By default
the functions generated from the first asn1 spec in the
<c>.set.asn</c> are exported, unless a
<c>{export,[atom()]}</c> or <c>{export_all,true}</c> option
<c>{export, [atom()]}</c> or <c>{export_all, true}</c> option
are provided. The list of atoms are names of chosen asn1
specs from the <c>.set.asn</c> file. </p>
<p>When used together with <c>nif</c> for <c>ber_bin</c>, the
@@ -278,7 +278,7 @@ Binary = binary()
<tag><c>inline</c></tag>
<item>
<p>It is also possible to use the sole argument <c>inline</c>.
It is as <c>{inline,OutputName}</c>, but the output file gets the
It is as <c>{inline, OutputName}</c>, but the output file gets the
default name of the source <c>.set.asn</c> file.</p>
</item>
<tag><c>{macro_name_prefix, Prefix}</c></tag>
@@ -322,7 +322,7 @@ Binary = binary()
</desc>
</func>
<func>
<name>encode(Module,Type,Value)-> {ok,Bytes} | {error,Reason}</name>
<name>encode(Module, Type, Value)-> {ok, Bytes} | {error, Reason}</name>
<fsummary>Encode an ASN.1 value.</fsummary>
<type>
<v>Module = Type = atom()</v>
@@ -337,13 +337,13 @@ Binary = binary()
encode function only performs rudimentary tests that the input
<c>Value</c>
is a correct instance of <c>Type</c>. The length of strings is for example
not always checked. Returns <c>{ok,Bytes}</c> if successful or
<c>{error,Reason}</c> if an error occurred.
not always checked. Returns <c>{ok, Bytes}</c> if successful or
<c>{error, Reason}</c> if an error occurred.
</p>
</desc>
</func>
<func>
<name>decode(Module,Type,Bytes) -> {ok,Value}|{error,Reason}</name>
<name>decode(Module, Type, Bytes) -> {ok, Value} | {error, Reason}</name>
<fsummary>Decode from Bytes into an ASN.1 value.</fsummary>
<type>
<v>Module = Type = atom()</v>
@@ -352,11 +352,11 @@ Binary = binary()
</type>
<desc>
<p>Decodes <c>Type</c> from <c>Module</c> from the list of bytes
<c>Bytes</c>. Returns <c>{ok,Value}</c> if successful.</p>
<c>Bytes</c>. Returns <c>{ok, Value}</c> if successful.</p>
</desc>
</func>
<func>
<name>value(Module ,Type) -> {ok,Value} | {error,Reason}</name>
<name>value(Module, Type) -> {ok, Value} | {error, Reason}</name>
<fsummary>Create an ASN.1 value for test purposes.</fsummary>
<type>
<v>Module = Type = atom()</v>
@@ -371,26 +371,48 @@ Binary = binary()
</desc>
</func>
<func>
<name>test(Module) -> ok | {error,Reason}</name>
<name>test(Module,Type) -> ok | {error,Reason}</name>
<name>test(Module,Type,Value) -> ok | {error,Reason}</name>
<fsummary>Perform a test of encode and decode for types in an ASN.1 module.</fsummary>
<name>test(Module) -> ok | {error, Reason}</name>
<name>test(Module, Type | Options) -> ok | {error, Reason}</name>
<name>test(Module, Type, Value | Options) -> ok | {error, Reason}</name>
<fsummary>Perform a test of encode and decode for types in an ASN.1 module.</fsummary>
<type>
<v>Module = Type = atom()</v>
<v>Value = term()</v>
<v>Options = [{i, IncludeDir}]</v>
<v>Reason = term()</v>
</type>
<desc>
<p>Performs a test of encode and decode of all types in <c>Module</c>.
<p>Performs a test of encode and decode of types in <c>Module</c>.
The generated functions are called by this function.
This function is useful during test to secure that the generated
encode and decode functions and the general runtime support work
as expected. <br></br>
<c>test/1</c> iterates over all types in <c>Module</c>. <br></br>
<c>test/2</c> tests type <c>Type</c> with a random value. <br></br>
<c><![CDATA[test/3 tests type <c>Type]]></c> with <c>Value</c>. <br></br>
encode and decode functions and the general runtime support work
as expected.</p>
<list type="bulleted">
<item>
<p><c>test/1</c> iterates over all types in <c>Module</c>.</p>
</item>
<item>
<p><c>test/2</c> tests type <c>Type</c> with a random value.</p>
</item>
<item>
<p><c>test/3</c> tests type <c>Type</c> with <c>Value</c>.</p>
</item>
</list>
Schematically the following happens for each type in the module.</p>
<p></p>
<p>Schematically the following happens for each type in the module:
<code type="none">
{ok,Value} = asn1ct:value(Module,Type),
{ok,Bytes} = asn1ct:encode(Module,Type,Value),
{ok,Value} = asn1ct:decode(Module,Type,Bytes). </code>
{ok, Value} = asn1ct:value(Module, Type),
{ok, Bytes} = asn1ct:encode(Module, Type, Value),
{ok, Value} = asn1ct:decode(Module, Type, Bytes).</code></p>
<p>The <c>test</c> functions utilizes the <c>*.asn1db</c> files
for all included modules. If they are located in a different
directory than the current working directory, use the include
option to add paths. This is only needed when automatically
generating values. For static values using <c>Value</c> no
options are needed.</p>
</desc>
</func>
</funcs>
View
@@ -1,7 +1,7 @@
#
# %CopyrightBegin%
#
# Copyright Ericsson AB 1997-2011. All Rights Reserved.
# Copyright Ericsson AB 1997-2012. All Rights Reserved.
#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
@@ -58,7 +58,8 @@ CT_MODULES= \
asn1ct_gen_ber_bin_v2 \
asn1ct_value \
asn1ct_tok \
asn1ct_parser2
asn1ct_parser2 \
asn1ct_table
RT_MODULES= \
asn1rt \
Oops, something went wrong.

0 comments on commit eda0a2d

Please sign in to comment.