#!/usr/bin/python #program: import os def newline(): print '\n' ## tests each app by running them def app_test(a, b, c): auto_menu = '' if os.system(a) == 0: auto_menu = auto_menu + 'a' elif os.system(a) == 1: auto_menu = auto_menu + x else: auto_menu = auto_menu + x if os.system(b) == 0: auto_menu = auto_menu + 'b' elif os.system(b) == 1: auto_menu = auto_menu + x else: auto_menu = auto_menu + x if os.system(c) == 0: auto_menu = auto_menu + 'c' elif os.system(c) == 1: auto_menu = auto_menu + x else: auto_menu = auto_menu + x #print auto_menu if auto_menu == 'abc': return auto_menu else: return auto_menu ## touch the compression test, test data os.system('touch /tmp/test.me') ## setup the varibles that handle the programs prog_zip = 'zip' prog_bzip = 'bzip2' prog_tar = 'tar' #prog_lzma = ## set other varibles needed menu_type = '' ## set up the command lines for the test prog_a = prog_bzip + ' -9fkvv /tmp/test.me &> /dev/null' prog_b = prog_zip + ' -h &> /dev/null' prog_c = prog_tar + ' --help &> /dev/null' #prog_d = prog_lzma + '' ## Pass the above varibles to the test loop and prints them #print app_test(prog_a, prog_b, prog_c) zeo = app_test(prog_a, prog_b,prog_c) if zeo == 'abc': menu_type = 123 elif zeo == 'bc': menu_type = 23 elif zeo == 'ab': menu_type = 12 elif zeo == 'ac': menu_type = 13 else: menu_type = 000 print zeo print menu_type ##remove the test file #os.system('rm /tmp/test.me*')