diff options
Diffstat (limited to 'test/navigation/script/test-address-input.py')
-rwxr-xr-x | test/navigation/script/test-address-input.py | 43 |
1 files changed, 27 insertions, 16 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) |