From b8ceb25e6224c35d29c89e49cc26b38cdb69e252 Mon Sep 17 00:00:00 2001 From: gichan Date: Wed, 15 Mar 2023 17:15:47 +0900 Subject: [PATCH] [EDGE] Add MQTT data transmission test Add run test for MQTT data transmission of edgesrc/sink. Signed-off-by: gichan --- gst/edge/edge_common.c | 2 ++ tests/nnstreamer_edge/edge/runTest.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/gst/edge/edge_common.c b/gst/edge/edge_common.c index 627efac..11e9581 100644 --- a/gst/edge/edge_common.c +++ b/gst/edge/edge_common.c @@ -31,6 +31,8 @@ gst_edge_get_connect_type (void) "Connect with MQTT brokers and directly sending stream frames via TCP connections."}, {NNS_EDGE_CONNECT_TYPE_AITT, "AITT", "Sending stream frames via AITT connections."}, + {NNS_EDGE_CONNECT_TYPE_MQTT, "MQTT", + "Sending stream frames via MQTT connections."}, {0, NULL, NULL}, }; protocol = g_enum_register_static ("edge_protocol", protocols); diff --git a/tests/nnstreamer_edge/edge/runTest.sh b/tests/nnstreamer_edge/edge/runTest.sh index b47af0e..2d388a2 100644 --- a/tests/nnstreamer_edge/edge/runTest.sh +++ b/tests/nnstreamer_edge/edge/runTest.sh @@ -223,6 +223,7 @@ if [[ "$?" != 0 ]]; then exit fi +# Data publishing via AITT gstTestBackground "--gst-plugin-path=${PATH_TO_PLUGIN} \ videotestsrc is-live=true ! videoconvert ! videoscale ! video/x-raw,width=300,height=300,format=RGB ! tee name=t \ t. ! queue ! multifilesink location=raw7_%1d.log \ @@ -242,6 +243,31 @@ callCompareTestIfExist raw7_$((num+2)).log result7_1_2.log 7-9 "Compare 7-9" 1 0 kill -9 $pid &> /dev/null wait $pid +# Data publishing via MQTT +kill -9 $mospid &> /dev/null +PORT=`python3 ../../get_available_port.py` +/usr/sbin/mosquitto -p ${PORT}& +mospid=$! + +gstTestBackground "--gst-plugin-path=${PATH_TO_PLUGIN} \ + videotestsrc is-live=true ! videoconvert ! videoscale ! video/x-raw,width=300,height=300,format=RGB ! tee name=t \ + t. ! queue ! multifilesink location=raw8_%1d.log \ + t. ! queue ! edgesink port=0 connect-type=MQTT dest-host=127.0.0.1 dest-port=${PORT} topic=tempTopic async=false" 8-1 0 0 30 +gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} \ + edgesrc port=0 connect-type=MQTT dest-host=127.0.0.1 dest-port=${PORT} topic=tempTopic num-buffers=10 ! multifilesink location=result8_0_%1d.log" 8-2 0 0 $PERFORMANCE +gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} \ + edgesrc port=0 connect-type=MQTT dest-host=127.0.0.1 dest-port=${PORT} topic=tempTopic num-buffers=10 ! multifilesink location=result8_1_%1d.log" 8-3 0 0 $PERFORMANCE +findFirstMatchedFileNumber "raw8_" ".log" "result8_0_0.log" 8-4 +callCompareTestIfExist raw8_$((num+0)).log result8_0_0.log 8-4 "Compare 8-4" 1 0 +callCompareTestIfExist raw8_$((num+1)).log result8_0_1.log 8-5 "Compare 8-5" 1 0 +callCompareTestIfExist raw8_$((num+2)).log result8_0_2.log 8-6 "Compare 8-6" 1 0 +findFirstMatchedFileNumber "raw8_" ".log" "result8_1_0.log" 8-7 +callCompareTestIfExist raw8_$((num+0)).log result8_1_0.log 8-7 "Compare 8-7" 1 0 +callCompareTestIfExist raw8_$((num+1)).log result8_1_1.log 8-8 "Compare 8-8" 1 0 +callCompareTestIfExist raw8_$((num+2)).log result8_1_2.log 8-9 "Compare 8-9" 1 0 +kill -9 $pid &> /dev/null +wait $pid + kill -9 $mospid &> /dev/null rm *.log -- 2.7.4