aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/test
AgeCommit message (Collapse)Author
2016-03-15update copyright-yearHenrik Nord
2016-03-07Merge branch 'maint'Björn Gustavsson
* maint: asn1_SUITE_value: Don't test the LDAP module
2016-03-03asn1_SUITE_value: Don't test the LDAP moduleBjörn Gustavsson
asn1ct:test(Mod) will generate sample values for data types in an ASN.1 modules. The following definition from LDAP can cause problems for asn1ct:test/1: Filter ::= CHOICE { and [0] SET SIZE (1..MAX) OF filter Filter, or [1] SET SIZE (1..MAX) OF filter Filter, not [2] Filter, equalityMatch [3] AttributeValueAssertion, substrings [4] SubstringFilter, greaterOrEqual [5] AttributeValueAssertion, lessOrEqual [6] AttributeValueAssertion, present [7] AttributeDescription, approxMatch [8] AttributeValueAssertion, extensibleMatch [9] MatchingRuleAssertion, ... } If we were unlucky (which we were on some computers), the construction of sample values would not terminate. Eliminate the problem for now by not testing the LDAP module. This workaround should be removed when we have added some limitation to the recursion in asn1ct_value when generating values.
2016-02-17Remove out-commented references to the test_server applicationsBjörn Gustavsson
Cleanliness.
2016-02-17Eliminate use of test_server.hrl and test_server_line.hrlBjörn Gustavsson
As a first step to removing the test_server application as as its own separate application, change the inclusion of test_server.hrl to an inclusion of ct.hrl and remove the inclusion of test_server_line.hrl.
2016-02-15Merge branch 'maint'Björn Gustavsson
* maint: asn1: Suppress warnings for improper lists in generated code
2016-02-12asn1: Suppress warnings for improper lists in generated codeBjörn Gustavsson
2016-01-22Merge branch 'maint'Björn Gustavsson
* maint: PER: Correct compilation of named INTEGERs
2016-01-21PER: Correct compilation of named INTEGERsBjörn Gustavsson
When a constrained INTEGER has more than 16536 values and named values, the compiler would crash when compiling to the PER format. Example: Longitude ::= INTEGER { oneMicrodegreeEast(10), oneMicrodegreeWest(-10), unavailable(1800000001) } (-1799999999..1800000001) Reported-by: Ingars
2015-12-11Use 'rand' instead of the obsolete 'random' moduleBjörn Gustavsson
In most cases, we don't have to seed the random number generator, as the rand:uniform/1 takes care about that itself.
2015-11-30BER: Fix encoding of empty named BIT STRINGBjörn Gustavsson
Encoding an empty named BIT STRING would fail for BER. Noticed-by: Svilen Ivanov
2015-06-18Change license text to APLv2Bruce Yinhe
2015-03-20Merge branch 'rickard/time_api/OTP-11997'Rickard Green
* rickard/time_api/OTP-11997: (22 commits) Update primary bootstrap inets: Suppress deprecated warning on erlang:now/0 inets: Cleanup of multiple copies of functions Add inets_lib with common functions used by multiple modules inets: Update comments Suppress deprecated warning on erlang:now/0 Use new time API and be back-compatible in inets Remove unused functions and removed redundant test asn1 test SUITE: Eliminate use of now/0 Disable deprecated warning on erlang:now/0 in diameter_lib Use new time API and be back-compatible in ssh Replace all calls to now/0 in CT with new time API functions test_server: Replace usage of erlang:now() with usage of new API Replace usage of erlang:now() with usage of new API Replace usage of erlang:now() with usage of new API Replace usage of erlang:now() with usage of new API Replace usage of erlang:now() with usage of new API otp_SUITE: Warn for calls to erlang:now/0 Replace usage of erlang:now() with usage of new API Multiple timer wheels Erlang based BIF timer implementation for scalability Implement ethread events with timeout ... Conflicts: bootstrap/bin/start.boot bootstrap/bin/start_clean.boot bootstrap/lib/compiler/ebin/beam_asm.beam bootstrap/lib/compiler/ebin/compile.beam bootstrap/lib/kernel/ebin/auth.beam bootstrap/lib/kernel/ebin/dist_util.beam bootstrap/lib/kernel/ebin/global.beam bootstrap/lib/kernel/ebin/hipe_unified_loader.beam bootstrap/lib/kernel/ebin/inet_db.beam bootstrap/lib/kernel/ebin/inet_dns.beam bootstrap/lib/kernel/ebin/inet_res.beam bootstrap/lib/kernel/ebin/os.beam bootstrap/lib/kernel/ebin/pg2.beam bootstrap/lib/stdlib/ebin/dets.beam bootstrap/lib/stdlib/ebin/dets_utils.beam bootstrap/lib/stdlib/ebin/erl_tar.beam bootstrap/lib/stdlib/ebin/escript.beam bootstrap/lib/stdlib/ebin/file_sorter.beam bootstrap/lib/stdlib/ebin/otp_internal.beam bootstrap/lib/stdlib/ebin/qlc.beam bootstrap/lib/stdlib/ebin/random.beam bootstrap/lib/stdlib/ebin/supervisor.beam bootstrap/lib/stdlib/ebin/timer.beam erts/aclocal.m4 erts/emulator/beam/bif.c erts/emulator/beam/erl_bif_info.c erts/emulator/beam/erl_db_hash.c erts/emulator/beam/erl_init.c erts/emulator/beam/erl_process.h erts/emulator/beam/erl_thr_progress.c erts/emulator/beam/utils.c erts/emulator/sys/unix/sys.c erts/preloaded/ebin/erlang.beam erts/preloaded/ebin/erts_internal.beam erts/preloaded/ebin/init.beam erts/preloaded/src/erts_internal.erl lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl lib/diameter/src/base/diameter_lib.erl lib/kernel/src/os.erl lib/ssh/test/ssh_basic_SUITE.erl system/doc/efficiency_guide/advanced.xml
2015-03-20asn1 test SUITE: Eliminate use of now/0Björn Gustavsson
2015-03-12Merge branch 'maint'Björn Gustavsson
* maint: asn1ct_gen: Correct generation of .hrl files for multiple ellipses Fix BER code generation
2015-03-06asn1ct_gen: Correct generation of .hrl files for multiple ellipsesBjörn Gustavsson
2015-03-06Fix BER code generationDan Gudmundsson
PKIX1Explicit-2009 did not compile. This commit was cherry-picked from 3ab3b07a already merged into master.
2015-01-12Improve error handling for illegal object definitionsBjörn Gustavsson
2015-01-12Remove useless fields in #state{}Björn Gustavsson
Three fields ('type','value', and 'vname') are almost unused. They are set, but almost never read. Eliminate the last remaining uses and the fields themselves.
2015-01-12Further improve error handling for instatiation of parameterized typesDan Gudmundsson
2015-01-12asn1ct_tok: Clean upBjörn Gustavsson
2015-01-12Add a test case for EXTENSIBILITY IMPLIEDBjörn Gustavsson
2015-01-12asn1ct_parser2: Clean up error handling and reportingBjörn Gustavsson
Errors were reported using a throw like this: throw({asn1_error,{get_line(hd(Tokens)),get(asn1_module), [got,get_token(hd(Tokens)),expected,typereference]}}). The attempt to tell the user what was expected was often mis-leading. It is time-consuming and non-trival to provide correct information of what is expected. Therefore, we will not even try. Instead we will spend more effort to report the token where the error was discovered. We will replace each throw with a function call: parse_error(Tokens). Also add the syntax_SUITE test suite to test error reporting and to cover all error reporting code. Remove the old c_syntax/1 test case. Also remove all out-commented code.
2015-01-12Move checking of UNIQUE & DEFAULT error to asn1ct_checkBjörn Gustavsson
To keep the error reporting code in asn1ct_parser2 simple, we only want to handle pure syntactic errors. Therefore, move the check that UNIQUE and DEFAULT are not applied to the same field to asn1ct_check.
2015-01-12Strengthen the test of selection typesBjörn Gustavsson
"SET OF id < Type" was not tested. Also make sure that all of assigned values are correct.
2015-01-12Modernize error handling for SEQUENCEDan Gudmundsson
While we are at it, also remove an unreachable (too many extensions) error case.
2015-01-12Modernize error handling for CHOICEDan Gudmundsson
2015-01-12Modernize error handling for BOOLEANDan Gudmundsson
2015-01-12Modernize error handling for named valuesDan Gudmundsson
2015-01-12Rewrite checking of ENUMERATEDBjörn Gustavsson
Clean up the checking of ENUMERATED and modernize the error reporting. Also eliminate the unused constraints argument for check_enumerated().
2015-01-12BER: Fix ENUMERATED with negative valuesBjörn Gustavsson
The ASN.1 compiler would go into an infinite loop if a value in an ENUMERATED was negative.
2015-01-12Modernize error handling for illicit tagsBjörn Gustavsson
2015-01-12Modernize error handling for instatiation of parameterized typesBjörn Gustavsson
2015-01-12Clean up get_unique_fieldname/2Dan Gudmundsson
get_unique_fieldname/2 would throw an exception that *all* callers would catch and handle. Since all callers catch the exception, it is much easier to return a special return value. Also use the new error reporting style. While we are at it, remove all catches of {asn1,Error} which are no longer thrown.
2015-01-12Clean up error reporting for duplicate tagsDan Gudmundsson
Split the test case duplicate_tags/1 into two parts. Do the error checking test in error_SUITE. Keep the SeqOptional2 specification and compile it from the per/1 and ber_other/1 test cases (for coverage).
2015-01-12asn1: Rewrite error handling for EXPORT to new styleDan Gudmundsson
2015-01-12asn1: Fix error reporting for the EXTERNAL typeDan Gudmundsson
Change to new error handling system and cover with tests.
2015-01-12asn1: Fix import checking codeDan Gudmundsson
All errors were not reported. Furthermore, get_referenced_type/2 will report errors if any module is missing, so the attempt to report additional errors in chained_import/4 would not find any errors.
2015-01-12Rewrite constraint handlingBjörn Gustavsson
The internal representation for constraints (and object sets) as produced by the parser was awkward, making further processing convoluted. Here follows some examples of the old representation for INTEGER constraints. The constraint 1..2 is represented as: {'ValueRange',{1,2}} If we extend the constraint like this: 1..2, ..., or like this: 1..2, ..., 3 the representation would be: {{'ValueRange',{1,2}},[]} and {{'ValueRange',{1,2}},{'SingleValue',3}} respectively. Note that the pattern {A,B} will match all these constraints. When combining constraints using set operators: 1..2 | 3..4 ^ 5..6 the representation will no longer be a tuple but a list: [{'ValueRange',{1..2}} union {'ValueRange',{3..4}} intersection {'ValueRange',{5..6}}] The parse has full knowledge of the operator precedence; unfortunately, the following pass (asn1ct_check) must also have the same knowledge in order to correctly evaluate the constraints. If we would change the order of the evaulation with round brackets: (1..2 | 3..4) ^ 5..6 there would be a nested listed in the representation: [[{'ValueRange',{1..2}} union {'ValueRange',{3..4}}] intersection {'ValueRange',{5..6}}] We will change the representation to make it more explicit. At the outer level, a constraint is always represented as {element_set,Root,Extension} Extension will be 'none' if there is no extension, and 'empty' if there is an empty extension. Root may also be 'empty' in an object set if there are no objects in the root. Thus the constraints: 1..2 1..2, ... 1..2, ..., 3 will be represented as: {element_set,{'ValueRange',{1,2}},none} {element_set,{'ValueRange',{1,2}},empty} {element_set,{'ValueRange',{1,2}},{'SingleValue',3}} We will change the set operators too. This constraint: 1..2 | 3..4 ^ 5..6 will be represented as: {element_set, {union, {'ValueRange',{1,2}}, {intersection, {'ValueRange',{3,4}}, {'ValueRange',{5,6}}}, none}} which is trivial to understand and evaluate. Similarly: (1..2 | 3..4) ^ 5..6 will be represented as: {element_set, {intersection, {union,{'ValueRange',{1,2}},{'ValueRange',{3,4}}}, {'ValueRange',{5,6}}}, none}
2015-01-12Strengthen the constraint_equivalence test caseBjörn Gustavsson
Instead of only compiling to the abstract format using 'abs', also compile to each of the back-ends.
2015-01-12Get rid of the test case for warnings_as_errorsBjörn Gustavsson
The warnings in the ASN.1 are being eliminated one by one and replaced with errors. Therefore, it is no longer possible to test warnings_as_errors. We will reimplement this test case in the future if we will introduce some new sensible warnings.
2015-01-12Add the other PKCS files to the rfcs test caseDan Gudmundsson
Changed the following from the original copies: PKCS-5 (renamed from PKCS-v21) PKCS-9 Import from CryptographicMessageSyntax-2009 instead of CryptographicMessageSyntax Since most of the files from the x420 directory are needed, copy all of them into the rfcs directory and remove the x420 directory and test case. Copy the test of OTP-7759 to the testRfcs test case.
2015-01-12Clean up checking of object setsBjörn Gustavsson
2015-01-12Fix several levels of inlined definitionsBjörn Gustavsson
2015-01-12Rewrite handling of ObjectSetFromObjectsBjörn Gustavsson
The ObjectSetFromObjects construct is implemented using the object_set_from_objects() function, which is similar to get_fieldname_element(). Rewrite the ObjectSetFromObjects handling to use get_fieldname_element() to share more code.
2015-01-12Clean up and correct table constraint handlingBjörn Gustavsson
2015-01-12Correct another bug with instantiated typesBjörn Gustavsson
a1260b2ffa60581ce3af0728320b593cca3fd7b0 fixed a problem with expansion of parameterized types, but it didn't go all the way. The compiler would still crash if we attempted to define a value using the instantiated type.
2015-01-12Fix instantiation of an inlined type in a value definitionBjörn Gustavsson
2015-01-12Clean up constraint checkingBjörn Gustavsson
2015-01-12Use recursive get_referenced_type to get classdef directlyDan Gudmundsson
To be sure that indirect references to classes are solved.