def test_run_xfstest(test_dir,s_dir): '''Wrapper over invoking xfstest on the given host default it will test xfs ''' test_share = shares.find_share(test_dir) scratch_share = shares.find_share(s_dir) # create scratch_mnt if it does not exist otherwise xfstests abort command = '/usr/bin/mkdir -p ' + env.env['xfstest']['scratch_mnt'] pd.run_cmd('client', command) command = '(cd ' + env.env['paths']['xfstestpath'] + ' ; export TEST_DIR=' + env.env['paths']['mount'] + ' ; export TEST_DEV=' + env.env['dd']['address'] + ':' + test_share['path'] + ' ; export SCRATCH_DEV=' + env.env['dd']['address'] + ':' + scratch_share['path'] + '; export SCRATCH_MNT=' + env.env['xfstest']['scratch_mnt'] + ' ; export NFS_MOUNT_OPTIONS=\"-o minorversion=2\"' + ' ; ./check -nfs -T )' print command return pd.run_cmd('client', command)
def test_run_fstest(test_dir): '''Wrapper over invoking fstest on the given share''' share = shares.find_share(test_dir) exclude_list = '-t:-filename:chmod/ctime -t:-filename:chown/ctime -t:-filename:read_write/mctime -t:-filename:unlink/mctime -t:-filename:open/flag_creat -t:-filename:chown/setid_nonroot -t:-filename:open/mctime -t:-filename:readlink/atime -t:-filename:read_write/atime' command = '(cd ' + env.env['paths']['fstest'] + '; ./fstest-suite -f nfs4p -d ' + env.env['paths']['mount'] + share['path'] + ' ' + exclude_list + ')' return pd.run_cmd('client', command)
def client_mounted_path(name): '''Construct the fully qualified mount path of a share''' share = shares.find_share(name) if name == 'root': path = env.env['paths']['mount'] else: path = env.env['paths']['mount'] + share['path'] return path
def test_run_cthon(test_dir): """Wrapper over invoking cthon on the given share""" share = shares.find_share(test_dir) command = ( "(cd " + env.env["paths"]["cthon"] + "; /usr/bin/echo y | ./server -o vers=4.2 -p " + share["path"] + " -m " + env.env["paths"]["mount"] + " " + env.env["dd"]["address"] + ")" ) return pd.run_cmd("client", command)
def share_tests(): '''Run the namespace regression tests''' test_pass('Running Test shares.delete_all_shares', shares.delete_all_shares) test_fail('Running Test mount.root - should fail to mount', test_mount_root) test_fail('Running Test shares.test_create_share alpo - should fail to create', shares.test_create_share, 'alpo') test_fail('Running Test shares.test_create_invalid_shareid - should fail to create', shares.test_create_invalid_shareid) test_pass('Running Test shares.test_create_share root', shares.test_create_share, 'root') test_pass('Running Test shares.test_create_share alpo', shares.test_create_share, 'alpo') test_pass('Running Test shares.share_remove alpo', shares.share_remove, 'alpo') test_pass('Running Test recreate shares.test_create_share alpo', shares.test_create_share, 'alpo') test_fail('Running Test shares.test_create_existing_shareid - should fail to create', shares.test_create_existing_shareid) test_fail('Running Test shares.test_create_existing_name - should fail to create', shares.test_create_existing_name) test_fail('Running Test shares.test_create_existing_path - should fail to create', shares.test_create_existing_path) test_fail('Running Test shares.test_create_existing_share - should fail to create', shares.test_create_existing_share) test_fail('Running Test shares.test_create_existing_uuid - should fail to create', shares.test_create_existing_uuid) test_fail('Running Test shares.test_create_invalid_path - should fail to create', shares.test_create_invalid_path) test_fail('Running Test shares.test_reuse_root - should fail to create', shares.test_reuse_root) test_fail('Running Test shares.test_mount_over - should fail to create', shares.test_mount_over) test_fail('Running Test shares.test_create_existing_share - should fail to create', shares.test_create_existing_share) test_pass('Running Test shares.test_create_share matic', shares.test_create_share, 'matic') test_pass('Running Test mount.root - should mount', test_mount_root) test_pass('Running Test shares.test_create_share deep1', shares.test_create_share, 'deep1') test_pass('Checking to see if deep1 exists', test_share_loaded, 'deep1') test_pass('Running Test shares.test_create_share deep2', shares.test_create_share, 'deep2') test_pass('Checking to see if deep1 exists', test_share_loaded, 'deep2') test_pass('Running Test shares.test_create_share deep3', shares.test_create_share, 'deep3') test_pass('Checking to see if deep1 exists', test_share_loaded, 'deep3') test_pass('Running Test shares.test_create_share deep4', shares.test_create_share, 'deep4') test_pass('Checking to see if deep1 exists', test_share_loaded, 'deep4') cover_base = shares.find_share('cover_base') cover_base_path = cover_base['path'].split('/') if len(cover_base_path) < 4: print cover_base_path + ' must be at least 3 deep' sys.exit(1) test_pass('Checking to see if we can load cover_base', shares.test_create_share, 'cover_base') new_path = '/'.join(cover_base_path[0:2]) test_fail('Checking to see if we can load cover as ' + new_path, shares.share_create_path, 'cover', new_path) new_path = '/'.join(cover_base_path[0:3]) test_fail('Checking to see if we can load cover as ' + new_path, shares.share_create_path, 'cover', new_path) new_path = '/'.join(cover_base_path[0:4]) test_fail('Checking to see if we can load cover as ' + new_path, shares.share_create_path, 'cover', new_path) new_path = '/'.join(cover_base_path[0:3]) new_path = new_path[:-1] test_pass('Checking to see if we can load cover as ' + new_path, shares.share_create_path, 'cover', new_path) test_pass('Can we chmod the root?', test_open_up_share, 'root') mount_dir = env.env['paths']['mount'] src = env.env['paths']['rgr'] + '/' + env.env['files']['test1'] dst = mount_dir + '/' + env.env['files']['test1'] test_pass('Copying ' + src + ' to ' + dst, test_copy_file, src, dst) # FIXME: Refactor! test_pass('Can we mkdir /a.dir?', test_client_mkdir, 'root', 'a.dir') dst_a = mount_dir + '/a.dir' + '/' + env.env['files']['test1'] test_pass('Copying ' + src + ' to ' + dst_a, test_copy_file, src, dst_a) test_pass('Can we mkdir /b.dir?', test_client_mkdir, 'root', 'b.dir') dst_b = mount_dir + '/b.dir' + '/' + env.env['files']['test1'] test_pass('Copying ' + src + ' to ' + dst_b, test_copy_file, src, dst_b) test_pass('Can we mkdir /c.dir?', test_client_mkdir, 'root', 'c.dir') dst_c = mount_dir + '/c.dir' + '/' + env.env['files']['test1'] test_pass('Copying ' + src + ' to ' + dst_c, test_copy_file, src, dst_c) test_pass('Comparing ' + dst_a + ' to ' + dst_b, test_cmp_file, dst_a, dst_b) test_pass('Comparing ' + dst_a + ' to ' + dst_c, test_cmp_file, dst_a, dst_c) test_pass('Comparing ' + dst_b + ' to ' + dst_c, test_cmp_file, dst_b, dst_c) test_pass('Try a hard link', test_ln_file, dst_c, dst_c + '.lnk') mknod_file = mount_dir + '/dev_null' test_pass('Try a mknod', test_mknod_file, mknod_file) test_pass('Try a directory mv of a.dir to b.dir', test_mv_obj, mount_dir + '/a.dir', mount_dir + '/b.dir') test_pass('Try a soft link on directories', test_ln_s_file, mount_dir + '/b.dir/a.dir', mount_dir + '/c.dir/d.dir') test_pass('Can we mkdir /rookie?', test_client_mkdir, 'root', 'rookie') test_pass('Can we echo to /rookie/surprise?', test_client_echo, 'root', 'Test the rookie share', 'rookie/surprise') test_pass('Can we echo to /surprise?', test_client_echo, 'root', 'Test the rookie share', 'surprise') test_pass('Running Test shares.test_create_share rookie', shares.test_create_share, 'rookie') path = client_mounted_path('root') sup1 = path + '/rookie/surprise' sup2 = path + '/surprise' test_pass('Comparing ' + sup1 + ' to ' + sup2 + ', which should work because the client has the FH for the directory cached', test_cmp_file, sup1, sup2) test_pass('Does ' + sup1 + ' exist?', test_check_file, sup1) test_pass('Does ' + sup2 + ' exist?', test_check_file, sup2) test_pass('List the contents of root', test_client_ls, 'root') test_pass('Running Test umount.root', test_umount_root) test_pass('Running Test mount.root - should mount', test_mount_root) test_fail('Does ' + sup1 + ' exist?', test_check_file, sup1) test_pass('Does ' + sup2 + ' exist?', test_check_file, sup2) test_fail('Comparing ' + sup1 + ' to ' + sup2 + ', which should fail because /rookie is covered', test_cmp_file, sup1, sup2) test_fail('Test if we can see it at all', test_client_cat, 'root', 'rookie/surprise') test_pass('Running Test shares.share_remove rookie', shares.share_remove, 'rookie') test_fail('Comparing ' + sup1 + ' to ' + sup2 + ', which should fail because /rookie is still covered', test_cmp_file, sup1, sup2) test_fail('Test if we can see it at all', test_client_cat, 'root', 'rookie/surprise') test_pass('Test if we can see it at all', test_client_cat, 'root', 'surprise') test_pass('Running Test umount.root', test_umount_root) test_pass('Running Test mount.root - should mount', test_mount_root) test_pass('Does ' + sup1 + ' exist?', test_check_file, sup1) test_pass('Does ' + sup2 + ' exist?', test_check_file, sup2) test_pass('List the contents of root', test_client_ls, 'root') test_pass('Comparing ' + sup1 + ' to ' + sup2 + ', which should work because the client has the FH for the directory cached', test_cmp_file, sup1, sup2) test_pass('Running Test umount.root', test_umount_root)