Re: [taste-users] ASN1SCC: test cases generation

[ Thread Index | Date Index | More lists.tuxfamily.org/taste-users Archives ]


Hi Gurvan.

If you don't mind, I think the best way to answer is to provide a fully working example (so you can check for yourself).
Note by the way that the latest release of ASN1SCC is currently at 3.3.3 ( https://github.com/ttsiodras/asn1scc/releases ) - but the example below should work with your older ASN1SCC version as well.

Here is the complete example including generation and execution of test cases:

$ ls -l

total 12
drwxr-xr-x  2 assert assert 4096 Jan 10 17:09 ./
drwxr-xr-x 11 assert assert 4096 Jan 10 17:07 ../
-rw-r--r--  1 assert assert  225 Jan 10 17:08 tests.asn

$ cat tests.asn

MY-MODULE DEFINITIONS AUTOMATIC TAGS ::= BEGIN

MyInt ::= INTEGER (0 .. 20)

TypeNested ::= SEQUENCE {
    intVal      INTEGER(0..10),
    int2Val     INTEGER(-10..10),
    int3Val     MyInt (10..12)
}

END

$ mkdir atc

$ asn1.exe -c -uPER -atc -o atc tests.asn

$ cd atc/

$ make coverage
make && ./mainprogram && \
    gcov tests.c
make[1]: Entering directory '/home/assert/tmp/Gurvan/atc'
gcc -c -g -Wall -Werror -Wextra -Wuninitialized -Wcast-qual -Wshadow -Wundef -Wno-unused-parameter -Wuninitialized -fdiagnostics-show-option -D_DEBUG -I . -O0 -fprofile-arcs -ftest-coverage -o acn.o acn.c
gcc -c -g -Wall -Werror -Wextra -Wuninitialized -Wcast-qual -Wshadow -Wundef -Wno-unused-parameter -Wuninitialized -fdiagnostics-show-option -D_DEBUG -I . -O0 -fprofile-arcs -ftest-coverage -o asn1crt.o asn1crt.c
gcc -c -g -Wall -Werror -Wextra -Wuninitialized -Wcast-qual -Wshadow -Wundef -Wno-unused-parameter -Wuninitialized -fdiagnostics-show-option -D_DEBUG -I . -O0 -fprofile-arcs -ftest-coverage -o mainprogram.o mainprogram.c
gcc -c -g -Wall -Werror -Wextra -Wuninitialized -Wcast-qual -Wshadow -Wundef -Wno-unused-parameter -Wuninitialized -fdiagnostics-show-option -D_DEBUG -I . -O0 -fprofile-arcs -ftest-coverage -o real.o real.c
gcc -c -g -Wall -Werror -Wextra -Wuninitialized -Wcast-qual -Wshadow -Wundef -Wno-unused-parameter -Wuninitialized -fdiagnostics-show-option -D_DEBUG -I . -O0 -fprofile-arcs -ftest-coverage -o tests.o tests.c
gcc -c -g -Wall -Werror -Wextra -Wuninitialized -Wcast-qual -Wshadow -Wundef -Wno-unused-parameter -Wuninitialized -fdiagnostics-show-option -D_DEBUG -I . -O0 -fprofile-arcs -ftest-coverage -o tests_auto_tcs.o tests_auto_tcs.c
gcc -c -g -Wall -Werror -Wextra -Wuninitialized -Wcast-qual -Wshadow -Wundef -Wno-unused-parameter -Wuninitialized -fdiagnostics-show-option -D_DEBUG -I . -O0 -fprofile-arcs -ftest-coverage -o testsuite.o testsuite.c
gcc -g -o mainprogram acn.o asn1crt.o mainprogram.o real.o tests.o tests_auto_tcs.o testsuite.o -g -ftest-coverage -fprofile-arcs
make[1]: Leaving directory '/home/assert/tmp/Gurvan/atc'
All test cases (14) run successfully.
File 'tests.c'
Lines executed:100.00% of 180
Creating 'tests.c.gcov'


Hope this helps!

Kind regards,
Thanassis.


Thanassis Tsiodras
Real-time Embedded Software Engineer
System, Software and Technology Department

ESTEC
Keplerlaan 1, PO Box 299
NL-2200 AG Noordwijk, The Netherlands
Thanassis.Tsiodras@xxxxxxx | www.esa.int
T +31 71 565 5332



From:        LE GUERNIC Gurvan <gurvan.le-guernic@xxxxxxxxxxxxxxxx>
To:        "taste-users@xxxxxxxxxxxxxxxxxxx" <taste-users@xxxxxxxxxxxxxxxxxxx>
Date:        10/01/2017 17:00
Subject:        [taste-users] ASN1SCC: test cases generation




   Hi,
 
In the webpage https://www.thanassis.space/asn1.html, it is stated that ASN1SCC allows to « automatically generate test cases (i.e. instances of the ASN.1 grammar's messages), that will exercise the encoders and the decoders at full 100% coverage ».
 
I tried the command « asn1.exe –o ./tests_asn1-atc –atc taste-types.asn DataView.asn », with a basic test project having the default content for DataView.asn. The command runs without errors, but the directory ./tests_asn1-atc remains empty. I am using asn1.exe version 3.2.75.
 
How can this feature be used ?
 
   Sincerely,
   Gurvan Le Guernic
 

This message and any attachments are intended for the use of the addressee or addressees only.
The unauthorised disclosure, use, dissemination or copying (either in whole or in part) of its
content is not permitted.
If you received this message in error, please notify the sender and delete it from your system.
Emails can be altered and their integrity cannot be guaranteed by the sender.

Please consider the environment before printing this email.

This message and any attachments are intended for the use of the addressee or addressees only.
The unauthorised disclosure, use, dissemination or copying (either in whole or in part) of its
content is not permitted.
If you received this message in error, please notify the sender and delete it from your system.
Emails can be altered and their integrity cannot be guaranteed by the sender.

Please consider the environment before printing this email.



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/