Age | Commit message (Collapse) | Author |
|
|
|
The code generator would crash.
|
|
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.
|
|
|
|
The default value for an OCTET STRING when legacy_erlang_types was
active would be a binary instead of a list.
|
|
The old code for testing DEFAULT values is messy, inefficient, and
causes dialyzer warnings.
|
|
We need to test DEFAULT values both with and without
legacy_erlang_types.
|
|
If SetIn is defined like this:
SetIn ::= SET {
boolIn BOOLEAN,
intIn INTEGER
}
then it may not be used with an empty DEFAULT value like this:
SetDef1 ::= SET {
set1 SetIn DEFAULT {}
}
The ASN.1 compiler prints an warning message, but still generates
code. (That should be fixed.)
Fix the incorrect ASN.1 specification by making the
components in SetIn optional:
SetIn ::= SET
{
boolIn BOOLEAN OPTIONAL,
intIn INTEGER OPTIONAL
}
|
|
|
|
This will also eliminate a dialyzer warning for unmatched returns,
and increase the coverage.
|
|
The error checking code for INTEGER and BIT STRING was broken,
since it built an error tuple that was never returned.
Rewrite the error checking code, sharing most of the code between
INTEGER and BIT STRING. Make sure that we test for both duplicated
names and number, as well as for negative bit numbers for
BIT STRING.
This rewrite will eliminate two dialyzer warnings for unmatched
returns.
|
|
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.
|
|
* schlagert/fix_basic_appups:
Dynamically configure typer_SUITE according to environment
Disable hipe_SUITE when environment doesn't support it
Make hipe non-upgradable by setting appup file empty
Fix missing module on hipe app file template
Add test suites performing app and appup file checks
Introduce appup test utility
Fix library application appup files
Fix non-library appup files according to issue #240
OTP-11744
|
|
Add the mentioned test suites for *all* library and touched
non-library applications.
|
|
* bjorn/asn1/cleanup/OTP-11727:
asn1ct_check: Use a return value to silence a dialyzer warning
asn1ct_check: Remove useless call to check_integer/3
asn1ct_check: Correct error handling for illegal OCTET STRING values
asn1ct: Silence dialyzer warnings for unmatched returns
asn1ct_table: Remove unused flexibility in table creation
asn1ct_table: Silence a dialyzer warning for unmatched return
asn1ct_gen: Silence dialyzer warnings for unmatched returns
asn1ct_value: Silence a dialyzer warning for unmatched return
asn1ct_tok: Check return value from file:close/1
|
|
Attempting to subtype an extensible ENUMERATED like this:
BaseType ::= { foo, bar, ... }
SubType ::= BaseType ( foo )
would fail to compile with a message that 'foo' was undefined.
Reported-by: Morten Nygaard Åsnes
|
|
The value for an OCTET STRING must be specified as either a bstring
or an hstring. Everything else (including character strings) is
illegal.
This correction also removes the offending code that caused an
unmatched return warning from dialyzer.
|
|
|
|
|
|
|
|
|
|
I forgot to remove the skipping when I added support for fragmented
strings in PER.
|
|
|
|
|
|
* bjorn/asn1/fix-integer-constraint/OTP-11504:
PER/UPER: Handle a range in the extension part of the constraint
|
|
Constraints such as:
INTEGER (1..10, ..., 11..20)
would fail to compile. Make sure it is properly ignored.
|
|
* bjorn/asn1/fix-union-bug/OTP-11411:
Fix complicated union of INTEGER constraints
|
|
* bjorn/asn1/fix-extensible-single-values/OTP-11415:
PER/UPER: Correct encoding for single-value extensible constraints
asn1ct_value: Handle named INTEGERs with constraints
|
|
A constraint that was an union of integer ranges:
Type ::= INTEGER (lb1..ub1 | ... | lbN..ubN)
would sometimes (depending on the values) not all always be properly
combined to a single effective range, but would become:
Type ::= INTEGER (lb2..ub2) (lb3..ub3)
If that type was used in a SEQUENCE:
S ::= SEQUENCE {
v Type
}
the constraint would be simplified, taking the intersection of the
ranges.
|
|
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).
|
|
An extensible constraint which is a union of single values, such as:
INTEGER (1|17, ...)
would be incorrectly encoded.
|
|
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.
|
|
Even if the roundtrip functions are very simply, putting them here
makes it possible to change its behavior in one place (e.g. if we
are to change encode and decode not to wrap the result in a ok tuple
in some future release).
|
|
The generated Emakefile was not copied when releasing the test
suites, which meant that the suites were compiled with default
options (without the 'warnings_as_errors' option in the generated
Emakefile).
While at it, eliminate left-over dependecies.
|
|
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.
|
|
Also remove records, defines, and request/4 that were only used
by msg11/0.
|
|
|
|
The module tests the performance of the OTP-PUB-KEY module in the
public_key application, so it is off-topic and should not be
reinstated.
|
|
A test of sub-constraints for PER/UPER was lost in commit 9ec0a0babace.
|
|
The testChoExtension module tests the same thing (and more) as
choice_extension.erl.
|
|
|
|
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.
|