def test(commandList):
    """
    Test two program with the same test case.
    Different output leads to FAIL,
    otherwise PASS
    """
    print 'Testing set is: '
    print commandList
    commands = ''.join(commandList)
    failCmd = ['./a_fail','2','8','7']
    passCmd = ['./a_pass','2','8','7']
    a_fail = subprocess.Popen(failCmd,stdin=PIPE,stdout=PIPE)
    #return (stdout,stderr)
    a_fail_output = a_fail.communicate(commands)[0]

    a_pass = subprocess.Popen(passCmd,stdin=PIPE,stdout=PIPE)
    a_pass_output = a_pass.communicate(commands)[0]

    if a_fail_output != a_pass_output:
        print "Two result doesn't match ----> FAIL"
        anykeyContinue = raw_input('Any key to continue: ')
        return FAIL
    else:
        print "Two result match ----> PASS"
        anykeyContinue = raw_input('Any key to continue: ')
        return PASS

    Test two program with the same test case.
    Different output leads to FAIL,
    otherwise PASS
    
recipes/Python/578144_Delta_Debug__DDMin_/recipe-578144.py