Age | Commit message (Collapse) | Author |
|
Refactor and clean up code. While at it, add error handling and
test cases. (Also add test cases for the existing values in
ValueTest.asn while we are it.)
Add support for defining INTEGER constants by extracting
fields from objects. Example:
int-from-object INTEGER ::= object.&id
When extracting values from objects in constraints, only one
level of extraction would work. That is, the following would
work:
SomeName ::= INTEGER (object.&int)
but not:
SomeName ::= INTEGER (object.&obj.&int)
|
|
We only tested that ValueTest.asn1 would compile, no that the
values were correct.
|
|
|
|
Attempting to compile:
SomeType{SOME-CLASS-NAME, SOME-CLASS-NAME:SomeSet} ::= ...
SEQUENCE {
something SOME-CLASS-NAME.&id({SomeSet})
}
would crash the compiler, because the actual parameter for
SOME-CLASS-NAME was not substituted into the governor for
the SomeSet parameter.
While we are at it, combine the functionality of is_class/2
and get_class_def/2 (eliminating is_class/2). Most callers
call both function.
|
|
Running dialyzer on test suites is good for finding both bugs and
useless dialyzer warnings. Add a mechanism in asn1_test_lib for
turning on running of dialyzer on all generated code.
Turned off by default, because it is slow and because there are
still a few dialyzer warnings left.
|
|
We need to test DEFAULT values both with and without
legacy_erlang_types.
|
|
|
|
Commit e5c71b7 deprecated several all functions in the asn1rt
module. As a result, calls to those functions from test suites
caused warnings, and as the warnings_as_errors option was active,
two test files failed to compile.
|
|
|
|
|
|
|
|
|
|
For DER/PER/UPER, a value equal to the DEFAULT is not supposed to
be encoded.
BIT STRINGs values can be represented as Erlang terms in four
different ways: as an integer, as a list of zeroes and ones,
as a {Unused,Binary} tuple, or as an Erlang bitstring.
When encoding a BIT STRING, only certain representations of
BIT STRINGs values were recognized. All representations must
be recognized.
When decoding a DEFAULT value for a BIT STRING, the actual value
given in the decoding would be either an integer or a list
of zeroes and one (depending on how the literal was written in
the specification). We expect that the default value should be
in the same representation as any other BIT STRING value (i.e.
by default an Erlang bitstring, or a list if the 'legacy_bitstring'
option has been given, or as compact bitstring if 'compact_bitstring'
has been given).
|
|
Add the no_ok_wrapper option so that the generated M:encode/2 and
M:decode/2 functions will not wrap a successful return value in an
{ok,...} tuple. Errors will cause exceptions.
Eliminating the wrapping tuple allows simpler nesting of calls.
|
|
We used to compile the X420 specs for both DER and PER, but
9ec0a0ba changed that to compile for DER and plain BER (probably
accidentally).
Since the X420 suite contains 99 source files and compilations
takes more than 40 seconds on my computer for one backend, we only
want to do compilations that are likely to find bugs.
Compiling with the BER backend after having compiled for the DER
backend is very unlikely to detect any bugs.
Compiling for PER (as well as DER) is slightly more likely to expose
bugs, but I don't think it is worth the extra running time for the
test suite.
|
|
They use the same ASN.1 spec.
|
|
The asn1_wrapper made some sense when encode functions
could either produce a list or a binary, depending on the
backend. Now encode functions always produce a binary.
To improve readbility of the test suites, eliminate the asn1_wrapper
functions by replacing them with calls to one of the roundtrip
functions in asn1_test_lib. When it is not possible to use
the roundtrip functions, call the module in question directly.
While at it, also remove ?line macros that are near to the
touched code and use asn1_test_lib:hex_to_bin/1 instead of
home-brewn hex conversion routines.
|
|
Test ChoOptional and ChoOptionalImplicitTag with the same test code
and data.
|
|
To keep the test case clean, add an xref test case to ensure that
there are no unused functions in the any of the test case helper
modules. Eliminate 4 functions that were exported just so that
timer:tc/3 could be used (use timer:tc/1 with a fun instead).
|
|
asn1_test_lib is supposed to be a general-purpose helper module for
test cases. Move all specific test cases into asn1_SUITE.
|
|
A test of sub-constraints for PER/UPER was lost in commit 9ec0a0babace.
|
|
asn1ct:compile/2 calls c:c/2 to invoke the compiler and to load
the compiled code. That means that there is no need load the module
after having invoked the ASN.1 compiler.
To make sure that we'll notice if that behavior changes in the future,
extend the rtUI/1 test case to verify that the loaded module has
the correct encoding rule (if asn1ct:compile/2 would fail to reload
the module, the previous encoding rule would be returned).
While at it, it also makes sense to test calling M:bit_string_format/0
to ensure that it continues working.
|
|
By combining most tests that use External.asn,
we will only need to compile that spec once instead of 11 times.
While combining the test cases, make sure to remove the redundant code
in testPrimExternal/1 that tests primitive strings in exactly the same
way as testPrimString/1. Removing the redundant code shaves off a few
seconds of testing time.
Keep testSeqExtension/1 as a separate test case, since it is a
complicated test case that does hairy stuff to the source files.
|
|
It seems that the original purpose is to test encoding by
directly calling the module (as opposed to calling indirectly
using asn1rt). That is tested in many other test cases (such
as testPrimStrings); thus this test case no longer serves any
useful purpose.
|
|
The per_GeneralString/1 test case compiles MULTIMEDIA-SYSTEM-CONTROL
and then does a single decoding. Save some compilation time by folding
the test into the h323test/1 test case.
|
|
|
|
The PER back-end no longer use a driver (or even a NIF),
and the test case would not fail if it didn't work because the
spawned processed were not linked.
|
|
|
|
There are some minor incompatibilities for BIT STRING:
{bit,Position} is now only only supported for a named
BIT STRING type.
Values longer than the maximum size for the BIT STRING type
would be truncated silently - they now cause an exception.
|
|
The smp1/1 test case seems test how well the SMP emulator can
parallelize tasks, not any functionality in the asn1 application
that is not tested in other tests.
|
|
|
|
Unify the code for checking an enumeration value named in a
DEFAULT and in an ENUMERATED value. There is no need to handle
those cases differently. That also will also make sure that
the following works:
E ::= ENUMERATED { x, ..., y }
e E ::= x
(Extensible ENUMERATEDs were not handled when defining values.)
Always generate an error when an unknown enumeration value is
given (used in a DEFAULT, a message would be printed, but the
compilation would succeed). Also make sure that we always include
the line number for the incorrect enumeration.
Write a new test case and remove the extremely rudimentary
value_bad_enum_test/1 test case.
|
|
|
|
|
|
|
|
For the example from X.691, make sure to test that our encoded
value is the same as given in X.691.
Run the test for BER, too.
|
|
|
|
* bjorn/asn1/fix-lost-extension-mark/OTP-10995:
Prevent loss of objects after the extension marker
Don't lose the extension mark for object set parameters
|
|
When an object set is an actual parameter, the extension marker
for the object set could get lost.
|
|
|
|
Some tests are are only run with BER backend. Unless there is a
special reason that the PER and UPER backends will not work, we
should run all tests with all backends to get the best possible
code coverage.
|
|
|
|
|
|
|
|
Commit f16f43446a04c459486356c0b4ad517cc9201895 broke compilation
of InformationFramework for per and uper.
|
|
Was broken in some backends in R15. Make sure that we will notice
if it breaks again.
|
|
On Windows, there is a limit to the number of characters in a
filename. Therefore, we don't want unnecessarily use any longer
path than necessary for case-specific directory. Since all test
cases that put anything into priv_dir is asn1_SUITE, it is not
necessary to include "asn1_SUITE" as part of the case-specific
directory.
|
|
All generated and compiled code are now put into separate sub
directories below priv_dir, so there is no point in adding
priv_dir to the code path.
|
|
* maint:
Prepare release
Don't run testX420/1 on old slow Sparc systems
testX420: Pass Options to the ASN.1 compiler
asn1_erl_nif: Correct broken length encoding
asn1_SUITE: Mend broken test_modified_x420/1
Revert "Prepare release"
Conflicts:
lib/asn1/doc/src/notes.xml
lib/asn1/test/asn1_SUITE.erl
|
|
* bjorn/asn1/open-type-error/OTP-10805:
asn1_erl_nif: Correct broken length encoding
asn1_SUITE: Mend broken test_modified_x420/1
|