Skip to content

Commit

Permalink
Updates for example gateway model.
Browse files Browse the repository at this point in the history
Signed-off-by: Timothy Rule (VM/EMT3) <[email protected]>
  • Loading branch information
timrulebosch committed Dec 5, 2024
1 parent cac5772 commit 4c0420b
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ TESTSCRIPT_E2E_FILES = \
$(TESTSCRIPT_E2E_DIR)/transport.txtar \
$(TESTSCRIPT_E2E_DIR)/stack.txtar \
$(TESTSCRIPT_E2E_DIR)/runtime.txtar \
$(TESTSCRIPT_E2E_DIR)/gateway.txtar \
$(TESTSCRIPT_E2E_DIR)/benchmark.txtar

# $(TESTSCRIPT_E2E_DIR)/gateway.txtar \


ifneq ($(CI), true)
Expand Down
16 changes: 14 additions & 2 deletions dse/modelc/examples/gateway/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,28 @@ target_link_libraries(gateway
PRIVATE
$<$<BOOL:${WIN32}>:ws2_32>
PUBLIC
-Wl,--whole-archive
-Wl,--whole-archive,--export-dynamic
${modelc_link_lib}
-Wl,--no-whole-archive
)
install(TARGETS gateway RUNTIME
install(
TARGETS
gateway
DESTINATION
${EXE_PATH}/bin
COMPONENT
gateway_model
)
if(WIN32)
install(
TARGETS
modelc_shared_lib
DESTINATION
${EXE_PATH}/bin
COMPONENT
gateway_model
)
endif()
install(
FILES
gateway.yaml
Expand Down
2 changes: 1 addition & 1 deletion dse/modelc/examples/gateway/gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ spec:
connection:
transport:
redispubsub:
uri: redis://redis:6379
uri: redis://localhost:6379
timeout: 60
models:
- name: simbus
Expand Down
34 changes: 22 additions & 12 deletions tests/testscript/e2e/gateway.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,37 @@
env NAME=gateway_inst
env SIM=dse/modelc/build/_out/examples/gateway

# Start the Gateway.
exec ls -R /repo/$SIM
#exec /repo/$SIM/bin/gateway 0.0005 0.002 /repo/$SIM/data/gateway.yaml &

# Run the Simulation.
exec sh -e $WORK/test.sh

# Check results.
stdout 'Run the Simulation ...'
stdout 'Using gateway symbols: ...'
stdout 'Setup for async Simulation Model run ...'
stdout 'Call symbol: model_destroy ...'
stdout 'Controller exit ...'

stdout '\[0.000000\] binary\[0\] = <0:0>\(null\) \(binary_foo\)'
stdout '\[0.000000\] binary\[1\] = <0:0>\(null\) \(binary_bar\)'
stdout '\[0.020000\] binary\[0\] = <20:20>st=0.015000,index=0 \(binary_foo\)'
stdout '\[0.020000\] binary\[1\] = <20:20>st=0.015000,index=1 \(binary_bar\)'
stdout '\[0.002000\] binary\[0\] = <20:20>st=0.001500,index=0 \(binary_foo\)'
stdout '\[0.002000\] binary\[1\] = <20:20>st=0.001500,index=1 \(binary_bar\)'
stdout '\[0.000000\] scalar\[0\] = 0.000000 \(scalar_foo\)'
stdout '\[0.000000\] scalar\[1\] = 0.000000 \(scalar_bar\)'
stdout '\[0.020000\] scalar\[0\] = 16.000000 \(scalar_foo\)'
stdout '\[0.020000\] scalar\[1\] = 32.000000 \(scalar_bar\)'
stdout '\[0.002000\] scalar\[0\] = 16.000000 \(scalar_foo\)'
stdout '\[0.002000\] scalar\[1\] = 32.000000 \(scalar_bar\)'

-- test.sh --
SIMER="${SIMER:-ghcr.io/boschglobal/dse-simer:latest}"
docker run --name simer -i --rm -v $ENTRYHOSTDIR/$SIM:/sim \
$SIMER -env simbus:SIMBUS_LOGLEVEL=2 -timeout 5

docker run --name gateway -i --rm \
-v $ENTRYHOSTDIR/$SIM:/sim \
--env SIMBUS_LOGLEVEL=3 \
--network=host \
--entrypoint="" \
$SIMER \
bash -c "valgrind -q --leak-check=yes --error-exitcode=808 bin/gateway 0.0005 0.0020 data/gateway.yaml" &

docker run --name simer -i --rm \
-v $ENTRYHOSTDIR/$SIM:/sim \
--network=host \
$SIMER \
-env simbus:SIMBUS_LOGLEVEL=4 \
-timeout 5

0 comments on commit 4c0420b

Please sign in to comment.