コード例 #1
0
    file_version = int(file_version_line[0].split(" ")[-1])
    file_id_hex = file_id_line[0].split(" ")[-1]
    if len(file_id_hex) != 16:
        file_id_hex = ("0" * (16 - len(file_id_hex))) + file_id_hex

    file_id_hex_parts = []
    for i in xrange(0, 4):
        file_id_hex_parts.append( file_id_hex[4*i] + file_id_hex[4*i+1] + file_id_hex[4*i+2] + file_id_hex[4*i+3] )

    # expected built-in attr for cached file data
    gateway_info = testlib.read_gateway( config_dir, gateway_name )
    getxattr_gateway_info = testlib.read_gateway( config_dir, getxattr_gateway_name )
    gateway_coord_id = gateway_info['g_id']
    getxattr_gateway_id = getxattr_gateway_info['g_id']
    volume_info = testlib.read_volume( config_dir, volume_name )
    file_cache_path = os.path.join( testlib.cache_dir( config_dir, volume_info['volume_id'], getxattr_gateway_id ), "/".join(file_id_hex_parts)) + "." + file_id_hex + "." + str(file_version)
    builtin_xattr_expected_values["user.syndicate_coordinator"] = gateway_name
    builtin_xattr_expected_values["user.syndicate_cached_file_path"] = file_cache_path

    # leave this gateway running, so it can answer xattr queries 
    ug_proc, ug_out_path = testlib.start_gateway( config_dir, COORD_PATH, testconf.SYNDICATE_ADMIN, volume_name, gateway_name, path, valgrind=True ) 
    time.sleep(5)

    # get built-in xattrs, individually, with the getxattr gateway
    for builtin_xattr in builtin_xattrs:
        exitcode, out = testlib.run( GETXATTR_PATH, '-d2', '-f', '-c', os.path.join(config_dir, 'syndicate.conf'),
                                     '-u', testconf.SYNDICATE_ADMIN, '-v', volume_name, '-g', getxattr_gateway_name,
                                     path, builtin_xattr )

        testlib.save_output( output_dir, "syndicate-getxattr-%s" % builtin_xattr, out )
        if exitcode != 0:
コード例 #2
0
        # try going back and forth a few times
        repl_cmd += "rename %s %s\n" % (input_path, output_path)
       
    for i in xrange(0, NUM_FILES):
        output_path_samedir = output_paths[i] + "-renamed"
        output_path_newdir = "/newdir/" + output_paths[i] + "-renamed"
        path = None
        
        # select the correct path to read, based on the above generation
        if i % 2 == 0:
            path = output_path_samedir
        else:
            path = output_path_newdir

        # clear cache
        read_cache_dir = testlib.cache_dir( config_dir, volume_id, cat_gateway_id )
        rg_cache_dir = testlib.cache_dir( config_dir, volume_id, rg_gateway_id )

        repl_cmd += "shell rm -rf %s\n" % read_cache_dir
        repl_cmd += "shell rm -rf %s\n" % rg_cache_dir

        # open and read in full
        repl_cmd += "open %s 2\n" % path
        repl_cmd += "read 0 0 %s\n" % len(expected_data)
        repl_cmd += "close 0\n"

    
    print "\n".join( ["< %s" % l[:min(80, len(l))] + "..."[:min(max(0, len(l)-80), 3)] for l in repl_cmd.split("\n")] )

    # open the syndicate REPL
    ug_proc, ug_out_path = testlib.start_gateway( config_dir, REPL_PATH, testconf.SYNDICATE_ADMIN, volume_name, gateway_name, valgrind=True, stdin=True)
コード例 #3
0
        # try going back and forth a few times
        repl_cmd += "rename %s %s\n" % (input_path, output_path)

    for i in xrange(0, NUM_FILES):
        output_path_samedir = output_paths[i] + "-renamed"
        output_path_newdir = "/newdir/" + output_paths[i] + "-renamed"
        path = None

        # select the correct path to read, based on the above generation
        if i % 2 == 0:
            path = output_path_samedir
        else:
            path = output_path_newdir

        # clear cache
        read_cache_dir = testlib.cache_dir(config_dir, volume_id,
                                           cat_gateway_id)
        rg_cache_dir = testlib.cache_dir(config_dir, volume_id, rg_gateway_id)

        repl_cmd += "shell rm -rf %s\n" % read_cache_dir
        repl_cmd += "shell rm -rf %s\n" % rg_cache_dir

        # open and read in full
        repl_cmd += "open %s 2\n" % path
        repl_cmd += "read 0 0 %s\n" % len(expected_data)
        repl_cmd += "close 0\n"

    print "\n".join([
        "< %s" % l[:min(80, len(l))] + "..."[:min(max(0,
                                                      len(l) - 80), 3)]
        for l in repl_cmd.split("\n")
    ])
コード例 #4
0
    file_id_hex_parts = []
    for i in xrange(0, 4):
        file_id_hex_parts.append(file_id_hex[4 * i] + file_id_hex[4 * i + 1] +
                                 file_id_hex[4 * i + 2] +
                                 file_id_hex[4 * i + 3])

    # expected built-in attr for cached file data
    gateway_info = testlib.read_gateway(config_dir, gateway_name)
    getxattr_gateway_info = testlib.read_gateway(config_dir,
                                                 getxattr_gateway_name)
    gateway_coord_id = gateway_info['g_id']
    getxattr_gateway_id = getxattr_gateway_info['g_id']
    volume_info = testlib.read_volume(config_dir, volume_name)
    file_cache_path = os.path.join(
        testlib.cache_dir(config_dir, volume_info['volume_id'],
                          getxattr_gateway_id), "/".join(file_id_hex_parts)
    ) + "." + file_id_hex + "." + str(file_version)
    builtin_xattr_expected_values["user.syndicate_coordinator"] = gateway_name
    builtin_xattr_expected_values[
        "user.syndicate_cached_file_path"] = file_cache_path

    # leave this gateway running, so it can answer xattr queries
    ug_proc, ug_out_path = testlib.start_gateway(config_dir,
                                                 COORD_PATH,
                                                 testconf.SYNDICATE_ADMIN,
                                                 volume_name,
                                                 gateway_name,
                                                 path,
                                                 valgrind=True)
    time.sleep(5)