From 17dc03852f64ed02f3fbc1ca42ea25c5fb403ccd Mon Sep 17 00:00:00 2001 From: asanoaozora Date: Tue, 10 Oct 2017 03:28:41 +0200 Subject: fix bug in test scripts and extend it to remote host --- test/navigation/dlt-triggers/test-scripts.dlf | 195 ++++++++++++++++++---- test/navigation/script/test-address-input.py | 26 ++- test/navigation/script/test-all | 42 +++-- test/navigation/script/test-guidance.py | 25 ++- test/navigation/script/test-location-input.py | 26 ++- test/navigation/script/test-map-viewer-control.py | 26 ++- test/navigation/script/test-poi-guidance.py | 26 ++- test/navigation/script/test-poi.py | 26 ++- test/navigation/script/test-route-calculation.py | 25 ++- test/navigation/script/test-speech.py | 29 +++- 10 files changed, 340 insertions(+), 106 deletions(-) diff --git a/test/navigation/dlt-triggers/test-scripts.dlf b/test/navigation/dlt-triggers/test-scripts.dlf index 7aeeaea..85b2f14 100644 --- a/test/navigation/dlt-triggers/test-scripts.dlf +++ b/test/navigation/dlt-triggers/test-scripts.dlf @@ -1,13 +1,13 @@ - 1 - HIDE-APP - - APP - - - + 0 + New Filter + ECU1 + ENHP + EPSR + 2017/10/09 04:28:01.200296 3875.1529 0 ECU1 ENHP EPSR 6729 log info verbose 1 + Starting EnhancedPositionService... 0 0 0 @@ -16,7 +16,7 @@ 1 0 1 - 0 + 1 0 0 0 @@ -28,13 +28,13 @@ 0 - 1 - HIDE-DA1 - - DA1 - - - + 0 + New Filter + ECU1 + GNSS + EPSR + 2017/10/09 04:28:01.213970 3875.1669 1 ECU1 GNSS EPSR 6729 log info verbose 1 + Starting EnhancedPosition dispatcher... 0 0 0 @@ -43,7 +43,7 @@ 1 0 1 - 0 + 1 0 0 0 @@ -55,56 +55,191 @@ 0 - 2 + 0 New Filter ECU1 - NAVI - TEST - - Start test + POIS + POIS + 2017/10/09 04:28:01.219091 3875.1714 0 ECU1 POIS POIS 6735 log info verbose 1 + POI content access server 0 0 0 0 0 1 - 1 + 0 1 1 0 - 1 + 0 + 0 + 0 + 0 + 0 + #ffffff + 0 + 0 + + + 0 + New Filter + ECU1 + MPVS + MPVS + 2017/10/09 04:28:01.305274 3875.2180 0 ECU1 MPVS MPVS 6737 log info verbose 1 + map viewer control server + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + #ffffff + 0 + 0 + + + 0 + New Filter + ECU1 + POIC + POIC + 2017/10/09 04:28:01.384789 3875.3337 0 ECU1 POIC POIC 6750 log info verbose 1 + POI content access module server + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 1 + 0 + 0 0 0 0 0 - #00ff00 + #ffffff 0 0 - 2 + 0 New Filter ECU1 NAVI TEST - - Stop test + 2017/10/09 04:42:45.901627 4759.8546 0 ECU1 NAVI TEST 7621 log info verbose 2 + Start test of location input 0 0 0 0 0 1 - 1 + 0 1 1 0 - 1 + 0 0 0 0 0 - #ff0000 + #ffffff + 0 + 0 + + + 0 + New Filter + ECU1 + POIC + RTGS + 2017/10/09 04:42:53.024493 4766.9773 50 ECU1 POIC RTGS 7601 log info verbose 1 + Building graph + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + #ffffff + 0 + 0 + + + 0 + New Filter + ECU1 + POIC + GUID + 2017/10/09 04:42:55.224174 4769.1768 6 ECU1 POIC GUID 7601 log info verbose 1 + Guidance status changed to active + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + #ffffff + 0 + 0 + + + 0 + New Filter + ECU1 + POIC + LOIS + 2017/10/09 04:42:48.158576 4762.0966 92 ECU1 POIC LOIS 7601 log info verbose 1 + Select entry + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + #ffffff 0 0 diff --git a/test/navigation/script/test-address-input.py b/test/navigation/script/test-address-input.py index 6827a97..0b35006 100755 --- a/test/navigation/script/test-address-input.py +++ b/test/navigation/script/test-address-input.py @@ -36,15 +36,20 @@ import xml.dom.minidom import argparse import sys import os.path +import commands import genivi try: from dltTrigger import * - dltTrigger=True - print('DLT signal sent') except dltTriggerNotBuilt: - dltTrigger=False + dltAvailable=False +else: + dltAvailable=True #import pdb;pdb.set_trace() +output = commands.getoutput('ps -A') +if not 'dlt' in output: + dltAvailable=False + #name of the test test_name = "address input" @@ -65,7 +70,9 @@ g_exit=0 parser = argparse.ArgumentParser(description='Location input Test for navigation PoC and FSA.') parser.add_argument('-l','--loc',action='store', dest='locations', help='List of locations in xml format') -parser.add_argument("-v", "--verbose", action='store_true',help='print the whole log messages') +parser.add_argument("-v", "--verbose", action='store_true',help='Print the whole log messages') +parser.add_argument('-a','--address',action='store', dest='host', help='Set remote host address') +parser.add_argument('-p','--prt',action='store', dest='port', help='Set remote port number') args = parser.parse_args() if args.locations == None: @@ -98,8 +105,11 @@ for location in location_set.getElementsByTagName("location"): if __name__ == '__main__': dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) -# connect to session bus -bus = dbus.SessionBus() +# connect to session bus (remote or local) +if args.host != None: + bus = dbus.bus.BusConnection("tcp:host=" + args.host +",port="+args.port) +else: + bus = dbus.SessionBus() def vprint(text): if args.verbose: @@ -348,7 +358,7 @@ def exit(value): print('Delete location input: '+str(int(error))) error=session_interface.DeleteSession(dbus.UInt32(session_handle)) print('Delete session: '+str(int(error))) - if dltTrigger==True: + if dltAvailable==True: stopTrigger(test_name) loop.quit() @@ -368,7 +378,7 @@ def startSearch(address_index): change_selection_criterion(genivi.COUNTRY) full_string_search(location_input_handle, target_search_string) -if dltTrigger==True: +if dltAvailable==True: startTrigger(test_name) session = bus.get_object('org.genivi.navigation.navigationcore.Session', '/org/genivi/navigationcore') diff --git a/test/navigation/script/test-all b/test/navigation/script/test-all index f5350af..f9bddab 100755 --- a/test/navigation/script/test-all +++ b/test/navigation/script/test-all @@ -2,15 +2,27 @@ export PYTHONIOENCODING=utf-8 verbose=0 +remote="" -while getopts hv opt +while getopts hva:p: opt do case $opt in + v) + verbose=1 + ;; + a) + remote=$remote" -a "$OPTARG + ;; + p) + remote=$remote" -p "$OPTARG + ;; v) verbose=1 ;; h) echo "Usage:" + echo "-a : host address for remote" + echo "-p : port number" echo "-h: Help" echo "-v: Verbose" exit 1 @@ -19,51 +31,51 @@ done if [ "$verbose" = 1 ] then - ./test-location-input.py -l ../resource/locations.xml - ./test-address-input.py -l ../resource/location.xml - ./test-route-calculation.py -r ../resource/routes.xml - ./test-poi.py -l ../resource/location.xml -s "sChü" - ./test-poi-guidance.py -l ../resource/location-poi.xml -s "cOnT" - ./test-guidance.py -r ../resource/route.xml - ./test-map-viewer-control.py -l ../resource/location.xml + ./test-location-input.py -l ../resource/locations.xml $remote + ./test-address-input.py -l ../resource/location.xml $remote + ./test-route-calculation.py -r ../resource/routes.xml $remote + ./test-poi.py -l ../resource/location.xml -s "sChü" $remote + ./test-poi-guidance.py -l ../resource/location-poi.xml -s "cOnT" $remote + ./test-guidance.py -r ../resource/route.xml $remote + ./test-map-viewer-control.py -l ../resource/location.xml $remote else - result="$(./test-location-input.py -l ../resource/locations.xml 2>&1 >/dev/null)" + result="$(./test-location-input.py -l ../resource/locations.xml $remote 2>&1 >/dev/null)" echo $result if [[ $result != *"PASSED"* ]]; then exit 1 fi - result="$(./test-address-input.py -l ../resource/location.xml 2>&1 >/dev/null)" + result="$(./test-address-input.py -l ../resource/location.xml $remote 2>&1 >/dev/null)" echo $result if [[ $result != *"PASSED"* ]]; then exit 1 fi - result="$(./test-route-calculation.py -r ../resource/routes.xml 2>&1 >/dev/null)" + result="$(./test-route-calculation.py -r ../resource/routes.xml $remote 2>&1 >/dev/null)" echo $result if [[ $result != *"PASSED"* ]]; then exit 1 fi - result="$(./test-poi.py -l ../resource/location.xml -s "sChü" 2>&1 >/dev/null)" + result="$(./test-poi.py -l ../resource/location.xml -s "sChü" $remote 2>&1 >/dev/null)" echo $result if [[ $result != *"PASSED"* ]]; then exit 1 fi - result="$(./test-poi-guidance.py -l ../resource/location-poi.xml -s "cOnT" 2>&1 >/dev/null)" + result="$(./test-poi-guidance.py -l ../resource/location-poi.xml -s "cOnT" $remote 2>&1 >/dev/null)" echo $result if [[ $result != *"PASSED"* ]]; then exit 1 fi - result="$(./test-guidance.py -r ../resource/route.xml 2>&1 >/dev/null)" + result="$(./test-guidance.py -r ../resource/route.xml $remote 2>&1 >/dev/null)" echo $result if [[ $result != *"PASSED"* ]]; then exit 1 fi - result="$(./test-map-viewer-control.py -l ../resource/location.xml 2>&1 >/dev/null)" + result="$(./test-map-viewer-control.py -l ../resource/location.xml $remote 2>&1 >/dev/null)" echo $result if [[ $result == *"PASSED"* ]]; then echo "Batch test PASSED" diff --git a/test/navigation/script/test-guidance.py b/test/navigation/script/test-guidance.py index 7eb7a4d..9bccd7d 100755 --- a/test/navigation/script/test-guidance.py +++ b/test/navigation/script/test-guidance.py @@ -34,16 +34,21 @@ import xml.dom.minidom import argparse import sys import os.path +import commands import time import genivi try: from dltTrigger import * - dltTrigger=True - print('DLT signal sent') except dltTriggerNotBuilt: - dltTrigger=False + dltAvailable=False +else: + dltAvailable=True #import pdb;pdb.set_trace() +output = commands.getoutput('ps -A') +if not 'dlt' in output: + dltAvailable=False + #name of the test test_name = "guidance/map viewer" @@ -168,7 +173,7 @@ def exit(value): global g_exit g_exit=value #deleteMapView() - if dltTrigger==True: + if dltAvailable==True: stopTrigger(test_name) loop.quit() @@ -281,6 +286,9 @@ g_exit=0 parser = argparse.ArgumentParser(description='Route Calculation Test for navigation PoC and FSA.') parser.add_argument('-r','--rou',action='store', dest='routes', help='List of routes in xml format') +parser.add_argument("-v", "--verbose", action='store_true',help='Print the whole log messages') +parser.add_argument('-a','--address',action='store', dest='host', help='Set remote host address') +parser.add_argument('-p','--prt',action='store', dest='port', help='Set remote port number') args = parser.parse_args() if args.routes == None: @@ -312,8 +320,11 @@ for location in route_set.getElementsByTagName("location"): if __name__ == '__main__': dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) -#connect to session bus -bus = dbus.SessionBus() +# connect to session bus (remote or local) +if args.host != None: + bus = dbus.bus.BusConnection("tcp:host=" + args.host +",port="+args.port) +else: + bus = dbus.SessionBus() bus.add_signal_receiver(routing_routeCalculationProgressUpdate_handler, \ dbus_interface = "org.genivi.navigation.navigationcore.Routing", \ @@ -351,7 +362,7 @@ bus.add_signal_receiver(mapmatchedposition_simulationStatusChanged_handler, \ dbus_interface = "org.genivi.navigation.navigationcore.MapMatchedPosition", \ signal_name = "SimulationStatusChanged") -if dltTrigger==True: +if dltAvailable==True: startTrigger(test_name) navigationcore_session_obj = bus.get_object('org.genivi.navigation.navigationcore.Session','/org/genivi/navigationcore') diff --git a/test/navigation/script/test-location-input.py b/test/navigation/script/test-location-input.py index 343e0c5..1b2cef3 100755 --- a/test/navigation/script/test-location-input.py +++ b/test/navigation/script/test-location-input.py @@ -36,18 +36,23 @@ import xml.dom.minidom import argparse import sys import os.path +import commands import genivi try: from dltTrigger import * - dltTrigger=True - print('DLT signal sent') except dltTriggerNotBuilt: - dltTrigger=False + dltAvailable=False +else: + dltAvailable=True #import pdb;pdb.set_trace() #name of the test test_name = "location input" +output = commands.getoutput('ps -A') +if not 'dlt' in output: + dltAvailable=False + # List of addresses COUNTRY_STRING = list() CITY_STRING = list() @@ -71,7 +76,9 @@ g_exit=0 parser = argparse.ArgumentParser(description='Location input Test for navigation PoC and FSA.') parser.add_argument('-l','--loc',action='store', dest='locations', help='List of locations in xml format') -parser.add_argument("-v", "--verbose", action='store_true',help='print the whole log messages') +parser.add_argument("-v", "--verbose", action='store_true',help='Print the whole log messages') +parser.add_argument('-a','--address',action='store', dest='host', help='Set remote host address') +parser.add_argument('-p','--prt',action='store', dest='port', help='Set remote port number') args = parser.parse_args() if args.locations == None: @@ -104,8 +111,11 @@ for location in location_set.getElementsByTagName("location"): if __name__ == '__main__': dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) -# connect to session bus -bus = dbus.SessionBus() +# connect to session bus (remote or local) +if args.host != None: + bus = dbus.bus.BusConnection("tcp:host=" + args.host +",port="+args.port) +else: + bus = dbus.SessionBus() def vprint(text): if args.verbose: @@ -432,7 +442,7 @@ def exit(value): print('Delete location input: '+str(int(error))) error=session_interface.DeleteSession(dbus.UInt32(session_handle)) print('Delete session: '+str(int(error))) - if dltTrigger==True: + if dltAvailable==True: stopTrigger(test_name) loop.quit() @@ -457,7 +467,7 @@ def startSearch(address_index): elif country_search_mode == 1: full_string_search(location_input_handle, target_search_string) -if dltTrigger==True: +if dltAvailable==True: startTrigger(test_name) session = bus.get_object('org.genivi.navigation.navigationcore.Session', '/org/genivi/navigationcore') diff --git a/test/navigation/script/test-map-viewer-control.py b/test/navigation/script/test-map-viewer-control.py index 8d96f9a..97c0ec5 100755 --- a/test/navigation/script/test-map-viewer-control.py +++ b/test/navigation/script/test-map-viewer-control.py @@ -36,15 +36,20 @@ import xml.dom.minidom import argparse import sys import os.path +import commands import genivi try: from dltTrigger import * - dltTrigger=True - print('DLT signal sent') except dltTriggerNotBuilt: - dltTrigger=False + dltAvailable=False +else: + dltAvailable=True #import pdb; pdb.set_trace() +output = commands.getoutput('ps -A') +if not 'dlt' in output: + dltAvailable=False + #name of the test test_name = "map viewer" @@ -245,7 +250,7 @@ def exit(value): global g_exit g_exit=value deleteMapView() - if dltTrigger==True: + if dltAvailable==True: stopTrigger(test_name) loop.quit() @@ -257,7 +262,9 @@ g_exit=0 parser = argparse.ArgumentParser(description='Map Viewer Test for navigation PoC and FSA.') parser.add_argument('-l','--loc',action='store', dest='locations', help='List of locations in xml format') -parser.add_argument("-v", "--verbose", action='store_true',help='print the whole log messages') +parser.add_argument("-v", "--verbose", action='store_true',help='Print the whole log messages') +parser.add_argument('-a','--address',action='store', dest='host', help='Set remote host address') +parser.add_argument('-p','--prt',action='store', dest='port', help='Set remote port number') args = parser.parse_args() if args.locations == None: @@ -292,8 +299,11 @@ for location in location_set.getElementsByTagName("location"): if __name__ == '__main__': dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) -#connect to session bus -bus = dbus.SessionBus() +# connect to session bus (remote or local) +if args.host != None: + bus = dbus.bus.BusConnection("tcp:host=" + args.host +",port="+args.port) +else: + bus = dbus.SessionBus() bus.add_signal_receiver(mapviewer_mapViewScaleChanged_handler, \ dbus_interface = "org.genivi.navigation.mapviewer.MapViewerControl", \ @@ -307,7 +317,7 @@ bus.add_signal_receiver(mapviewer_mapViewPerspectiveChanged_handler, \ dbus_interface = "org.genivi.navigation.mapviewer.MapViewerControl", \ signal_name = "MapViewPerspectiveChanged") -if dltTrigger==True: +if dltAvailable==True: startTrigger(test_name) mapviewer_session_obj = bus.get_object('org.genivi.navigation.mapviewer.Session','/org/genivi/mapviewer') diff --git a/test/navigation/script/test-poi-guidance.py b/test/navigation/script/test-poi-guidance.py index 356592a..0e79818 100755 --- a/test/navigation/script/test-poi-guidance.py +++ b/test/navigation/script/test-poi-guidance.py @@ -32,15 +32,20 @@ import xml.dom.minidom import argparse import sys import os.path +import commands import genivi try: from dltTrigger import * - dltTrigger=True - print('DLT signal sent') except dltTriggerNotBuilt: - dltTrigger=False + dltAvailable=False +else: + dltAvailable=True #import pdb; pdb.set_trace() +output = commands.getoutput('ps -A') +if not 'dlt' in output: + dltAvailable=False + #name of the test test_name = "poi search/route/guidance" @@ -213,7 +218,7 @@ def timeout(): def exit(value): global g_exit g_exit=value - if dltTrigger==True: + if dltAvailable==True: stopTrigger(test_name) loop.quit() @@ -262,7 +267,9 @@ g_exit=0 parser = argparse.ArgumentParser(description='Poi Test for navigation PoC and FSA.') parser.add_argument('-l','--loc',action='store', dest='locations', help='List of locations in xml format') -parser.add_argument("-v", "--verbose", action='store_true',help='print the whole log messages') +parser.add_argument("-v", "--verbose", action='store_true',help='Print the whole log messages') +parser.add_argument('-a','--address',action='store', dest='host', help='Set remote host address') +parser.add_argument('-p','--prt',action='store', dest='port', help='Set remote port number') parser.add_argument('-s','--string',action='store', dest='string', help='String to search') parser.add_argument('-r','--radius',action='store', dest='radius', help='Search radius in tenth of meters') parser.add_argument('-w','--window',action='store', dest='window', help='Max number of requested results') @@ -320,8 +327,11 @@ if __name__ == '__main__': print("Search for hotel and restaurant with keyword: "+ stringToSearch) -#connect to session bus -bus = dbus.SessionBus() +# connect to session bus (remote or local) +if args.host != None: + bus = dbus.bus.BusConnection("tcp:host=" + args.host +",port="+args.port) +else: + bus = dbus.SessionBus() bus.add_signal_receiver(routing_routeCalculationProgressUpdate_handler, \ dbus_interface = "org.genivi.navigation.navigationcore.Routing", \ @@ -371,7 +381,7 @@ bus.add_signal_receiver(poi_resultListChanged_signal_handler, \ dbus_interface = "org.genivi.navigation.poiservice.POISearch", \ signal_name = "ResultListChanged") -if dltTrigger==True: +if dltAvailable==True: startTrigger(test_name) navigationcore_session_obj = bus.get_object('org.genivi.navigation.navigationcore.Session','/org/genivi/navigationcore') diff --git a/test/navigation/script/test-poi.py b/test/navigation/script/test-poi.py index 23ad67e..77f3727 100755 --- a/test/navigation/script/test-poi.py +++ b/test/navigation/script/test-poi.py @@ -32,15 +32,20 @@ import xml.dom.minidom import argparse import sys import os.path +import commands import genivi try: from dltTrigger import * - dltTrigger=True - print('DLT signal sent') except dltTriggerNotBuilt: - dltTrigger=False + dltAvailable=False +else: + dltAvailable=True #import pdb; pdb.set_trace() +output = commands.getoutput('ps -A') +if not 'dlt' in output: + dltAvailable=False + #name of the test test_name = "poi search" @@ -122,7 +127,7 @@ def timeout(): def exit(value): global g_exit g_exit=value - if dltTrigger==True: + if dltAvailable==True: stopTrigger(test_name) loop.quit() @@ -136,7 +141,9 @@ g_exit=0 parser = argparse.ArgumentParser(description='Poi Test for navigation PoC and FSA.') parser.add_argument('-l','--loc',action='store', dest='locations', help='List of locations in xml format') -parser.add_argument("-v", "--verbose", action='store_true',help='print the whole log messages') +parser.add_argument("-v", "--verbose", action='store_true',help='Print the whole log messages') +parser.add_argument('-a','--address',action='store', dest='host', help='Set remote host address') +parser.add_argument('-p','--prt',action='store', dest='port', help='Set remote port number') parser.add_argument('-s','--string',action='store', dest='string', help='String to search') parser.add_argument('-r','--radius',action='store', dest='radius', help='Search radius in tenth of meters') parser.add_argument('-w','--window',action='store', dest='window', help='Max number of requested results') @@ -196,8 +203,11 @@ if __name__ == '__main__': print("Search for hotel and restaurant with keyword: "+ stringToSearch) -#connect to session bus -bus = dbus.SessionBus() +# connect to session bus (remote or local) +if args.host != None: + bus = dbus.bus.BusConnection("tcp:host=" + args.host +",port="+args.port) +else: + bus = dbus.SessionBus() bus.add_signal_receiver(catch_poi_configurationChanged_signal_handler, \ dbus_interface = "org.genivi.navigation.poiservice.POIConfiguration", \ @@ -211,7 +221,7 @@ bus.add_signal_receiver(catch_poi_resultListChanged_signal_handler, \ dbus_interface = "org.genivi.navigation.poiservice.POISearch", \ signal_name = "ResultListChanged") -if dltTrigger==True: +if dltAvailable==True: startTrigger(test_name) poiConfiguration = bus.get_object('org.genivi.navigation.poiservice.POIConfiguration','/org/genivi/poiservice/POIConfiguration') diff --git a/test/navigation/script/test-route-calculation.py b/test/navigation/script/test-route-calculation.py index 336dca3..ced6099 100755 --- a/test/navigation/script/test-route-calculation.py +++ b/test/navigation/script/test-route-calculation.py @@ -35,15 +35,20 @@ import xml.dom.minidom import argparse import sys import os.path +import commands import genivi try: from dltTrigger import * - dltTrigger=True - print('DLT signal sent') except dltTriggerNotBuilt: - dltTrigger=False + dltAvailable=False +else: + dltAvailable=True #import pdb;pdb.set_trace() +output = commands.getoutput('ps -A') +if not 'dlt' in output: + dltAvailable=False + #name of the test test_name = "route calculation" @@ -58,6 +63,9 @@ g_exit=0 parser = argparse.ArgumentParser(description='Route Calculation Test for navigation PoC and FSA.') parser.add_argument('-r','--rou',action='store', dest='routes', help='List of routes in xml format') +parser.add_argument("-v", "--verbose", action='store_true',help='Print the whole log messages') +parser.add_argument('-a','--address',action='store', dest='host', help='Set remote host address') +parser.add_argument('-p','--prt',action='store', dest='port', help='Set remote port number') args = parser.parse_args() if args.routes == None: @@ -89,8 +97,11 @@ for location in route_set.getElementsByTagName("location"): if __name__ == '__main__': dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) -#connect to session bus -bus = dbus.SessionBus() +# connect to session bus (remote or local) +if args.host != None: + bus = dbus.bus.BusConnection("tcp:host=" + args.host +",port="+args.port) +else: + bus = dbus.SessionBus() #add signal receivers def catchall_route_calculation_signals_handler(routeHandle, status, percentage): @@ -157,7 +168,7 @@ def timeout(): def exit(value): global g_exit g_exit=value - if dltTrigger==True: + if dltAvailable==True: stopTrigger(test_name) loop.quit() @@ -190,7 +201,7 @@ def launch_route_calculation(route): #calculate route g_routing_interface.CalculateRoute(dbus.UInt32(g_session_handle),dbus.UInt32(g_route_handle)) -if dltTrigger==True: +if dltAvailable==True: startTrigger(test_name) session = bus.get_object('org.genivi.navigation.navigationcore.Session','/org/genivi/navigationcore') diff --git a/test/navigation/script/test-speech.py b/test/navigation/script/test-speech.py index 9eeef43..58174b5 100755 --- a/test/navigation/script/test-speech.py +++ b/test/navigation/script/test-speech.py @@ -27,17 +27,23 @@ import dbus import gobject +import commands +import argparse import dbus.mainloop.glib import genivi try: from dltTrigger import * - dltTrigger=True - print('DLT signal sent') except dltTriggerNotBuilt: - dltTrigger=False + dltAvailable=False +else: + dltAvailable=True #import pdb; pdb.set_trace() +output = commands.getoutput('ps -A') +if not 'dlt' in output: + dltAvailable=False + #name of the test test_name = "speech output" @@ -68,7 +74,7 @@ def timeout(): def exit(value): global g_exit g_exit=value - if dltTrigger==True: + if dltAvailable==True: stopTrigger(test_name) loop.quit() @@ -78,11 +84,20 @@ print('--------------------------\n') g_exit=0 +parser = argparse.ArgumentParser(description='Location input Test for navigation PoC and FSA.') +parser.add_argument("-v", "--verbose", action='store_true',help='Print the whole log messages') +parser.add_argument('-a','--address',action='store', dest='host', help='Set remote host address') +parser.add_argument('-p','--prt',action='store', dest='port', help='Set remote port number') +args = parser.parse_args() + if __name__ == '__main__': dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) -#connect to session bus -bus = dbus.SessionBus() +# connect to session bus (remote or local) +if args.host != None: + bus = dbus.bus.BusConnection("tcp:host=" + args.host +",port="+args.port) +else: + bus = dbus.SessionBus() bus.add_signal_receiver(catch_speech_notifyConnectionStatus_signal_handler, \ dbus_interface = "org.genivi.hmi.speechservice.SpeechOutput", \ @@ -97,7 +112,7 @@ bus.add_signal_receiver(catch_speech_notifyTTSStatus_signal_handler, \ dbus_interface = "org.genivi.hmi.speechservice.SpeechOutput", \ signal_name = "notifyTTSStatus") -if dltTrigger==True: +if dltAvailable==True: startTrigger(test_name) speech = bus.get_object('org.genivi.hmi.speechservice.SpeechOutput','/org/genivi/hmi/speechservice/SpeechOutput') -- cgit v1.2.1