|
Re: Variables used in several .cfg files [message #1838822 is a reply to message #1838799] |
Fri, 05 March 2021 17:45 |
Gábor Szalai Messages: 134 Registered: December 2015 |
Senior Member |
|
|
You can put the defined macros into a separate cfg file and import it. The "except Include" means that the macros can not be used in the [INCLUDE] section. But the cfg file with [DEFINE] section can be imported.
Example
module proba{
modulepar integer mp_i1
modulepar integer mp_i2
modulepar R_rec mp_r1
modulepar R_rec mp_r2
modulepar R_rec mp_r3
type record R_rec{
charstring f1,
integer f2
}
testcase TC1() runs on CT {
log("mp_i1", mp_i1)
log("mp_i2", mp_i2)
log("mp_r1", mp_r1)
log("mp_r2", mp_r2)
log("mp_r3", mp_r3)
}
}
The main cfg file:
[ORDERED_INCLUDE]
"macro.cfg"
"tc.cfg"
[LOGGING]
FileMask:=LOG_ALL
[EXECUTE]
proba.TC1
The macro.cfg
[DEFINE]
SUT_dst_ip :=192.168.1.1
SUT_dst_port :=12345
DEF1 := 2
DEF2 :={ f1:= "2.2.2.2", f2:=1234}
The tc.cfg:
[MODULE_PARAMETERS]
mp_i1 := 1
mp_i2 := ${DEF1,integer}
mp_r1 := {"1.2.3.4",3333}
mp_r2:= $DEF2
mp_r3:= {f1:= $SUT_dst_ip, f2:=${SUT_dst_port,integer} }
The result:
18:37:14.648782 Module proba has the following parameters: {
mp_i1 := 1,
mp_i2 := 2,
mp_r1 := { f1 := "1.2.3.4", f2 := 3333 },
mp_r2 := { f1 := "2.2.2.2", f2 := 1234 },
mp_r3 := { f1 := "192.168.1.1", f2 := 12345 } }
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03998 seconds