def stop_and_save( output_dir, proc, out_path, save_name ):
    exitcode, out = testlib.stop_gateway( proc, out_path )
    testlib.save_output( output_dir, save_name, out )
    return exitcode, out
Пример #2
0
                                               volume_name,
                                               "AG",
                                               caps="ALL",
                                               email=testconf.SYNDICATE_ADMIN)
    testlib.update_gateway(config_dir, AG_gateway_name, "port=31112",
                           "driver=%s" % AG_DRIVER)
    ag_proc, ag_out_path = testlib.start_gateway(config_dir,
                                                 AG_PATH,
                                                 testconf.SYNDICATE_ADMIN,
                                                 volume_name,
                                                 AG_gateway_name,
                                                 valgrind=True)
    time.sleep(30)

    if not testlib.gateway_ping(31112, 15):
        ag_exitcode, ag_out = testlib.stop_gateway(ag_proc, ag_out_path)
        testlib.save_output(output_dir, "syndicate-ag", ag_out)
        raise Exception("%s exited %s" % (AG_PATH, ag_proc.poll()))

    # should cause the AG to get updated that there's a new gateway
    ug_gateway_name = testlib.add_test_gateway(config_dir,
                                               volume_name,
                                               "UG",
                                               caps="ALL",
                                               email=testconf.SYNDICATE_ADMIN)

    # remove inner dir, and have the AG refresh
    shutil.rmtree(rmdir)
    exitcode, out = testlib.run(REFRESH_PATH,
                                '-d2',
                                '-f',
        if abort:
            for i in xrange(0, num_threads):
                threads[i].set_errors(abort)

            for i in xrange(0, num_threads):
                threads[i].join()

        dead = True
        for i in xrange(0, num_threads):
            if threads[i].isAlive():
                dead = False

    if abort:
        stop_and_save( output_dir, ag_proc, ag_out_path, "syndicate-ag")
        msg = []
        for i in xrange(0, num_threads):
            if threads[i].get_exitcode() != 0:
                msg.append("Thread %s (%s) exited %s, error = '%s'" % (threads[i].get_ident(), i, threads[i].get_exitcode(), threads[i].get_errormsg()))

        raise Exception("\n" + "\n".join(msg))

    ag_exitcode, ag_out = testlib.stop_gateway( ag_proc, ag_out_path )

    testlib.save_output( output_dir, "syndicate-ag", ag_out )

    if ag_exitcode != 0:
        raise Exception("%s exited %s" % (AG_PATH, ag_exitcode))
  
    sys.exit(0)
Пример #4
0
def stop_and_save( output_dir, proc, out_path, save_name ):
    exitcode, out = testlib.stop_gateway( proc, out_path )
    testlib.save_output( output_dir, save_name, out )
    return exitcode, out
        # do each read twice--once uncached, and one cached 
        for i in xrange(0, 2):

            exitcode, out = testlib.run( READ_PATH, '-d2', '-f', '-c', os.path.join(config_dir, 'syndicate.conf'),
                                        '-u', testconf.SYNDICATE_ADMIN, '-v', volume_name, '-g', read_gateway_name,
                                        output_path, start, end - start, valgrind=True )

            outname = "uncached"
            if i > 0:
                outname = "cached"

            testlib.save_output( output_dir, 'syndicate-read-%s-%s-%s' % (start, end, outname), out )
            if exitcode != 0:
                stop_and_save( output_dir, rg_proc, rg_out_path, "syndicate-rg" )
                raise Exception("%s exited %s" % (READ_PATH, exitcode))

            # correctness 
            if expected_data[start:end] not in out:
                stop_and_save( output_dir, rg_proc, rg_out_path, "syndicate-rg" )
                print >> sys.stderr, "Missing data\n%s\n" % expected_data[start:end]
                raise Exception("Missing data for %s-%s" % (start, end))

    rg_exitcode, rg_out = testlib.stop_gateway( rg_proc, rg_out_path )
    testlib.save_output( output_dir, "syndicate-rg", rg_out )

    if rg_exitcode != 0:
        raise Exception("%s exited %s" % (RG_PATH, rg_exitcode))
  
    sys.exit(0)
    if exitcode != 0:
        raise Exception("%s exited %s" % (SETXATTR_PATH, exitcode))

    # start up xattr coordinator,
    coord_proc, coord_out_path = testlib.start_gateway( config_dir, COORD_PATH, testconf.SYNDICATE_ADMIN, volume_name, gateway_name, path, valgrind=True )
    if not testlib.gateway_ping( 31111, 15 ):
        raise Exception("%s exited %s" % (COORD_PATH, coord_proc.poll()))

    # remove 1 xattr, from the client
    exitcode, out_remove1xattr = testlib.run( REMOVEXATTR_PATH, '-d2', '-f', '-c', os.path.join(config_dir, "syndicate.conf"),
                                          '-u', testconf.SYNDICATE_ADMIN, '-v', volume_name, '-g', gateway_client_name,
                                          path, attr_name_base + '-1attr', valgrind=True )

    testlib.save_output( output_dir, 'syndicate-removexattr-1attr', out_remove1xattr )
    if exitcode != 0:
        coord_exitcode, coord_out = testlib.stop_gateway( coord_proc, coord_out_path )
        testlib.save_output( output_dir, "syndicate-coord-xattr", coord_out )
        raise Exception("%s exited %s" % (REMOVEXATTR_PATH, exitcode))

    # remove 5 attrs at once, from the client
    exitcode, out_remove5xattr = testlib.run( REMOVEXATTR_PATH, '-d2', '-f', '-c', os.path.join(config_dir, 'syndicate.conf'),
                                          '-u', testconf.SYNDICATE_ADMIN, '-v', volume_name, '-g', gateway_client_name,
                                          path,
                                          attr_name_base + '-5attr-1',
                                          attr_name_base + '-5attr-2',
                                          attr_name_base + '-5attr-3',
                                          attr_name_base + '-5attr-4',
                                          attr_name_base + '-5attr-5',
                                          valgrind=True )

    testlib.save_output( output_dir, "syndicate-removexattr-5attr", out_remove5xattr )
                                        output_path,
                                        start,
                                        end - start,
                                        valgrind=True)

            outname = "uncached"
            if i > 0:
                outname = "cached"

            testlib.save_output(
                output_dir, 'syndicate-read-%s-%s-%s' % (start, end, outname),
                out)
            if exitcode != 0:
                stop_and_save(output_dir, rg_proc, rg_out_path, "syndicate-rg")
                raise Exception("%s exited %s" % (READ_PATH, exitcode))

            # correctness
            if expected_data[start:end] not in out:
                stop_and_save(output_dir, rg_proc, rg_out_path, "syndicate-rg")
                print >> sys.stderr, "Missing data\n%s\n" % expected_data[
                    start:end]
                raise Exception("Missing data for %s-%s" % (start, end))

    rg_exitcode, rg_out = testlib.stop_gateway(rg_proc, rg_out_path)
    testlib.save_output(output_dir, "syndicate-rg", rg_out)

    if rg_exitcode != 0:
        raise Exception("%s exited %s" % (RG_PATH, rg_exitcode))

    sys.exit(0)
Пример #8
0
                                             os.path.join(
                                                 config_dir, "syndicate.conf"),
                                             '-u',
                                             testconf.SYNDICATE_ADMIN,
                                             '-v',
                                             volume_name,
                                             '-g',
                                             gateway_client_name,
                                             path,
                                             attr_name_base + '-1attr',
                                             valgrind=True)

    testlib.save_output(output_dir, 'syndicate-removexattr-1attr',
                        out_remove1xattr)
    if exitcode != 0:
        coord_exitcode, coord_out = testlib.stop_gateway(
            coord_proc, coord_out_path)
        testlib.save_output(output_dir, "syndicate-coord-xattr", coord_out)
        raise Exception("%s exited %s" % (REMOVEXATTR_PATH, exitcode))

    # remove 5 attrs at once, from the client
    exitcode, out_remove5xattr = testlib.run(REMOVEXATTR_PATH,
                                             '-d2',
                                             '-f',
                                             '-c',
                                             os.path.join(
                                                 config_dir, 'syndicate.conf'),
                                             '-u',
                                             testconf.SYNDICATE_ADMIN,
                                             '-v',
                                             volume_name,
                                             '-g',