aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/test
AgeCommit message (Collapse)Author
2019-03-22Merge pull request #2159 from dotsimon/asn1_pedefsIngela Andin
ASN.1: fix various problems with value definitions OTP-15697
2019-02-25Test compiling value of SEQUENCE OF CHOICE with extensionsSimon Cornish
2019-02-25Test compiling value of CHOICE with extensionsSimon Cornish
2019-02-25Add test for DEFAULT used with OCTET STRINGSimon Cornish
2018-12-06Merge branch 'maint'Raimo Niskanen
2018-12-04Handle erroneous length during decode (BER only) without crashingKenneth Lundin
2018-08-03Merge branch 'maint'Raimo Niskanen
* maint: Updated OTP version Prepare release Fix NIF stack recursion bug and enforce a limit
2018-08-03Merge branch 'maint-20' into maintRaimo Niskanen
* maint-20: Updated OTP version Prepare release Fix NIF stack recursion bug and enforce a limit Conflicts: OTP_VERSION lib/asn1/doc/src/notes.xml lib/asn1/vsn.mk otp_versions.table
2018-08-02Fix NIF stack recursion bug and enforce a limitRaimo Niskanen
Fix recursion bug when decoding Constructed value within another value - here the allowed buffer for the recursed decode shall only be the size of the enclosing value, not the whole buffer. Return ASN1_ERROR if BER decode recurses more than about 8 kWords.
2018-07-27Change "can not" into "cannot"Raimo Niskanen
I did not find any legitimate use of "can not", however skipped changing e.g RFCs archived in the source tree.
2018-06-18Update copyright yearHenrik Nord
2018-04-16asn1: Eliminate use of erlang:get_stacktrace/0Björn Gustavsson
Also eliminate use of erlang:get_stacktrace/0 in code generated by the ASN.1 compiler.
2018-01-17asn1_SUITE: Fix failure in xref_export_all/1Björn Gustavsson
The variable 'S' was used twice. If the test case failed because there were unused functions in asn1_SUITE, there would be an ugly badmatch exception instead of the intended nice error message.
2017-09-12asn1: Fix test suite deprecated functionsLukas Larsson
2017-08-24Merge branch 'maint-20' into maintRaimo Niskanen
* maint-20: Updated OTP version Prepare release Accept non-binary options as socket-options Bump version Fix broken handling of default values in extensions for PER compiler: Fix live regs update on allocate in validator Take fail labels into account when determining liveness in block ops Check for overflow when appending binaries, and error out with system_limit
2017-08-16Fix broken handling of default values in extensions for PERBjörn Gustavsson
Default values have never worked in extension for PER. Note that for default values in the root part of SEQUENCE, giving a value equal to the DEFAULT value, will result in the same encoding as if asn1_DEFAULT was given. However, that behavior is not promised by the documentation. The documentation says that asn1_DEFAULT should be used for default values. For DEFAULT in extensions, only implement what the documentation promises and nothing more. ERIERL-60
2017-07-27Merge branch 'maint-20' into maintJohn Högberg
* maint-20: Updated OTP version Update release notes Update version numbers Fix doc for the 'quiet' option; it defaults to false asn1: Fix missing quotes of external encoding call Add a dedicated close function for TCP ports to prevent issues like ERL-430/448 Close TCP ports properly on send timeout erts: Add missing release note
2017-07-20asn1: Fix missing quotes of external encoding callSverker Eriksson
introduced by 8e4a9864385242b962ce7446f7daa4f58cfecca5.
2017-07-04Corrected behavior of option {n2n, EnumTypeName} whenKenneth Lundin
EnumTypeName contains a hypen like fore example Cause-Misc. This caused syntax errors when compiling the generated Erlang code.
2017-05-04Update copyright yearRaimo Niskanen
2017-03-14asn1_erl_nif.c: Correct handling of tags >= 16384Björn Gustavsson
Tags number above 16383 were not decoded correctly in ber_decode_tag(). We could fix the problem, but there does not seem to be any need. First, the only way that high tag numbers can be created is with manual tagging; after 1994 manual tagging is no longer recommended. Second, the ASN.1 playground (http://asn1-playground.oss.com) only supports tags up to 16383 (the same is presumably true for OSS Nokalva's other tools). Therefore, clean up the existing code and make it an explicit 'invalid_tag' error when tags above 13383 are encountered (instead of an implicit 'wrong_tag' error).
2017-03-01Fix typos: lenght -> lengthMyron Marston
2017-02-21encode/decode: Include the stack trace in error returnsBjörn Gustavsson
The generated encode/2 and decode/2 functions can return cryptic error messages. Consider this ASN.1 spec: T DEFINITIONS AUTOMATIC TAGS ::= BEGIN S ::= SEQUENCE { b BOOLEAN, i INTEGER (1..100), j INTEGER (0..7), s OCTET STRING } END In OTP 19, the error terms will look like this: Eshell V8.2 (abort with ^G) 1> asn1ct:compile('T', [ber]). ok 2> rr('T'). ['S'] 3> 'T':encode('S', #'S'{}). {error,{asn1,{encode_boolean,undefined}}} 4> 'T':encode('S', #'S'{b=false}). {error,{asn1,{encode_integer,undefined}}} 5> 'T':encode('S', #'S'{b=false,i=7,j=0}). {error,{asn1,function_clause}} Some error terms are clearer than other. In the first error term, it is clear that the error refers to the 'b' field, since there is only one BOOLEAN in 'S'. The second error term could refer to either 'i' or 'j'. The last error term... well... in this case we can infer that it must refer to 's'. The easiest way to provide more information is to include the stack trace with line numbers in the error term: 3> 'T':encode('S', #'S'{b=false}). {error,{asn1,{{encode_integer,undefined}, [{'T',encode_integer,2,[{file,"T.erl"},{line,240}]}, {'T',enc_S,2,[{file,"T.erl"},{line,102}]}, {'T',encode,2,[{file,"T.erl"},{line,36}]}, {erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,674}]}, {shell,exprs,7,[{file,"shell.erl"},{line,686}]}, {shell,eval_exprs,7,[{file,"shell.erl"},{line,641}]}, {shell,eval_loop,3,[{file,"shell.erl"},{line,626}]}]}}} By looking at the generated Erlang code, we can see that encoding failed for 'i'. This is an compatible change. All that the documentation says is that the format of the error tuple is: {error,{asn1,Description}} With this change, Description is always a tuple: {ErrorDescription,StackTrace} Alternatives considered: Providing more information in the error term itself and make sure there can be no 'function_clause', 'badarg', or 'badmatch' exceptions. That would be possible, but it would require a lot of work and it would increase the size of the generated code and make it slower. Therefore, this solution was rejected.
2017-02-17PER: Slightly improve error reporting for encodingBjörn Gustavsson
Generate slightly better error reasons when encoding of INTEGER, ENUMERATED, or BOOLEAN fails.
2017-02-13Merge branch 'bjorn/cuddle-with-tests'Björn Gustavsson
* bjorn/cuddle-with-tests: ets_tough_SUITE: Add the gen_server behavior ets_tough_SUITE: Remove functions that are never called ets_SUITE: Eliminate internal exports used for spawn/apply lists_SUITE: Run the droplast/1 test case random_{iolist,unicode_list}: Remove unused functions stdlib test: Eliminate export_all from re_SUITE and friends asn1_SUITE: Make sure that there are no unused functions Simplify running of asn1 app tests asn1_SUITE: Remove unused functions
2017-02-10asn1_SUITE: Make sure that there are no unused functionsBjörn Gustavsson
Add xref_export_all/1 to make sure that all functions in the asn1_SUITE module are actually called (directly or indirectly).
2017-02-10Simplify running of asn1 app testsBjörn Gustavsson
Instead of initiating running of the app tests for asn1 from asn1_SUITE, put the tests in asn1_app_SUITE and let it take care of itself. While we are it, eliminate 'export_all' in the new module and use lists:keyfind/3 instead of lists:keysearch/3.
2017-02-10asn1_SUITE: Remove unused functionsBjörn Gustavsson
In 8a39672af4d9, the testX420/1 test case is no longer run. Remove the unused functions.
2017-02-06Teach the ASN.1 compiler the 'maps' optionBjörn Gustavsson
When the 'maps' option is given, the SEQUENCE and SET types are represented as maps instead of as records. Optional and default values must be not be given as asn1_NOVALUE or asn1_DEFAULT in a map passed to the M:encode/2 function; they must be omitted from the map. Similarly, when decoding missing values will be omitted from the map. No .hrl files will be generated when the 'maps' options is used. That means values in an ASN.1 module must be retrieved by calling the appropriate function in generated module. Since we one day hope to get rid of the options 'compact_bit_string', 'legacy_bit_string', and 'legacy_erlang_types', we will not allow them to be combined with the 'maps' option.
2017-02-03Add additional tests of Extension Addition GroupsBjörn Gustavsson
2017-02-03Refactor h323test.erl to simplify debuggingBjörn Gustavsson
2017-02-03testMultipleLevels: Use asn1_test_lib:roundtrip()Björn Gustavsson
2017-02-03Correct spelling of NBAP-PDU-DescriptionsBjörn Gustavsson
2017-01-13asn1: Remove deprecated functionsBjörn Gustavsson
Remove the entire asn1rt module. All functions in it were deprecated in OTP 17. In asn1ct, remove the deprecated functions asn1ct:encode/3 and asn1ct:decode/3. Also remove asn1ct:encode/2, which has not been formally deprecated but is undocumented.
2016-11-29asn1 test suite: Suppress warnings for -compile(export_all)Björn Gustavsson
2016-08-12asn1_test_lib: Compile ASN.1 modules in parallelBjörn Gustavsson
Test that the changes in the previous commit allows us to compile ASN.1 modules in parallel.
2016-04-13Merge branch 'henrik/update-copyrightyear'Henrik Nord
* henrik/update-copyrightyear: update copyright-year
2016-03-23asn1_SUITE: Remove temporary filesBjörn Gustavsson
Some test machines have quite small hard drives. Help them by remove temporary files in end_per_test_case/2.
2016-03-18Eliminate suite and doc clausesBjörn Gustavsson
2016-03-18Replace ?config() macro with proplists:get_value()Björn Gustavsson
2016-03-18Modernize timetrapsBjörn Gustavsson
2016-03-18Eliminate ?line macrosBjörn Gustavsson
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