Skip to content
Snippets Groups Projects
Commit 2e8ec461 authored by balaskoa's avatar balaskoa
Browse files

Test for bugfix of Bug 568518


Signed-off-by: default avatarbalaskoa <Jeno.Balasko@ericsson.com>
Change-Id: I3cfb096e045a8ba2f3382223c2b6df02e1095204
parent 3bcd4575
No related branches found
No related tags found
No related merge requests found
...@@ -19,7 +19,7 @@ TOPDIR := ../../ ...@@ -19,7 +19,7 @@ TOPDIR := ../../
include $(TOPDIR)/Makefile.regression include $(TOPDIR)/Makefile.regression
RDIRS = Examples HN25015 HQ26535 HQ49956 HS16977 ustr Annex_E_variants Bug521125 \ RDIRS = Examples HN25015 HQ26535 HQ49956 HS16977 ustr Annex_E_variants Bug521125 \
Lengthto_Offset Bug522656 RAW_integer RAW_bitstring RAW_EncDec ForceOmit Bug546231 \ Lengthto_Offset Bug522656 RAW_bitstring RAW_EncDec RAW_integer RAW_repeat ForceOmit Bug546231 \
Bug547385 IntX CSN1_LH Bug547385 IntX CSN1_LH
all dep clean run distclean: all dep clean run distclean:
......
RAW_repeat_test
RAW_repeat_test.exe
RAW_repeat_test*.cc
RAW_repeat_test*.hh
RAW_repeat_test*.log
compile
result.txt
##############################################################################
# Copyright (c) 2000-2020 Ericsson Telecom AB
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v2.0
# which accompanies this distribution, and is available at
# https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
#
# Contributors:
# Balasko, Jeno
#
##############################################################################
TOPDIR := ../../..
include $(TOPDIR)/Makefile.regression
.PHONY: all clean dep run
TTCN3_LIB = ttcn3$(RT2_SUFFIX)$(DYNAMIC_SUFFIX)
TTCN3_MODULES = RAW_repeat_test.ttcn
GENERATED_SOURCES = $(TTCN3_MODULES:.ttcn=.cc)
GENERATED_HEADERS = $(GENERATED_SOURCES:.cc=.hh)
ifdef CODE_SPLIT
GENERATED_SOURCES := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), .cc _seq.cc _set.cc _seqof.cc _setof.cc _union.cc))
else ifdef SPLIT_TO_SLICES
POSTFIXES := $(foreach file, $(SPLIT_TO_SLICES), $(addsuffix $(file), _part_))
POSTFIXES := $(foreach file, $(POSTFIXES), $(addprefix $(file), .cc))
GENERATED_SOURCES2 := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), $(POSTFIXES)))
GENERATED_SOURCES += $(GENERATED_SOURCES2)
endif
USER_SOURCES =
# All object files needed for the executable test suite:
OBJECTS = $(GENERATED_SOURCES:.cc=.o) $(USER_SOURCES:.cc=.o)
# The name of the executable test suite:
TARGET = RAW_repeat_test$(EXESUFFIX)
all: $(TARGET)
$(TARGET): $(OBJECTS)
$(CXX) $(LDFLAGS) -o $@ $(OBJECTS) -L$(TTCN3_DIR)/lib -l$(TTCN3_LIB) \
-L$(OPENSSL_DIR)/lib -lcrypto $($(PLATFORM)_LIBS)
$(GENERATED_SOURCES) $(GENERATED_HEADERS): compile
@if [ ! -f $@ ]; then $(RM) compile; $(MAKE) compile; fi
compile: $(TTCN3_MODULES) $(ASN1_MODULES)
$(TTCN3_COMPILER) $(COMPILER_FLAGS) $^
touch $@
clean distclean:
$(RM) $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \
$(GENERATED_SOURCES) compile *.log
dep: $(GENERATED_SOURCES)
makedepend $(CPPFLAGS) $(USER_SOURCES) $(GENERATED_SOURCES)
run: $(TARGET) RAW_repeat_test.cfg
./$^ 2> result.txt
cat result.txt
grep "Overall verdict: pass" result.txt
# DO NOT DELETE
[LOGGING]
LogFile := "%e.%h-%r.%s"
FileMask := LOG_ALL | DEBUG | MATCHING
ConsoleMask := ERROR | WARNING | TESTCASE | STATISTICS | PORTEVENT
LogSourceInfo := Yes
AppendFile := No
TimeStampFormat := DateTime
LogEventTypes := Yes
SourceInfoFormat := Single
LogEntityName := Yes
[EXECUTE]
RAW_repeat_test.control
[MAIN_CONTROLLER]
TCPPort := 0
KillTimer := 10.0
# NumHCs := 0
# LocalAddress :=
/******************************************************************************
* Copyright (c) 2000-2020 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
*
* Contributors:
* Szalai, Gabor -first draft
* Balasko, Jeno -second version
******************************************************************************/
// This test is based on Bug 568518, reported in Bugzilla at 2020.11.04
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=568518
module RAW_repeat_test {
type component CT {}
type octetstring OCT1 length(1)
type record IE1{
OCT1 ie_type,
integer len,
octetstring data
} with {
variant "PRESENCE(ie_type = '01'O)"
variant (len) "LENGTHTO(data)"
}
type record IE2{
OCT1 ie_type,
integer len,
octetstring data
} with {
variant "PRESENCE(ie_type = '02'O)"
variant (len) "LENGTHTO(data)"
}
type record unknown_IE{
OCT1 ie_type,
integer len,
octetstring data
} with {
variant (len) "LENGTHTO(data)"
}
type record of unknown_IE unknown_IE_list
type set PDU{
IE1 ie1_field,
IE2 ie2_field optional,
unknown_IE_list unknown_ies optional
} with {
variant (unknown_ies) "REPEATABLE(yes)"
}
external function dec_PDU_backtrack(in octetstring stream, out PDU pdu) return integer
with { extension "prototype(backtrack) decode(RAW)" }
// no spread record of
testcase tc_1() runs on CT {
var octetstring stream;
var PDU pdu_decoded;
var PDU pdu_expected := {
ie1_field := { ie_type := '01'O, len:=1, data := '00'O },
ie2_field := { ie_type := '02'O, len:=1, data := '00'O },
unknown_ies := {
{ ie_type := '03'O, len:=1, data := '00'O},
{ ie_type := '04'O, len:=1, data := '00'O}
}
}
var integer result;
stream := '010100020100030100040100'O // IE1, IE2, unknown IE
result:=dec_PDU_backtrack(stream,pdu_decoded);
log(stream);
log(result) // { ie1_field := { ie_type := '01'O, len := 1, data := '00'O }, ie2_field := { ie_type := '02'O, len := 1, data := '00'O }, unknown_ies := { { ie_type := '03'O, len := 1, data := '00'O }, { ie_type := '04'O, len := 1, data := '00'O } } }
log(pdu_decoded);
if (result != 0) {
setverdict(fail, "decoding failed");
} else if ( pdu_decoded != pdu_expected) {
setverdict(fail,"Unexpected decoding result:");
log("Expected:", pdu_expected);
log("Got :", pdu_decoded);
} else {
setverdict(pass)
}
}
// spread record of
testcase tc_2() runs on CT {
var octetstring stream := '010100030100020100040100'O // IE1, unknown IE, IE2 -> IE2 added to the unknown_ies
var PDU pdu_decoded;
var PDU pdu_expected := {
ie1_field := { ie_type := '01'O, len:=1, data := '00'O },
ie2_field := { ie_type := '02'O, len:=1, data := '00'O },
unknown_ies := {
{ ie_type := '03'O, len:=1, data := '00'O},
{ ie_type := '04'O, len:=1, data := '00'O}
}
}
var integer result;
// stream := '010100030100020100040100'O // IE1, unknown IE, IE2 -> IE2 added to the unknown_ies
result:=dec_PDU_backtrack(stream,pdu_decoded);
log(stream)
log(result) // { ie1_field := { ie_type := '01'O, len := 1, data := '00'O }, ie2_field := omit, unknown_ies := { { ie_type := '03'O, len := 1, data := '00'O }, { ie_type := '02'O, len := 1, data := '00'O }, { ie_type := '04'O, len := 1, data := '00'O } } }
log(pdu_decoded)
if (result != 0) {
setverdict(fail, "decoding failed");
} else if ( pdu_decoded != pdu_expected) {
setverdict(fail,"Unexpected decoding result:");
log("Expected:", pdu_expected);
log("Got :", pdu_decoded);
} else {
setverdict(pass)
}
}
// spread record of
testcase tc_3() runs on CT {
var octetstring stream := '010100030100020100020100040100020100'O; // IE1, unknown IE, IE2 , IE2, unknown IE, IE2 which should be at the unknown_ies list. The ie2_field is not repeatable
var PDU pdu_decoded;
var PDU pdu_expected := {
ie1_field := { ie_type := '01'O, len:=1, data := '00'O },
ie2_field := { ie_type := '02'O, len:=1, data := '00'O },
unknown_ies := {
{ ie_type := '03'O, len:=1, data := '00'O},
{ ie_type := '02'O, len:=1, data := '00'O},
{ ie_type := '04'O, len:=1, data := '00'O},
{ ie_type := '02'O, len:=1, data := '00'O}
}
}
var integer result;
result:=dec_PDU_backtrack(stream,pdu_decoded);
log(stream)
log(result) // { ie1_field := { ie_type := '01'O, len := 1, data := '00'O }, ie2_field := omit, unknown_ies := { { ie_type := '03'O, len := 1, data := '00'O }, { ie_type := '02'O, len := 1, data := '00'O }, { ie_type := '04'O, len := 1, data := '00'O } } }
log(pdu_decoded)
if (result != 0) {
setverdict(fail, "decoding failed");
} else if ( pdu_decoded != pdu_expected) {
setverdict(fail,"Unexpected decoding result:");
log("Expected:", pdu_expected);
log("Got :", pdu_decoded);
} else {
setverdict(pass)
}
}
control{
execute(tc_1());
execute(tc_2());
execute(tc_3());
}
} with {
encode "RAW"
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment