diff options
Diffstat (limited to 'test/navigation/script')
-rwxr-xr-x | test/navigation/script/test-address-input.py | 43 | ||||
-rwxr-xr-x | test/navigation/script/test-all | 48 | ||||
-rwxr-xr-x | test/navigation/script/test-guidance.py | 49 | ||||
-rwxr-xr-x | test/navigation/script/test-location-input.py | 57 | ||||
-rwxr-xr-x | test/navigation/script/test-map-viewer-control.py | 49 | ||||
-rwxr-xr-x | test/navigation/script/test-poi.py | 31 | ||||
-rwxr-xr-x | test/navigation/script/test-route-calculation.py | 34 |
7 files changed, 200 insertions, 111 deletions
diff --git a/test/navigation/script/test-address-input.py b/test/navigation/script/test-address-input.py index ff273f0..6827a97 100755 --- a/test/navigation/script/test-address-input.py +++ b/test/navigation/script/test-address-input.py @@ -35,7 +35,7 @@ import dbus.mainloop.glib import xml.dom.minidom import argparse import sys -import errno +import os.path import genivi try: from dltTrigger import * @@ -58,9 +58,11 @@ HOUSE_NUMBER_STRING = list() WINDOW_SIZE = 20 print('\n--------------------------\n' + \ - 'LocationInput Test' + \ + 'AddressInput Test' + \ '\n--------------------------\n') +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') @@ -68,13 +70,17 @@ args = parser.parse_args() if args.locations == None: print('location file is missing') + print >>sys.stderr,'Test '+test_name+' FAILED' sys.exit(1) else: + if not os.path.isfile(args.locations): + print('file not exists') + print >>sys.stderr,'Test '+test_name+' FAILED' + sys.exit(1) try: DOMTree = xml.dom.minidom.parse(args.locations) except OSError as e: - if e.errno == errno.ENOENT: - print('file not exists') + print >>sys.stderr,'Test '+test_name+' FAILED' sys.exit(1) location_set = DOMTree.documentElement @@ -224,17 +230,17 @@ def evaluate_address(address, guidable): if test_passed == 1: print ('TEST PASSED') else: - print('TEST FAILED (wrong address)') - exit() + print('wrong address') + exit(1) else: - print ('TEST FAILED (non-guidable address)') - exit() + print ('non-guidable address') + exit(1) address_index = current_address_index + 1 if address_index < len(COUNTRY_STRING): startSearch(address_index) else: print ('END OF THE TEST') - exit() + exit(0) # Signal receiver @@ -309,8 +315,8 @@ def search_result_list_handler(handle, total_size, window_offset, window_size, r '\' (Session '+str(int(session_handle)) + ' LocationInputHandle ' + str(int(handle))+')') location_input_interface.SelectEntry(dbus.UInt32(session_handle), dbus.UInt32(handle), dbus.UInt16(0)) else: - print ('\nTEST FAILED (Unexpected single result list)') - exit() + print ('Unexpected single result list') + exit(1) elif spell_next_character == 1: spell_next_character = 0 spell_search(handle, entered_search_string, target_search_string, available_characters) @@ -332,12 +338,12 @@ bus.add_signal_receiver(content_updated_handler, # Timeout def timeout(): - print ('Timeout Expired') - print ('\nTEST FAILED\n') - exit() + print ('Timeout Expired\n') + exit(1) -# Exit -def exit(): +def exit(value): + global g_exit + g_exit=value error=location_input_interface.DeleteLocationInput(dbus.UInt32(session_handle),dbus.UInt32(location_input_handle)) print('Delete location input: '+str(int(error))) error=session_interface.DeleteSession(dbus.UInt32(session_handle)) @@ -398,3 +404,8 @@ startSearch(0) gobject.timeout_add(10000, timeout) loop = gobject.MainLoop() loop.run() +if g_exit == 1: + print >>sys.stderr,'Test '+test_name+' FAILED' +else: + print >>sys.stderr,'Test '+test_name+' PASSED' +sys.exit(g_exit) diff --git a/test/navigation/script/test-all b/test/navigation/script/test-all index 030e208..ac90fda 100755 --- a/test/navigation/script/test-all +++ b/test/navigation/script/test-all @@ -1,13 +1,39 @@ #!/bin/bash -./test-poi.py -l ../resource/location.xml -s "zuM" -sleep 1 -./test-location-input.py -l ../resource/locations.xml -sleep 1 -./test-route-calculation.py -r ../resource/routes.xml -sleep 1 -./test-address-input.py -l ../resource/location.xml -sleep 1 -./test-guidance.py -r ../resource/route.xml -sleep 1 -./test-map-viewer-control.py -l ../resource/location.xml +export PYTHONIOENCODING=utf-8 + +result="$(./test-poi.py -l ../resource/location.xml -s "sChü" 2>&1 >/dev/null)" +echo $result +if [[ $result != *"PASSED"* ]]; then + exit 1 +fi + +result="$(./test-location-input.py -l ../resource/locations.xml 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)" +echo $result +if [[ $result != *"PASSED"* ]]; then + exit 1 +fi + +result="$(./test-address-input.py -l ../resource/location.xml 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)" +echo $result +if [[ $result != *"PASSED"* ]]; then + exit 1 +fi + +result="$(./test-map-viewer-control.py -l ../resource/location.xml 2>&1 >/dev/null)" +echo $result +if [[ $result == *"PASSED"* ]]; then + echo "Batch test PASSED" +fi diff --git a/test/navigation/script/test-guidance.py b/test/navigation/script/test-guidance.py index 6d988fa..983b668 100755 --- a/test/navigation/script/test-guidance.py +++ b/test/navigation/script/test-guidance.py @@ -33,7 +33,7 @@ import dbus.mainloop.glib import xml.dom.minidom import argparse import sys -import errno +import os.path import time import genivi try: @@ -95,10 +95,9 @@ def routing_routeCalculationSuccessful_handler(routeHandle,unfullfilledPreferenc def session_sessionDeleted_handler(sessionHandle): print('Session handle deleted: '+str(sessionHandle)) if sessionHandle == g_navigationcore_session_handle: - print ('Test PASSED') + exit(0) else: - print ('Test FAILED') - exit() + exit(1) def routing_routeDeleted_handler(routeHandle): print('Route handle deleted: '+str(routeHandle)) @@ -151,10 +150,18 @@ def mapmatchedposition_simulationStatusChanged_handler(simulationStatus): print ("Simulation status: " +str(simulationStatus)) +# Timeout def timeout(): - print ('Timeout Expired') - print ('\nTest FAILED') - exit() + print ('Timeout Expired\n') + exit(1) + +def exit(value): + global g_exit + g_exit=value + #deleteMapView() + if dltTrigger==True: + stopTrigger(test_name) + loop.quit() def display_route(route): ret = g_routing_interface.GetRouteBoundingBox(dbus.UInt32(g_route_handle)) @@ -245,11 +252,11 @@ def createMapView(): dbus.UInt32(g_mapviewer_maphandle), \ dbus.Boolean(False)) - print ('Set the 3D perspective') + print ('Set the 2D perspective') g_mapviewercontrol_interface.SetMapViewPerspective(\ dbus.UInt32(g_mapviewer_sessionhandle),\ dbus.UInt32(g_mapviewer_maphandle), \ - genivi.PERSPECTIVE_THREE_D) + genivi.PERSPECTIVE_TWO_D) def deleteMapView(): g_mapviewercontrol_interface.ReleaseMapViewInstance( \ @@ -257,30 +264,29 @@ def deleteMapView(): dbus.UInt32(g_mapviewer_maphandle)) g_mapviewer_session_interface.DeleteSession(g_mapviewer_sessionhandle) - -def exit(): - #deleteMapView() - if dltTrigger==True: - stopTrigger(test_name) - loop.quit() - print('--------------------------') print('Guidance Test') print('--------------------------') +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') args = parser.parse_args() if args.routes == None: print('route file is missing') + print >>sys.stderr,'Test '+test_name+' FAILED' sys.exit(1) else: + if not os.path.isfile(args.routes): + print('file not exists') + print >>sys.stderr,'Test '+test_name+' FAILED' + sys.exit(1) try: DOMTree = xml.dom.minidom.parse(args.routes) except OSError as e: - if e.errno == errno.ENOENT: - print('file not exists') + print >>sys.stderr,'Test '+test_name+' FAILED' sys.exit(1) route_set = DOMTree.documentElement @@ -372,5 +378,8 @@ launch_route_calculation(0) gobject.timeout_add(TIME_OUT, timeout) loop = gobject.MainLoop() loop.run() - -#deleteMapView() +if g_exit == 1: + print >>sys.stderr,'Test '+test_name+' FAILED' +else: + print >>sys.stderr,'Test '+test_name+' PASSED' +sys.exit(g_exit) diff --git a/test/navigation/script/test-location-input.py b/test/navigation/script/test-location-input.py index d7c5adc..343e0c5 100755 --- a/test/navigation/script/test-location-input.py +++ b/test/navigation/script/test-location-input.py @@ -35,7 +35,7 @@ import dbus.mainloop.glib import xml.dom.minidom import argparse import sys -import errno +import os.path import genivi try: from dltTrigger import * @@ -67,6 +67,8 @@ print ('\n--------------------------\n' + \ 'LocationInput Test' + \ '\n--------------------------\n') +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') @@ -74,13 +76,17 @@ args = parser.parse_args() if args.locations == None: print('location file is missing') + print >>sys.stderr,'Test '+test_name+' FAILED' sys.exit(1) else: + if not os.path.isfile(args.locations): + print('file not exists') + print >>sys.stderr,'Test '+test_name+' FAILED' + sys.exit(1) try: DOMTree = xml.dom.minidom.parse(args.locations) except OSError as e: - if e.errno == errno.ENOENT: - print('file not exists') + print >>sys.stderr,'Test '+test_name+' FAILED' sys.exit(1) location_set = DOMTree.documentElement @@ -195,7 +201,6 @@ def change_selection_criterion(selection_criterion): # Spell search def spell_search(handle, entered_string, search_string, valid_characters, first=0): global entered_search_string - vprint('-> SpellSearch - entered \'' + entered_string + '\' target \'' + search_string + '\'') if unicode(search_string) != unicode(entered_string): @@ -216,11 +221,11 @@ def spell_search(handle, entered_string, search_string, valid_characters, first= location_input_interface.Spell(dbus.UInt32(session_handle), dbus.UInt32(handle), dbus.String(spell_character), dbus.UInt16(20)) else: - print ('TEST FAILED (Target character can not be entered)') - exit() + print ('Target character can not be entered') + exit(1) else: - print ('TEST FAILED (Unexpected completion)') - exit() + print ('Unexpected completion') + exit(1) else: print ('Full spell match') @@ -263,17 +268,17 @@ def evaluate_address(address, guidable): if test_passed == 1: print ('TEST PASSED') else: - print ('TEST FAILED (wrong address)') - exit() + print ('wrong address') + exit(1) else: - print ('TEST FAILED (non-guidable address)') - exit() + print ('non-guidable address') + exit(1) address_index = current_address_index + 1 if address_index < len(COUNTRY_STRING): startSearch(address_index) else: print ('END OF THE TEST') - exit() + exit(0) # Signal receiver @@ -324,8 +329,8 @@ def content_updated_handler(handle, guidable, available_selection_criteria, addr elif search_mode == 1: full_string_search(handle, target_search_string) else: - print ('\nTEST FAILED (Invalid search mode)') - exit() + print ('Invalid search mode') + exit(1) # Handler for SpellResult callback def spell_result_handler(handle, unique_string, valid_characters, full_match): @@ -346,8 +351,8 @@ def spell_result_handler(handle, unique_string, valid_characters, full_match): if len(valid_characters) == 1: if unicode(valid_characters[0]) == u'\x08': - print ('\nTEST FAILED (Dead end spelling)') - exit() + print ('Dead end spelling') + exit(1) if unicode(entered_search_string) == unicode(target_search_string): found_exact_match = 1 @@ -390,8 +395,8 @@ def search_result_list_handler(handle, total_size, window_offset, window_size, r '\' (Session '+str(int(session_handle)) + ' LocationInputHandle ' + str(int(handle))+')') location_input_interface.SelectEntry(dbus.UInt32(session_handle), dbus.UInt32(handle), dbus.UInt16(0)) else: - print ('\nTEST FAILED (Unexpected single result list)') - exit() + print ('Unexpected single result list') + exit(1) elif spell_next_character == 1: spell_next_character = 0 spell_search(handle, entered_search_string, target_search_string, available_characters) @@ -417,11 +422,12 @@ bus.add_signal_receiver(content_updated_handler, # Timeout def timeout(): - print ('Timeout Expired') - print ('\nTEST FAILED\n') - exit() + print ('Timeout Expired\n') + exit(1) -def exit(): +def exit(value): + global g_exit + g_exit=value error=location_input_interface.DeleteLocationInput(dbus.UInt32(session_handle),dbus.UInt32(location_input_handle)) print('Delete location input: '+str(int(error))) error=session_interface.DeleteSession(dbus.UInt32(session_handle)) @@ -487,3 +493,8 @@ startSearch(0) gobject.timeout_add(10000, timeout) loop = gobject.MainLoop() loop.run() +if g_exit == 1: + print >>sys.stderr,'Test '+test_name+' FAILED' +else: + print >>sys.stderr,'Test '+test_name+' PASSED' +sys.exit(g_exit) diff --git a/test/navigation/script/test-map-viewer-control.py b/test/navigation/script/test-map-viewer-control.py index 3de5196..8d96f9a 100755 --- a/test/navigation/script/test-map-viewer-control.py +++ b/test/navigation/script/test-map-viewer-control.py @@ -35,7 +35,7 @@ import time import xml.dom.minidom import argparse import sys -import errno +import os.path import genivi try: from dltTrigger import * @@ -175,16 +175,10 @@ def mapviewer_mapViewPerspectiveChanged_handler(mapViewInstanceHandle, perspecti if step==TEST_STEP_THREE_D: if int(perspective)==genivi.PERSPECTIVE_THREE_D: time.sleep(2) - print('Test 3D PASSED') + exit(0) else: - print('Test 3D failed') - exit() + exit(1) -def timeout(): - print('Timeout Expired') - print ('\nTest FAILED') - exit() - def next_step(): global step if step == TEST_STEP_START: @@ -242,7 +236,14 @@ def deleteMapView(): dbus.UInt32(g_mapviewer_maphandle)) g_mapviewer_session_interface.DeleteSession(g_mapviewer_sessionhandle) -def exit(): +# Timeout +def timeout(): + print ('Timeout Expired\n') + exit(1) + +def exit(value): + global g_exit + g_exit=value deleteMapView() if dltTrigger==True: stopTrigger(test_name) @@ -252,6 +253,8 @@ print('\n--------------------------') print('MapViewerControl Test') print('--------------------------\n') +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') @@ -259,13 +262,17 @@ args = parser.parse_args() if args.locations == None: print('location file is missing') + print >>sys.stderr,'Test '+test_name+' FAILED' sys.exit(1) else: + if not os.path.isfile(args.locations): + print('file not exists') + print >>sys.stderr,'Test '+test_name+' FAILED' + sys.exit(1) try: DOMTree = xml.dom.minidom.parse(args.locations) except OSError as e: - if e.errno == errno.ENOENT: - print('file not exists') + print >>sys.stderr,'Test '+test_name+' FAILED' sys.exit(1) location_set = DOMTree.documentElement @@ -327,14 +334,14 @@ lat2 = targetPoint[0] lon2 = targetPoint[1] alt2 = targetPoint[2] if round(float(lat1),4) != round(float(lat2),4) : - print ('\nTest Failed:' + str(round(float(lat1),4)) + '!=' + str(round(float(lat2),4)) + '\n' ) - exit() + print ('\nSet center failed:' + str(round(float(lat1),4)) + '!=' + str(round(float(lat2),4)) + '\n' ) + exit(1) if round(float(lon1),4) != round(float(lon2),4) : - print('\nTest Failed:' + str(round(float(lon1),4)) + '!=' + str(round(float(lon2),4)) + '\n' ) - exit() + print('\nSet center failed:' + str(round(float(lon1),4)) + '!=' + str(round(float(lon2),4)) + '\n' ) + exit(1) if round(float(alt1),4) != round(float(alt2),4) : - print('\nTest Failed:' + str(round(float(alt1),4)) + '!=' + str(round(float(alt2),4)) + '\n') - exit() + print('\nSet center failed:' + str(round(float(alt1),4)) + '!=' + str(round(float(alt2),4)) + '\n') + exit(1) #init the scale #get the default @@ -368,4 +375,8 @@ next_step() g_timer_timeout=gobject.timeout_add(TIME_OUT, timeout) loop = gobject.MainLoop() loop.run() - +if g_exit == 1: + print >>sys.stderr,'Test '+test_name+' FAILED' +else: + print >>sys.stderr,'Test '+test_name+' PASSED' +sys.exit(g_exit) diff --git a/test/navigation/script/test-poi.py b/test/navigation/script/test-poi.py index 65af596..690bea5 100755 --- a/test/navigation/script/test-poi.py +++ b/test/navigation/script/test-poi.py @@ -31,7 +31,7 @@ import dbus.mainloop.glib import xml.dom.minidom import argparse import sys -import errno +import os.path import genivi try: from dltTrigger import * @@ -81,8 +81,7 @@ def catch_poi_poiStatus_signal_handler(poiSearchHandle,statusValue): print("Search finished") elif statusValue == genivi.SEARCH_NOT_STARTED: g_poiSearch_interface.DeletePoiSearchHandle(poiSearchHandle) - print("Test PASSED") - exit() + exit(0) def catch_poi_resultListChanged_signal_handler(poiSearchHandle,resultListSize): poiList=[] @@ -105,11 +104,12 @@ def catch_poi_resultListChanged_signal_handler(poiSearchHandle,resultListSize): g_poiSearch_interface.CancelPoiSearch(dbus.UInt32(poiSearchHandle)) def timeout(): - print ('Timeout Expired') - print ('\nTest FAILED') - exit() + print ('Timeout Expired\n') + exit(1) -def exit(): +def exit(value): + global g_exit + g_exit=value if dltTrigger==True: stopTrigger(test_name) loop.quit() @@ -119,6 +119,9 @@ print('\n--------------------------') print('Poi Test') print('--------------------------\n') +#this script loads a file that could contains several locations but only uses the first one (to avoid creating specific resource) +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') @@ -133,13 +136,17 @@ else: if args.locations == None: print('location file is missing') + print >>sys.stderr,'Test '+test_name+' FAILED' sys.exit(1) else: + if not os.path.isfile(args.locations): + print('file not exists') + print >>sys.stderr,'Test '+test_name+' FAILED' + sys.exit(1) try: DOMTree = xml.dom.minidom.parse(args.locations) except OSError as e: - if e.errno == errno.ENOENT: - print('file not exists') + print >>sys.stderr,'Test '+test_name+' FAILED' sys.exit(1) location_set = DOMTree.documentElement @@ -236,3 +243,9 @@ g_poiSearch_interface.StartPoiSearch(g_searchHandle,stringToSearch,dbus.Int32(ge gobject.timeout_add(TIME_OUT, timeout) loop = gobject.MainLoop() loop.run() +if g_exit == 1: + print >>sys.stderr,'Test '+test_name+' FAILED' +else: + print >>sys.stderr,'Test '+test_name+' PASSED' +sys.exit(g_exit) + diff --git a/test/navigation/script/test-route-calculation.py b/test/navigation/script/test-route-calculation.py index 0a34429..336dca3 100755 --- a/test/navigation/script/test-route-calculation.py +++ b/test/navigation/script/test-route-calculation.py @@ -34,7 +34,7 @@ import dbus.mainloop.glib import xml.dom.minidom import argparse import sys -import errno +import os.path import genivi try: from dltTrigger import * @@ -54,19 +54,25 @@ print('--------------------------') print('Route Calculation Test') print('--------------------------') +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') args = parser.parse_args() if args.routes == None: print('route file is missing') + print >>sys.stderr,'Test '+test_name+' FAILED' sys.exit(1) else: + if not os.path.isfile(args.routes): + print('file not exists') + print >>sys.stderr,'Test '+test_name+' FAILED' + sys.exit(1) try: DOMTree = xml.dom.minidom.parse(args.routes) except OSError as e: - if e.errno == errno.ENOENT: - print('file not exists') + print >>sys.stderr,'Test '+test_name+' FAILED' sys.exit(1) route_set = DOMTree.documentElement @@ -124,10 +130,9 @@ def catchall_route_calculation_signals_handler(routeHandle, status, percentage): def catchall_session_signals_handler(sessionHandle): print('Session handle deleted: '+str(sessionHandle)) if sessionHandle == g_session_handle: - print ('Test PASSED') + exit(0) else: - print ('Test FAILED') - exit() + exit(1) def catchall_route_deleted_signals_handler(routeHandle): print('Route handle deleted: '+str(routeHandle)) @@ -146,11 +151,12 @@ bus.add_signal_receiver(catchall_session_signals_handler, \ #timeout def timeout(): - print ('Timeout Expired') - print ('\nTest FAILED') - exit() + print ('Timeout Expired\n') + exit(1) -def exit(): +def exit(value): + global g_exit + g_exit=value if dltTrigger==True: stopTrigger(test_name) loop.quit() @@ -201,10 +207,12 @@ g_routing_interface = dbus.Interface(routing_obj, dbus_interface='org.genivi.nav g_current_route = 0 launch_route_calculation(0) - #main loop gobject.timeout_add(TIME_OUT, timeout) loop = gobject.MainLoop() loop.run() - - +if g_exit == 1: + print >>sys.stderr,'Test '+test_name+' FAILED' +else: + print >>sys.stderr,'Test '+test_name+' PASSED' +sys.exit(g_exit) |