From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,NORMAL_HTTP_TO_IP,NUMERIC_HTTP_ADDR,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F68BC433F8 for ; Mon, 20 Jul 2020 09:15:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 16F312080D for ; Mon, 20 Jul 2020 09:15:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726486AbgGTJPF (ORCPT ); Mon, 20 Jul 2020 05:15:05 -0400 Received: from mx2.suse.de ([195.135.220.15]:58634 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728173AbgGTJPC (ORCPT ); Mon, 20 Jul 2020 05:15:02 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 6AF94ADC2; Mon, 20 Jul 2020 09:15:02 +0000 (UTC) From: Petr Vorel To: ltp@lists.linux.it Cc: Petr Vorel , Alexey Kodanev , Xiao Yang , linux-nfs@vger.kernel.org, Chuck Lever , "J . Bruce Fields" Subject: [RFC PATCH 1/1] Remove nfsv4 Date: Mon, 20 Jul 2020 11:14:49 +0200 Message-Id: <20200720091449.19813-1-pvorel@suse.cz> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Reasons to drop: * outdated tests (from 2005) * not used (NFS kernel maintainers use pynfs [1]) * written in Python (we support C and shell, see [2]) [1] http://git.linux-nfs.org/?p=bfields/pynfs.git;a=summary [2] https://github.com/linux-test-project/ltp/issues/547 Signed-off-by: Petr Vorel --- @Chuck, Bruce: FYI RFC to drop NFS related legacy test suite from LTP. Kind regards, Petr testcases/network/.gitignore | 2 - testcases/network/nfsv4/Makefile | 26 - testcases/network/nfsv4/acl/Makefile | 29 - testcases/network/nfsv4/acl/README | 21 - testcases/network/nfsv4/acl/acl1.c | 373 ------ testcases/network/nfsv4/acl/cleangroups.py | 10 - testcases/network/nfsv4/acl/cleanusers.py | 12 - testcases/network/nfsv4/acl/create_users.py | 21 - testcases/network/nfsv4/acl/random_gen.py | 251 ---- testcases/network/nfsv4/acl/runtest | 70 -- testcases/network/nfsv4/acl/setacl_stress.py | 32 - testcases/network/nfsv4/acl/test_acl.py | 122 -- testcases/network/nfsv4/acl/test_long_acl.py | 44 - testcases/network/nfsv4/locks/Makefile | 33 - testcases/network/nfsv4/locks/README | 169 --- testcases/network/nfsv4/locks/VERSION | 3 - .../nfsv4/locks/deploy/locktests.tar.gz | Bin 12354 -> 0 bytes testcases/network/nfsv4/locks/deploy_info | 37 - testcases/network/nfsv4/locks/locktests.c | 1034 ----------------- testcases/network/nfsv4/locks/locktests.h | 165 --- testcases/network/nfsv4/locks/locktests.py | 236 ---- testcases/network/nfsv4/locks/netsync.c | 201 ---- 22 files changed, 2891 deletions(-) delete mode 100644 testcases/network/nfsv4/Makefile delete mode 100644 testcases/network/nfsv4/acl/Makefile delete mode 100644 testcases/network/nfsv4/acl/README delete mode 100644 testcases/network/nfsv4/acl/acl1.c delete mode 100755 testcases/network/nfsv4/acl/cleangroups.py delete mode 100755 testcases/network/nfsv4/acl/cleanusers.py delete mode 100755 testcases/network/nfsv4/acl/create_users.py delete mode 100755 testcases/network/nfsv4/acl/random_gen.py delete mode 100755 testcases/network/nfsv4/acl/runtest delete mode 100755 testcases/network/nfsv4/acl/setacl_stress.py delete mode 100755 testcases/network/nfsv4/acl/test_acl.py delete mode 100755 testcases/network/nfsv4/acl/test_long_acl.py delete mode 100644 testcases/network/nfsv4/locks/Makefile delete mode 100644 testcases/network/nfsv4/locks/README delete mode 100644 testcases/network/nfsv4/locks/VERSION delete mode 100644 testcases/network/nfsv4/locks/deploy/locktests.tar.gz delete mode 100644 testcases/network/nfsv4/locks/deploy_info delete mode 100644 testcases/network/nfsv4/locks/locktests.c delete mode 100644 testcases/network/nfsv4/locks/locktests.h delete mode 100755 testcases/network/nfsv4/locks/locktests.py delete mode 100644 testcases/network/nfsv4/locks/netsync.c diff --git a/testcases/network/.gitignore b/testcases/network/.gitignore index dab2bc34e..b5cdb351a 100644 --- a/testcases/network/.gitignore +++ b/testcases/network/.gitignore @@ -17,8 +17,6 @@ /nfs/nfs_stress/nfs05_make_tree /nfs/nfslock01/nfs_flock /nfs/nfslock01/nfs_flock_dgen -/nfsv4/acl/acl1 -/nfsv4/locks/locktests /rpc/basic_tests/rpc01/rpc1 /rpc/basic_tests/rpc01/rpc_server /sctp/sctp_big_chunk diff --git a/testcases/network/nfsv4/Makefile b/testcases/network/nfsv4/Makefile deleted file mode 100644 index a311eaa42..000000000 --- a/testcases/network/nfsv4/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# -# network/nfsv4 test suite Makefile. -# -# Copyright (C) 2009, Cisco Systems Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Ngie Cooper, July 2009 -# - -top_srcdir ?= ../../.. - -include $(top_srcdir)/include/mk/env_pre.mk -include $(top_srcdir)/include/mk/generic_trunk_target.mk diff --git a/testcases/network/nfsv4/acl/Makefile b/testcases/network/nfsv4/acl/Makefile deleted file mode 100644 index 8c55a6bbd..000000000 --- a/testcases/network/nfsv4/acl/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# -# network/nfsv4/acl testcases Makefile. -# -# Copyright (C) 2009, Cisco Systems Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Ngie Cooper, September 2009 -# - -top_srcdir ?= ../../../.. - -include $(top_srcdir)/include/mk/env_pre.mk - -LDLIBS += $(ACL_LIBS) - -include $(top_srcdir)/include/mk/generic_leaf_target.mk diff --git a/testcases/network/nfsv4/acl/README b/testcases/network/nfsv4/acl/README deleted file mode 100644 index 15a0e0a48..000000000 --- a/testcases/network/nfsv4/acl/README +++ /dev/null @@ -1,21 +0,0 @@ -ACL testing -Aurélien Charbon - Bull SA - -# GOAL : -Testing ACL conformance, ACL limits, and ACL robustness - -# REQUIREMENTS : -ACL support must be present on the remote host -attr and acl packages must be install for the stestsuite to build/run. -This testsuite is not built by the default make in the LTP root directory - -acl1: verify the conformance ok access regarding the ACL of files and directory. -stress: multiprocess application to stress the ACL - -setacl_stress.py: python script that does lots of setfacl function - -test_long_acl.py: try to "build" ACLs of different length. Stop when the specified maximum length is reached. - -To run the test: -make (builds the binaries) -./runtest (executes the sequence of tests) diff --git a/testcases/network/nfsv4/acl/acl1.c b/testcases/network/nfsv4/acl/acl1.c deleted file mode 100644 index ad778cd33..000000000 --- a/testcases/network/nfsv4/acl/acl1.c +++ /dev/null @@ -1,373 +0,0 @@ -/* - * Aurélien Charbon - Bull SA - * ACL testing basic program - * Purpose: setting an acl on a file a verifies that the accesses are right - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "config.h" -#include "tst_res_flags.h" - -#ifdef HAVE_LIBACL - -#include - -#define OP_READ 0x1 -#define OP_WRITE 0x2 -#define OP_EXEC 0x4 - -acl_t testacl; -/* the "typical" acl used for the test */ - -static char *permtab[] = - { "---", "r--", "-w-", "rw-", "--x", "r-x", "-wx", "rwx" }; - -struct statstore { - /* number of passed tests */ - int ok; - /* number of failed tests */ - int failed; -} aclstat; - -int do_file_op(char *filename) -{ - int exe; - int result; - uid_t uid; - result = 0; - FILE *fptr; - char str[256] = "./"; - - uid = geteuid(); - strcat(str, filename); - - exe = execl(str, NULL, NULL); - if (exe == -1 && errno != EACCES) - result = result + OP_EXEC; - - fptr = fopen(filename, "r"); - if (fptr != NULL) { - result = result + OP_READ; - fclose(fptr); - } - - fptr = fopen(filename, "r+"); - if (fptr != NULL) { - result = result + OP_WRITE; - fclose(fptr); - } - - return result; -} - -/* acl with user entries used for the test */ -acl_t test_acl_user_create(void) -{ - char acl_text[] = - "u::rwx,u:user1:rwx,u:user2:rw-,u:user3:r--,u:user4:r-x,u:user5:---,g::r-x,o::r-x,m::rwx"; - acl_t acl; - acl = acl_from_text(acl_text); - return acl; -} - -/* acl with group entries used for the test */ - -acl_t test_acl_grp_create(void) -{ - char acl_text[] = - "u::rwx,g:grp1:rwx,g:grp2:rw-,g:grp3:r--,g:grp4:r-x,g:grp5:---,g::---,o::r-x,m::rwx"; - acl_t acl; - acl = acl_from_text(acl_text); - return acl; -} - -acl_t test_acl_default_create(void) -{ - char acl_text[] = - "u::rwx,u:user1:rwx,u:user2:rw-,u:user3:r--,u:user4:r-x,u:user5:---,g::r-x,m::rwx,o::r-x"; - acl_t acl; - acl = acl_from_text(acl_text); - return acl; -} - -static void report(testnum, expected, result, fail) -int testnum; /* test number */ -int expected; /* expected result */ -int result; /* actual result */ -int fail; /* fail or warning */ -{ - char *res; - if (expected == result) { - res = "[OK]"; - aclstat.ok++; - } else { - res = "[FAILED]"; - aclstat.failed++; - } - printf("\ttest #%d - Expected: %s - Obtained: %s - %s\n", testnum, - permtab[expected], permtab[result], res); - - fflush(stdout); -} - -/* - * set acl in order the file is only readable for the testuser - * - try to read - * - try to write - */ -static void test1(char *file) -{ - int result; - if (seteuid((uid_t) 601) == 0) { - result = do_file_op(file); - /* expected result = OP_READ || OP_WRITE || OP_EXEC */ - report(1, OP_READ + OP_WRITE + OP_EXEC, result); - seteuid((uid_t) 0); - setegid((gid_t) 0); - } -} - -/* - * set acl in order the file is only readable for the testgroup - * - try to read with test user - * - try to write with test user - * - */ - -static void test2(char *file) -{ - int result; - if (seteuid((uid_t) 602) == 0) { - result = do_file_op(file); - /* expected result = OP_READ || OP_WRITE */ - report(2, OP_READ + OP_WRITE, result); - seteuid((uid_t) 0); - } -} - -/* - * set acl in order the file is only readable for the testuser - * - try to read - * - try to write - */ - -static void test3(char *file) -{ - int result; - if (seteuid((uid_t) 603) == 0) { - result = do_file_op(file); - /* expected result = OP_READ */ - report(3, OP_READ, result); - seteuid((uid_t) 0); - } -} - -/* - * set read-write acl on the file for the testuser - * - try to read - * - try to write - */ - -static void test4(char *file) -{ - int result; - if (seteuid((uid_t) 604) == 0) { - result = do_file_op(file); - /* expected result = OP_READ || OP_EXEC */ - report(4, OP_READ + OP_EXEC, result); - seteuid((uid_t) 0); - } -} - -static void test5(char *file) -{ - int result; - if (seteuid((uid_t) 605) == 0) { - result = do_file_op(file); - /* expected result = 0x0 */ - report(5, 0x00, result); - seteuid((uid_t) 0); - } -} - -static void testgrp1(char *file) -{ - int result; - if (setegid((gid_t) 601) == 0) { - if (seteuid((uid_t) 601) == 0) { - result = do_file_op(file); - /* expected result = OP_READ || OP_WRITE || OP_EXEC */ - report(1, OP_READ + OP_WRITE + OP_EXEC, result); - seteuid((uid_t) 0); - setegid((gid_t) 0); - } - } -} - -/* - * set acl in order the file is only readable for the testgroup - * - try to read with test user - * - try to write with test user - * - */ - -static void testgrp2(char *file) -{ - int result; - if ((setegid((gid_t) 602) == 0) && (seteuid((uid_t) 602) == 0)) { - result = do_file_op(file); - /* expected result = OP_READ || OP_WRITE */ - report(2, OP_READ + OP_WRITE, result); - seteuid((uid_t) 0); - setegid((gid_t) 0); - } -} - -/* - * set acl in order the file is only readable for the testuser - * - try to read - * - try to write - */ - -static void testgrp3(char *file) -{ - int result; - if ((setegid((gid_t) 603) == 0) && (seteuid((uid_t) 603) == 0)) { - result = do_file_op(file); - /* expected result = OP_READ */ - report(3, OP_READ, result); - seteuid((uid_t) 0); - setegid((gid_t) 0); - } -} - -/* - * set read-write acl on the file for the testuser - * - try to read - * - try to write - */ - -static void testgrp4(char *file) -{ - int result; - if (setegid((gid_t) 604) == 0) { - if (seteuid((uid_t) 604) == 0) - result = do_file_op(file); - /* expected result = OP_READ || OP_EXEC */ - report(4, OP_READ + OP_EXEC, result); - seteuid((uid_t) 0); - setegid((gid_t) 0); - } -} - -static void testgrp5(char *file) -{ - int result; - if (setegid((gid_t) 605) == 0) { - if (seteuid((uid_t) 605) == 0) - result = do_file_op(file); - /* expected result = 0x0 */ - report(5, 0x00, result); - seteuid((uid_t) 0); - setegid((gid_t) 0); - } -} - -/* testing default acl */ -void test_acl_default(char *dir, acl_t acl) -{ - /* set default acl on directory */ - /* create a file in this directory */ - /* compare the file's acl and the parent directory's one */ - int res; - acl_t acl1, acl2; - - res = acl_set_file(dir, ACL_TYPE_DEFAULT, acl); - acl1 = acl_get_file(dir, ACL_TYPE_DEFAULT); - if (res == -1) - printf("path = %s **** errno = %d", dir, errno); - char *path = strcat(dir, "/testfile"); - fopen(path, "w+"); - char *cmd = malloc(256); - - strcpy(cmd, "chmod 7777 "); - printf(cmd, NULL); - strcat(cmd, dir); - system(cmd); - acl2 = acl_get_file(path, ACL_TYPE_ACCESS); - - test1(path); - test2(path); - test3(path); - test4(path); - test5(path); -} - -static void showstats(void) -{ - printf("\nACL TESTS RESULTS: %d passed, %d failed\n\n", aclstat.ok, - aclstat.failed); -} - -int main(int argc, char *argv[]) -{ - int result; - aclstat.ok = 0; - aclstat.failed = 0; - acl_t testacl; - printf("Test acl with entries on users\n"); - testacl = test_acl_user_create(); - - /* set the right acl for the test */ - result = acl_set_file(argv[1], ACL_TYPE_ACCESS, testacl); - if (result == -1) { - printf("setting acl on file %s failed\nBad NFS configuration", - argv[1]); - exit(1); - } - test1(argv[1]); - test2(argv[1]); - test3(argv[1]); - test4(argv[1]); - test5(argv[1]); - acl_free(testacl); - printf("\nTest of default acl:\n"); - - testacl = test_acl_default_create(); - test_acl_default(argv[2], testacl); - - printf("\nTest acl with entries concerning groups\n"); - testacl = test_acl_grp_create(); - result = acl_set_file(argv[1], ACL_TYPE_ACCESS, testacl); - if (result == -1) - printf("setting acl on file %s failed\n", argv[1]); - - testgrp1(argv[1]); - testgrp2(argv[1]); - testgrp3(argv[1]); - testgrp4(argv[1]); - testgrp5(argv[1]); - - acl_free(testacl); - - showstats(); - return 1; -} -#else -int main(void) -{ - printf("The acl library was missing upon compilation.\n"); - return TCONF; -} -#endif /* HAVE_LIBACL */ diff --git a/testcases/network/nfsv4/acl/cleangroups.py b/testcases/network/nfsv4/acl/cleangroups.py deleted file mode 100755 index 3c064783c..000000000 --- a/testcases/network/nfsv4/acl/cleangroups.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env python3 -from random_gen import * -from optparse import OptionParser -import subprocess -import os -import random - -test = RandomGen() -test.getGroupList() -test.cleanGroups() diff --git a/testcases/network/nfsv4/acl/cleanusers.py b/testcases/network/nfsv4/acl/cleanusers.py deleted file mode 100755 index 3e652c5b7..000000000 --- a/testcases/network/nfsv4/acl/cleanusers.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python3 -from random_gen import * -from optparse import OptionParser -import subprocess -import os -import random - -test = RandomGen() -test.getUserList() -test.getGroupList() -test.cleanUsers() -test.cleanGroups() diff --git a/testcases/network/nfsv4/acl/create_users.py b/testcases/network/nfsv4/acl/create_users.py deleted file mode 100755 index 3203aff8b..000000000 --- a/testcases/network/nfsv4/acl/create_users.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python3 -''' - Access Control Lists testing based on newpynfs framework - Aurelien Charbon - Bull SA -''' - -from random_gen import * -from optparse import OptionParser - -parser = OptionParser() -parser.add_option("-u", "--users", dest="nu",type="int",help="number of users to create") -parser.add_option("-g", "--group",dest="ng",type="int",help="number of groups to create") - -(options, args) = parser.parse_args() - -''' Measuring time to add an ACE to a list regarding the number of ACE already in the list''' -''' Doing the measurement on 100 files ''' -test=RandomGen() -test.createNGroup(options.ng) -test.getGroupList() -test.createNUser(options.nu) diff --git a/testcases/network/nfsv4/acl/random_gen.py b/testcases/network/nfsv4/acl/random_gen.py deleted file mode 100755 index 4b6ba9625..000000000 --- a/testcases/network/nfsv4/acl/random_gen.py +++ /dev/null @@ -1,251 +0,0 @@ -#!/usr/bin/env python3 -import subprocess -import random -import re - -alphabet = 'azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN123456789-_' -a_length = len(alphabet) - -""" ACL support attribute """ -ACL4_SUPPORT_ALLOW_ACL = 0x00000001 -ACL4_SUPPORT_DENY_ACL = 0x00000002 -ACL4_SUPPORT_AUDIT_ACL = 0x00000004 -ACL4_SUPPORT_ALARM_ACL = 0x00000008 - -class RandomGen(object): - - - """ List of ACE possible who fields """ - ace_who=["OWNER@","GROUP@","EVERYONE@","ANONYMOUS@","AUTHENTICATED@"] - - """ List of GID than can be used to do the tests """ - gList=[] - gListSize = len(gList) - uList = [] - uListSize = len(uList) - - fList=[] - fListSize = len(fList) - - """ Create a user in available groups to do the tests """ - def createUser(self,username): - group = self.gList[random.randint(0,len(self.gList)-1)][0] - opts = "-g" + group + " -p" + "1pilot" + " -m " + username - u = subprocess.getoutput('/usr/sbin/useradd '+ opts) - if u != "": - print("create user " + username + "failed" + u) - - def createFile(self,path,n): - for i in range(n): - fName = 'file' + str(i) - u = subprocess.getoutput('touch ' + path + '/'+ fName) - self.fList.append(fName) - - def createGroup(self, grpname, gid): - u = subprocess.getoutput('/usr/sbin/groupadd -g' + gid + " " + grpname) - if u != "": - print(u) - - def createNGroup(self, n): - for i in range(n): - gName = 'grp' + str(i) - gid = str(500+i) - self.createGroup(gName, gid) - - - """ Random creation of n user """ - def createNUser(self,n): - for i in range(n): - userName= "user" + str(i) - self.createUser(userName) - - """ clean all users created to do the tests """ - def cleanUsers(self): - for name in self.uList: - u = subprocess.getoutput('/usr/sbin/userdel -r '+ name) - self.uList = [] - - """ clean all users created to do the tests """ - def cleanGroups(self): - for name in self.gList: - u = subprocess.getoutput('/usr/sbin/groupdel '+ name[0]) - self.gList = [] - - """ Retrieve the list of user from /etc/passwd file """ - def getUserList(self): - f = open('/etc/passwd','r') - lines = f.readlines() - for line in lines: - splitedline = line.split(':') - userName = splitedline[0] - gid = splitedline[3] - # TO FIX: verify that the group is OK (in the right range) - NameOK = re.match("user",userName) - # We keep only usernames starting with "user" - if NameOK != None: - self.uList.append(userName) - f.close() - - def getFileList(self,path): - u = subprocess.getoutput('ls ' + path) - tmp = u.split('\n') - for i in range (len(tmp)-1): - NameOK = re.match("file",tmp[i]) - if NameOK != None: - self.fList.append(tmp[i]) - - def getNUserList(self,nb): - f = open('/etc/passwd','r') - lines = f.readlines() - n = 0 - for line in lines: - splitedline = line.split(':'); - userName = splitedline[0] - gid = splitedline[3] - # TO FIX: verify that the group is OK (in the right range) - NameOK = re.match("user",userName) - # We keep only usernames starting with "user" - if NameOK != None: - self.uList.append(userName) - n = n+1 - if n==nb: - break; - f.close() - - """ Get group list """ - def getGroupList(self): - f = open('/etc/group','r') - lines = f.readlines() - for line in lines: - splitedline = line.split(':'); - groupName = splitedline[0] - gid = splitedline[2] - NameOK = re.match("grp",groupName) - if NameOK != None: - self.gList.append([groupName,gid]) - f.close() - - """ Get a list of n group """ - def getNGroupList(self,nb): - f = open('/etc/group','r') - lines = f.readlines() - n = 0 - for line in lines: - splitedline = line.split(':'); - groupName = splitedline[0] - gid = splitedline[2] - NameOK = re.match("grp",groupName) - if NameOK != None: - self.gList.append([groupName,gid]) - n = n+1 - if n==nb: - break; - f.close() - - def printUserList(self): - print(self.uList) - - def printGroupList(self): - print(self.gList) - - """ Create a random name of random length """ - def createOneNameRandomLength(self,maxlength): - outputString ="" - l=random.randint(0,maxlength) - for i in range(l): - a = random.randint(0,a_length-1) - outputString =outputString + alphabet[a] - return outputString - - """ Create a random name of fixed length """ - def createOneName(self,lenght): - outputString ="" - for i in range(length): - a = random.randint(0,a_length-1) - outputString = outputString + alphabet[a] - return outputString - - """ Create Random User List with fixed length user names """ - def createRandomUserList(self,listlength,usernamelength): - userlist = [] - for i in range(listlength): - user = createOneName(lenght) - userlist.append(user) - return userlist - - """ Create Random ACE for a file and a given usr """ - def createRandomACE(self,user): - type = ace_type[random.randint(0,len(ace_type))] - flag = ace_flags[random.randint(0,len(ace_flags))] - mask = ace_mask[random.randint(0,len(ace_mask))] - who = ace_who[random.randint(0,len(ace_who))] - return nfsace4(type, flag, mask, who) - - """ Create Random ACL for a file with a fixed number a entries """ - def createRandomACL(self,acl_size): - acl = [] - userList = uList - userListSize = uListSize - for i in range(acl_size): - n = random.randint(0,userListSize-1) - usr = userList.pop(n) - newace = createRandomACE(usr) - acl.append(newace) - return acl - - """ Return a mode string like 'xwr' or 'x' """ - def createRandomMode(self): - out_str = "" - while (out_str == ""): - if random.randint(0,1) == 1: - out_str += 'x' - if random.randint(0,1) == 1: - out_str += 'w' - if random.randint(0,1) == 1: - out_str += 'r' - return out_str - - """ Create a random ACL operation (delete / remove / modify on user / group ) """ - def randomOp(self,path): - a = random.randint(1,4) - mode = self.createRandomMode() - file = self.fList[random.randint(0,len(self.fList)-1)] - if a == 1: # creation/modification - user = self.uList[random.randint(0,len(self.uList)-1)] - u = subprocess.getoutput('setfacl -m u:' + user + ':' + mode + " " + path + "/" + file) - - if a == 2: # with group - group = self.gList[random.randint(0,len(self.gList)-1)][0] - u = subprocess.getoutput('setfacl -m g:' + group + ':' + mode + " " + path + "/" + file) - - if a == 3: # deletation - user = self.uList[random.randint(0,len(self.uList)-1)] - u = subprocess.getoutput('setfacl -x u:' + user + " " + path + "/" + file) - - if a == 4: # with group - group = self.gList[random.randint(0,len(self.gList)-1)][0] - u = subprocess.getoutput('setfacl -x g:' + group + " " + path + "/" + file) - - # request on a unexisting group - '''if a == 5: - group = self.createOneNameRandomLength(16) - print 'setfacl -x g:' + group + " " + path + "/" + file - u = commands.getoutput('setfacl -x g:' + group + " " + path + "/" + file) - if a == 6: - user = self.createOneNameRandomLength(16) - u = commands.getoutput('setfacl -x u:' + user + " " + path + "/" + file) - - if a == 7: # creation/modification - user = self.createOneNameRandomLength(16) - u = commands.getoutput('setfacl -m u:' + user + ':' + mode + " " + path + "/" + file) - - if a == 8: # with group - group = self.createOneNameRandomLength(16) - u = commands.getoutput('setfacl -m g:' + group + ':' + mode + " " + path + "/" + file) - - if a == 9: #Copying the ACL of one file to another - file2 = self.fList[random.randint(0,len(self.fList)-1)] - u = commands.getoutput('getfacl ' + path + "/" + file + "| setfacl --set-file=- " + path + "/" + file2) - if u!="": - print u''' - diff --git a/testcases/network/nfsv4/acl/runtest b/testcases/network/nfsv4/acl/runtest deleted file mode 100755 index a859e85bc..000000000 --- a/testcases/network/nfsv4/acl/runtest +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/sh -# -# @(#)runtests -# -# runtests script for ACL testing -REMOTEHOST=nfsserver -MAXLENGTH=30 # maximum ACL length - NB: the current NFSv4 acl implementation does not allow ACL greater than one page (about 35 entries with 6 character user name length and 10 character domain name) -NFSMNTDIR=/mnt/nfs-acl -echo "Test on NFS server $REMOTEHOST" -ACLTESTDIR=testdir -ACLTESTFILE=testfile - -USER_NB=20 # total number of users to create -GRP_NB=20 # total number of groups to create -FILE_NB=10 # total number of files for the test - -# creation of users on the local machine -for i in 1 2 3 4 5 -do - groupadd -g 60$i grp$i - useradd -u 60$i user$i -done - -# creation of users on the remote machine (removed only at the end of the tests) -rsh -n $REMOTEHOST python3 $PWD/create_users.py -u 50 -g 50 - -echo "Starting ACL testing" - -echo "Starting BASIC tests" - -echo "Creating testing file and directory" -touch $NFSMNTDIR/$ACLTESTFILE -mkdir $NFSMNTDIR/$ACLTESTDIR -if test ! -d $NFSMNTDIR/$ACLTESTDIR -then - echo "Can't make directory $ACLTESTDIR" - exit 1 -fi - -# File and Directory tree creation test -echo "Execute acl1 $NFSMNTDIR/$ACLTESTFILE $NFSMNTDIR/$ACLTESTDIR" -./acl1 $NFSMNTDIR/$ACLTESTFILE $NFSMNTDIR/$ACLTESTDIR -#./stress $ACLTESTFILE -for i in 1 2 3 4 5 - do - userdel user$i - groupdel grp$i - done - -echo "Basic tests finished" - -echo "LONG ACL TEST" -echo "creating necessary users and groups" -python3 create_users.py -u 50 -g 50 -echo "creating necessary users and groups on the remote host" -mkdir $NFSMNTDIR/lacl-testdir -python3 test_long_acl.py -l $MAXLENGTH -p $NFSMNTDIR/lacl-testdir -rm -rf $NFSMNTDIR/lacl-testdir -echo "Long ACL test OK with $MAXLENGTH entries" -echo "ACL STRESSING TEST" -python3 setacl_stress.py -n 100 -u $USER_NB -g $GRP_NB -f $FILE_NB -p $NFSMNTDIR - -# remove local an remote users -python3 cleanusers.py -python3 cleangroups.py -rsh -n $REMOTEHOST python3 $PWD/cleanusers.py - -echo "Test OK" - -exit 0 diff --git a/testcases/network/nfsv4/acl/setacl_stress.py b/testcases/network/nfsv4/acl/setacl_stress.py deleted file mode 100755 index c93ac8bc0..000000000 --- a/testcases/network/nfsv4/acl/setacl_stress.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python3 -''' - Access Control Lists stressing script - To lauch on the first client - Aurelien Charbon - Bull SA -''' - -from random_gen import * -from optparse import OptionParser -import subprocess -import os -import random - -alphabet='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789_-()' -t_alphabet=len(alphabet) - -test = RandomGen() - -parser = OptionParser() -parser.set_defaults(nbfiles=5,nbusers=5,nbgroups=5,nloop=100 ) -parser.add_option("-n","--nloop", dest="nloop",type="int", help="number of loop to do in the test") -parser.add_option("-p", "--path", dest="path",help="path on which the test is executed") -parser.add_option("-f", "--nbfiles", dest="nbfiles",type="int",help="nb of files to do the test (default=5)") -parser.add_option("-u", "--nbusers", dest="nbusers",type="int",help="nb of users (default=5)") -parser.add_option("-g", "--nbgrp", dest="nbgroups",type="int",help="nb of groups (default=5)") -(options, args) = parser.parse_args() - -test.createFile(options.path,options.nbfiles) -test.getNUserList(options.nbusers) -test.getNGroupList(options.nbgroups) -for i in range (options.nloop): - test.randomOp(options.path) diff --git a/testcases/network/nfsv4/acl/test_acl.py b/testcases/network/nfsv4/acl/test_acl.py deleted file mode 100755 index 8699b0206..000000000 --- a/testcases/network/nfsv4/acl/test_acl.py +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/env python3 -''' - Access Control Lists testing based on newpynfs framework - Aurelien Charbon - Bull SA -''' -from random_gen import * -import subprocess -import os -import threading -import time -import random - -alphabet='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789_-() ~' -t_alphabet=len(alphabet) - -def test_acl_default(path): - -# set default acl on the test directory - u = subprocess.getoutput('mkdir ' + path + "/" + testdir) - u = subprocess.getoutput('getfacl ' + path + "/" + testdir) - acl=[] - for i in range (len(splitedresult)-1): - splitedline = splitedresult[i].split('::') - name = splitedline[0] - entry = splitedline[1] - acl.append(name,entry) -# create a file in this directory - u = subprocess.getoutput('touch ' + path + "/" + testdir + testfile) -# get the file's ACL and verify - u = subprocess.getoutput('getfacl ' + path + "/" + testdir + testfile) - splitedresult = u.split('\n') - acl2=[] - for i in range (len(splitedresult)-1): - splitedline = splitedresult[i].split('::') - name = splitedline[0] - entry = splitedline[1] - acl2.append(name,entry) - - result_final = True - while i < len(acl2): - result = False - while j < len(acl2) and result == False: - if acl2[i] == acl[j]: - result = True - if result == False: - result_final = False - -''' Measuring time to add an ACE to a list regarding the number of ACE already in the list''' -''' Doing the measurement on 100 files ''' -def test_acl_long(): - path = '/mnt/nfs/test-acl' - test = RandomGen() - test.createFile(path,100) - test.getUserList() - t0=time.time() - for test_file in test.fList: - for user in test.uList: - mode = test.createRandomMode() - u = subprocess.getoutput('setfacl -m u:' + user + ':' + mode + " " + path + "/" + test_file) - t1=time.time() - print(t1-t0) - -def test_nfs_acl(): - print("test acl 10000\n") - test = RandomGen() - f = open('/tmp/acl-result-10000','w') - path = '/mnt/nfs/test-acl' - for i in range(10000): - print("test avec " + str(i) + " ACE") - test.getUserList() - testfile = 'testfile' + str(i) - u = subprocess.getoutput('touch ' + path + "/" + testfile) - t0=time.time() - for j in range(i): - user = test.uList.pop() - mode = test.createRandomMode() - u = subprocess.getoutput('setfacl -m u:' + user + ':' + mode + " " + path + "/" + testfile) - t1=time.time() - f.write(str(i) + "\t" + str(t1-t0)+"\n") - f.close() - - -def test_nfs_getfacl(): - # mesures sur le getfacl - test = RandomGen() - - path = '/mnt/nfs/test-acl' # NFS mounted directory - u = subprocess.getoutput('rm ' + path + "/*") # clean directory - print("test acl getfacl\n") - f = open('/tmp/acl-result-getfacl','w') - for i in range(37): - - test.getUserList() - testfile = 'testfile' + str(i) - - u = subprocess.getoutput('touch ' + path + "/" + testfile) - print("setfacl " + str(i) + " " + u) - for j in range(i): - user = test.uList.pop() - mode = test.createRandomMode() - u = subprocess.getoutput('setfacl -m u:' + user + ':' + mode + " " + path + "/" + testfile) - - t1=time.time() - u = subprocess.getoutput('getfacl ' + path + "/" + testfile) - print("getfacl - " + str(i) + u + "\n") - t2=time.time() - f.write(str(i) + "\t" + str(t2-t1)+"\n") - f.close() - - -def main(): - # test getFileList - path = '/mnt/nfs/test-acl' - test = RandomGen() - test.getFileList(path) - print(test.fList) -main() - - - - - diff --git a/testcases/network/nfsv4/acl/test_long_acl.py b/testcases/network/nfsv4/acl/test_long_acl.py deleted file mode 100755 index 893855b42..000000000 --- a/testcases/network/nfsv4/acl/test_long_acl.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python3 -''' - Access Control Lists testing based on newpynfs framework - Aurelien Charbon - Bull SA -''' -from random_gen import * -from optparse import OptionParser -import subprocess -import os -import threading -import time -import random - -alphabet='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789_-() ~' -t_alphabet=len(alphabet) - - - -def test_longacl(l,path): - # mesures sur le getfacl - test = RandomGen() - - u = subprocess.getoutput('rm ' + path + "/*") # clean directory - print("test acl getfacl\n") - for i in range(l): - test.getUserList() - testfile = 'testfile' + str(i) - u = subprocess.getoutput('touch ' + path + "/" + testfile) - print("setfacl with " + str(i) + " entries\n " + u) - for j in range(i): - user = test.uList.pop() - mode = test.createRandomMode() - u = subprocess.getoutput('setfacl -m u:' + user + ':' + mode + " " + path + "/" + testfile) - if u != "": - print("setfacl -m u:" + user + ':' + mode + " " + path + "/" + testfile) - print(u) -def main(): - parser = OptionParser() - parser.add_option("-l", "--length", dest="length",type="int",help="max lentgh of ACL") - parser.add_option("-p", "--path", dest="path",help="path of test file") - (options, args) = parser.parse_args() - test_longacl(options.length,options.path) -main() - diff --git a/testcases/network/nfsv4/locks/Makefile b/testcases/network/nfsv4/locks/Makefile deleted file mode 100644 index 5812dea3a..000000000 --- a/testcases/network/nfsv4/locks/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# -# network/nfsv4/locks testcases Makefile. -# -# Copyright (C) 2009, Cisco Systems Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Ngie Cooper, July 2009 -# - -top_srcdir ?= ../../../.. - -include $(top_srcdir)/include/mk/testcases.mk - -MAKE_TARGETS := locktests - -LDLIBS += -lpthread - -$(MAKE_TARGETS): $(patsubst $(abs_srcdir)/%.c,%.o,$(wildcard $(abs_srcdir)/*.c)) - -include $(top_srcdir)/include/mk/generic_leaf_target.mk diff --git a/testcases/network/nfsv4/locks/README b/testcases/network/nfsv4/locks/README deleted file mode 100644 index cf044a45c..000000000 --- a/testcases/network/nfsv4/locks/README +++ /dev/null @@ -1,169 +0,0 @@ -COMPILE : make -RUN LOCAL: ./locktests -n -f [-T] - - -GOAL : This test is aimed at stressing the fcntl locking functions. -A master process sets a lock on a file region (byte range locking). -Several slave processes try to perform operations on this region, such -as: read, write, set a new lock ... -The expected results of these operations are known. -If the operation's result is the same as the expected one, the test -succeeds, otherwise it fails. - - -HISTORY : This program was been written to stress NFSv4 locks. - -Slaves are concurrent processes or threads. --n : Number of threads to use (mandatory). --f : Run the test on a test file defined by the -f option (mandatory). --T : Use threads instead of processes (optional). - - - -* RUN NETWORK * - -Test server: -./locktests -n -f -c - -Test clients: -./locktests --server - - -Multiple clients options -_______________________ - -These options have been developed to test NFSv4 locking when multiple -clients try to use the same file. It uses a test server and several test -clients. - - -------------- - | | - | NFS SERVER | - | | - -------------- - | - | - ----------------------------------------------- - | | | - | | | - ------------------ ------------------- ------------------ - | NFS Client 1 | | NFS Client 1 | | NFS Client 1 | - | running | | running | | running | - | a CLIENT TEST | | the SERVER TEST | | a CLIENT TEST | - ------------------ ------------------- ------------------ - -See the DEPLOY file to know how to configure client test on each client. - -Server options are: - --n : Number of threads to use (mandatory). --f : Run the test on given test file defined by the -f option (mandatory). --c : Number of clients to connect before starting the tests. - - -Client options -______________ ---server - - -* EXAMPLES * -============ - -Local testing: -./locktests -n 50 -f /file/system/to/test - -Multiple clients: --on the test server (called host1): - ./locktest -n 50 -f /network/file/system/to/test -c 3 - (Server waiting for 3 clients to be connected) - --test clients: - ./locktest --server host1 - - -HOW TO UNDERSTAND TEST RESULTS -============================== -Ten tests are performed: - 1. WRITE ON A READ LOCK - 2. WRITE ON A WRITE LOCK - 3. READ ON A READ LOCK - 4. READ ON A WRITE LOCK - 5. SET A READ LOCK ON A READ LOCK - 6. SET A WRITE LOCK ON A WRITE LOCK - 7. SET A WRITE LOCK ON A READ LOCK - 8. SET A READ LOCK ON A WRITE LOCK - 9. READ LOCK THE WHOLE FILE BYTE BY BYTE - 10. WRITE LOCK THE WHOLE FILE BYTE BY BYTE - - -For each test, the MASTER process takes a lock (READ/WRITE LOCK) and -the SLAVE processes try to perform the following operations on the -locked section: - - - WRITE - - READ - - SET A WRITE LOCK - - SET A WRITE LOCK - -If a slave process performs its test operation without error it prints -"=", otherwise it prints "x". - -An operation performed "without error" means: - - - The operation (write, read, fcntl ...) returns no error code, and - - errno is not changed. - -However, "the slave performs its test operation without error" does NOT -mean the "result is correct". For example, a slave process is NOT -allowed to set a READ LOCK on an already-set WRITE LOCK. When such -operations are performed, the correct and expected result is that the -tested function returns the EAGAIN error code. - -When all tests have been processed, the result of each process for each -test is compared with the table of expected results, and a new table is -displayed: - -For example: - 200 processes of 200 successfully ran test : READ ON A READ LOCK - 200 processes of 200 successfully ran test : SET A READ LOCK ON A WRITE LOCK - -This result lists the process/thread both on local and remote machines. - -Note that the testing locks with thread on multiple clients is disabled -because it does not make sense: 2 different clients obviously run at -least 2 different processes (thread information cannot be shared -between this thread over the network). - -EXPECTED RESULTS -================ -Here is the table of expected results, depending on : - - Slave test operations (READ, WRITE, SET A WRITE LOCK ... ) - - Master Operation (SET A READ/A WRITE LOCK ) - - Slave types (Processes, threads) - - Locking profile (POSIX locking, Mandatory locking) - - -================================================================================================ - | Master process/thread | -===================================|===========================================================| -Slave type | Test operation | advisory locking | mandatory locking | -___________________________________|______________________________|____________________________| - | | read lock write lock | read lock write lock | -___________________________________|______________________________|____________________________| -thread | set a read lock | Allowed Allowed | Allowed Allowed | - | set a write lock | Allowed Allowed | Allowed Allowed | - | read | Allowed Allowed | Allowed Allowed | - | write | Allowed Allowed | Allowed Allowed | -===================================+==============================+============================| -process | set a read lock | Allowed Denied | Allowed Denied | - | set a write lock | Denied Denied | Denied Denied | - | read | Allowed Allowed | Denied Allowed | - | write | Allowed Allowed | Denied Denied | -================================================================================================ - - -************** -Bull SA - 2006 - http://nfsv4.bullopensource.org -Tony Reix: tony.reix@bull.net -Aurélien Charbon: aurelien.charbon@ext bull.net -************** diff --git a/testcases/network/nfsv4/locks/VERSION b/testcases/network/nfsv4/locks/VERSION deleted file mode 100644 index aead93e4f..000000000 --- a/testcases/network/nfsv4/locks/VERSION +++ /dev/null @@ -1,3 +0,0 @@ -* 08/02/06 copyediting (bryce) -* 03/01/06 remove unicode and translate comments in english. -* 21/12/05 free alocated memory before exiting diff --git a/testcases/network/nfsv4/locks/deploy/locktests.tar.gz b/testcases/network/nfsv4/locks/deploy/locktests.tar.gz deleted file mode 100644 index 1e0b517f2bbad3318e8036f494cfa547cd4fda89..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12354 zcmZ9wV{j(Gwx}K3HYT=hPHfw@?c|MZ+t$RkZQGn!cdE{}&$sWbdTP~jul}>TstKc@ zfJBo*MSwuBePLbDR#WzpENt3~us$OMBIK1Q*byxveU1)32*xXq1|Ge0OOq4Zm}F9Cwtp! zeF&}S2L?9R-M7k5l^q>qhQ_0ke3YuYFE^dHJs010Wncc2gh}z+W1uxE-~VE8S%Oh4#ijRr4oy`x(FM^ z!|`M<$Ay3g8=bWUrJhercH=jWKR^p0OG%|~({wSSmR+1z8r%9FZ-2^^qPo*;BgIqN zFMm}e2fgQ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Qkeb=m1ZaU;X!-6jQNw8q1KAfLw-z?sJ`{E5mkn=)}nr z741ly#=Kmi1d@ftn$$tMR0Z5_8X9z!ixzQLW0SY0w|U#Y&*>fo|F&LVO>-z} z($ZU>r9VSigb~L8t%-^F@kzHXaMgr*n(ZMbEE-_RCAm?DD(@ k_RWOHjyab)r`)UUGp@DH|D|s0r+@sMSM5dsVF3gEA8-;l(f|Me diff --git a/testcases/network/nfsv4/locks/deploy_info b/testcases/network/nfsv4/locks/deploy_info deleted file mode 100644 index b8a4660f2..000000000 --- a/testcases/network/nfsv4/locks/deploy_info +++ /dev/null @@ -1,37 +0,0 @@ -locktest.py script aims to help deploying and running locktests over multiple NFS -clients accessing the same server. - -The source code of NFS client test is in ./deploy/locktests.tar.gz - -Setting up lock test with several test machines. -================================================ -./locktests.py --setup -c [machine2 ...] -s : - ---setup : Option to setup the test --c [...] : Setup test on these clients --s : : NFS server to use, followed by full directory to mount - - -Example: -./locktests.py --setup -c client1 client2 client3 -s NFS_Server:/exported/directory - - -Running lock test over several test machines. -============================================= -Run test on already configured test machines. -./locktests.py -n -f -c [machine2 ...] - --n : Process number each test machine will lauch to perform the test --f : Test file. That must be the same on each machine --c [...] : Clients. run tests from this clients - - -Example: -./locktests.py -n 50 -f /mnt/nfsv4/testfile -c testmachine1 testmachine2 - - - -_________________________________ - Vincent ROQUETA - Bull SA - 2005 - vincent.roqueta@ext.bull.net - diff --git a/testcases/network/nfsv4/locks/locktests.c b/testcases/network/nfsv4/locks/locktests.c deleted file mode 100644 index 961354e42..000000000 --- a/testcases/network/nfsv4/locks/locktests.c +++ /dev/null @@ -1,1034 +0,0 @@ -/* ************************************************* - * *********** README ****************************** - * ************************************************* - * - * COMPILE : make - * RUN : ./locktests -n -f [-P] - * - * GOAL : This test tries to stress the fcntl locking functions. A - * master process sets a lock on a file region (this is called "byte - * range locking"). Some slave processes try to perform operations on - * this region, such as read, write, set a new lock ... The expected - * results of these operations are known. If the operation result is - * the same as the expected one, the test suceeds, else it fails. - * - * - * - * Slaves are concurent processes or thread. - * -n : Number of threads to use (mandatory). - * -f : Run the test on given test file defined by the -f option (mandatory). - * -c : Number of clients to connect before starting the tests. - * - * HISTORY : This program was written to stress NFSv4 locks. - * EXAMPLE : ./locktests -n 50 -f /file/system/to/test - * - * - * Vincent ROQUETA 2005 - vincent.roqueta@ext.bull.net - * BULL S.A. - */ - -#include "locktests.h" - -int MAXLEN = 64; -int MAXTEST = 10; -extern int maxClients; -extern int fdServer; - -char message[M_SIZE]; -int slaveReader; -int masterReader; -int slaveWriter; - -/* Which lock will be applied by the master process on test startup */ -int LIST_LOCKS[] = { READLOCK, WRITELOCK, - READLOCK, WRITELOCK, - READLOCK, WRITELOCK, - READLOCK, WRITELOCK, - BYTELOCK_READ, BYTELOCK_WRITE -}; - -/* The operations the slave processes will try to perform */ -int LIST_TESTS[] = { WRONLY, WRONLY, - RDONLY, RDONLY, - READLOCK, WRITELOCK, - WRITELOCK, READLOCK, - BYTELOCK_READ, BYTELOCK_WRITE -}; - -/* List of test names */ -char *LIST_NAMES_TESTS[] = { "WRITE ON A READ LOCK", - "WRITE ON A WRITE LOCK", - "READ ON A READ LOCK", - "READ ON A WRITE LOCK", - "SET A READ LOCK ON A READ LOCK", - "SET A WRITE LOCK ON A WRITE LOCK", - "SET A WRITE LOCK ON A READ LOCK", - "SET A READ LOCK ON A WRITE LOCK", - "READ LOCK THE WHOLE FILE BYTE BY BYTE", - "WRITE LOCK THE WHOLE FILE BYTE BY BYTE" -}; - -/* List of expected test results, when slaves are processes */ -int LIST_RESULTS_PROCESS[] = { SUCCES, SUCCES, - SUCCES, SUCCES, - SUCCES, ECHEC, - ECHEC, ECHEC, - SUCCES, SUCCES -}; - -/* List of expected test results, when slaves are threads */ -int LIST_RESULTS_THREADS[] = { SUCCES, SUCCES, - SUCCES, SUCCES, - SUCCES, SUCCES, - SUCCES, SUCCES, - ECHEC, ECHEC -}; - -int *LIST_RESULTS = NULL; -char *eType = NULL; - -int TOTAL_RESULT_OK[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -void *slave(void *data); -int (*finish) (int a); - -int finishProcess(int a) -{ - exit(a); -} - -int (*load) (void); - -struct dataPub dp; - -/* Functions to access tests/tests names/tests results*/ -int testSuiv(int n) -{ - return LIST_TESTS[n]; -} - -int resAttSuiv(int n) -{ - return LIST_RESULTS[n]; -} - -char *nomTestSuiv(int n) -{ - return LIST_NAMES_TESTS[n]; -} - -int lockSuiv(int n) -{ - return LIST_LOCKS[n]; -} - -/* Verify the test result is the expected one */ -int matchResult(int r, int n) -{ - - P("r=%d\n", r); - if (r == LIST_RESULTS[n]) - return 1; - else - return 0; -} - -/* Increments the number of process which have successfully passed the test */ -void counter(int r, int n) -{ - TOTAL_RESULT_OK[n] += matchResult(r, n); -} - -/* Special case for test 'lock file byte byte by byte'. - * We ensure each byte is correctly locked. - */ -void validationResults(int n) -{ - int i, u, l, fsize; - struct flock request; - - fsize = dp.nclnt * (maxClients + 1); - TOTAL_RESULT_OK[n] = 0; - l = FALSE; - u = TRUE; - - /* If the expected operation result is a success, we will have to increase the number of correct results */ - if (LIST_RESULTS[n]) { - l = TRUE; - u = FALSE; - } - - for (i = 0; i < fsize; i++) { - request.l_type = F_WRLCK; - request.l_whence = SEEK_SET; - request.l_start = i; - request.l_len = 1; - fcntl(dp.fd, F_GETLK, &request); - /* Ensure the lock is correctly set */ - if (request.l_type != F_UNLCK) - TOTAL_RESULT_OK[n] += l; - else - TOTAL_RESULT_OK[n] += u; - } -} - -int initTest(void) -{ - - P("Master opens %s\n", dp.fname); - dp.fd = open(dp.fname, OPENFLAGS, MANDMODES); - if (dp.fd < 0) { - perror("lock test : can't open test file :"); - finish(1); - } - P("fd=%d\n", dp.fd); - return 0; -} - -struct dataChild *initClientFork(int i) -{ - struct dataPriv *dpr; - struct dataChild *df; - - /* Initialize private data fields */ - dpr = malloc(sizeof(struct dataPriv)); - df = malloc(sizeof(struct dataChild)); - dpr->whoami = i; - df->dp = &dp; - df->dpr = dpr; - /* Initialize master to client pipe */ - dp.lclnt[i] = malloc(sizeof(int) * 2); - if (pipe(dp.lclnt[i]) < 0) { - perror("Impossible to create pipe\n"); - exit(1); - } - P("Initialization %d\n", i); - write(0, ".", 1); - return df; -} - -int initialize(int clnt) -{ - - /* Initialize private data fields */ - printf("Init\n"); - dp.nclnt = clnt; - dp.lclnt = malloc(sizeof(int *) * clnt); - dp.lthreads = malloc(sizeof(pthread_t) * clnt); - - /* Initialize client to master pipe */ - if (pipe(dp.master) < 0) { - perror("Master pipe creation error\n"); - exit(1); - } - printf("%s initialization\n", eType); - load(); - initTest(); - - return 0; -} - -void cleanClient(struct dataChild *df) -{ - int i; - i = df->dpr->whoami; - free(dp.lclnt[i]); - free(df->dpr); - free(df); -} - -void clean(void) -{ - free(dp.lthreads); - free(dp.lclnt); -} - -int loadProcess(void) -{ - int i; - struct dataChild *df; - for (i = 0; i < dp.nclnt; i++) { - df = initClientFork(i); - if (!fork()) { - P("Running slave num: %d\n", df->dpr->whoami); - write(0, ".", 1); - slave((void *)df); - cleanClient(df); - exit(0); - } - } - return 0; -} - -void lockWholeFile(struct flock *request) -{ - request->l_whence = SEEK_SET; - request->l_start = 0; - /* Lock the whole file */ - request->l_len = 0; -} - -void selectTest(int n, struct s_test *test) -{ - - test->test = testSuiv(n); - test->resAtt = resAttSuiv(n); - test->nom = nomTestSuiv(n); - test->type = lockSuiv(n); -} - -/* Final test report */ -int report(int clnt) -{ - int rc = 0; - int i; - int totalClients; - totalClients = clnt * (maxClients + 1); - printf - ("\n%s number : %d - Remote clients: %d local client 1 - Total client %d - Total concurent tests: %d\n", - eType, clnt, maxClients, maxClients + 1, totalClients); - printf("%s number running test successfully :\n", eType); - for (i = 0; i < MAXTEST; i++) { - if (TOTAL_RESULT_OK[i] != totalClients) - rc = 1; - - printf("%d %s of %d successfully ran test : %s\n", - TOTAL_RESULT_OK[i], eType, totalClients, - LIST_NAMES_TESTS[i]); - } - return rc; -} - -int serverSendLocal(void) -{ - int i; - /* Synchronize slave processes */ - /* Configure slaves for test */ - - for (i = 0; i < dp.nclnt; i++) - write(dp.lclnt[i][1], message, M_SIZE); - return 0; - -} - -void serverSendNet(void) -{ - writeToAllClients(message); -} - -int serverReceiveNet(void) -{ - int i, c; - for (c = 0; c < maxClients; c++) { - for (i = 0; i < dp.nclnt; i++) { - serverReceiveClient(c); - } - } - return 0; -} - -int serverReceiveLocal(void) -{ - int i; - for (i = 0; i < dp.nclnt; i++) - read(masterReader, message, M_SIZE); - return 0; -} - -int clientReceiveLocal(void) -{ - read(slaveReader, message, M_SIZE); - return 0; -} - -int clientSend(void) -{ - write(slaveWriter, message, M_SIZE); - return 0; -} - -int serverSend(void) -{ - serverSendNet(); - serverSendLocal(); - return 0; -} - -int serverReceive(void) -{ - serverReceiveNet(); - serverReceiveLocal(); - return 0; -} - -/* binary structure <-> ASCII functions used to ensure data will be correctly used over - * the network, especially when multiples clients do not use the same hardware architecture. - */ -int serializeTLock(struct s_test *tLock) -{ - memset(message, 0, M_SIZE); - sprintf(message, "T:%d:%d:%d::", tLock->test, tLock->type, - tLock->resAtt); - return 0; -} - -void unSerializeTLock(struct s_test *tLock) -{ - sscanf(message, "T:%d:%d:%d::", &(tLock->test), &(tLock->type), - &(tLock->resAtt)); - memset(message, 0, M_SIZE); - -} - -void serializeFLock(struct flock *request) -{ - int len, pid, start; - memset(message, 0, M_SIZE); - len = (int)request->l_len; - pid = (int)request->l_pid; - start = (int)request->l_start; - /* Beware to length of integer conversions ... */ - sprintf(message, "L:%hd:%hd:%d:%d:%d::", - request->l_type, request->l_whence, start, len, pid); -} - -void serializeResult(int result) -{ - memset(message, 0, M_SIZE); - sprintf(message, "R:%d::", result); - -} - -void unSerializeResult(int *result) -{ - sscanf(message, "R:%d::", result); -} - -void unSerializeFLock(struct flock *request) -{ - int len, pid, start; - sscanf(message, "L:%hd:%hd:%d:%d:%d::", - &(request->l_type), &(request->l_whence), &start, &len, &pid); - request->l_start = (off_t) start; - request->l_len = (off_t) len; - request->l_pid = (pid_t) pid; -} - -int serverSendLockClient(struct flock *request, int client) -{ - serializeFLock(request); - return serverSendClient(client); -} - -int serverSendLockLocal(struct flock *request, int slave) -{ - serializeFLock(request); - return write(dp.lclnt[slave][1], message, M_SIZE); -} - -int getLockSection(struct flock *request) -{ - memset(message, 0, M_SIZE); - clientReceiveLocal(); - unSerializeFLock(request); - return 0; -} - -int sendLockTest(struct s_test *tLock) -{ - serializeTLock(tLock); - serverSend(); - return 0; -} - -int getLockTest(struct s_test *tLock) -{ - clientReceiveLocal(); - unSerializeTLock(tLock); - return 0; -} - -int sendResult(int result) -{ - serializeResult(result); - clientSend(); - return 0; -} - -int getResults(int ntest) -{ - int i, c; - int result = 0; - /* Add remote test results */ - for (c = 0; c < maxClients; c++) { - for (i = 0; i < dp.nclnt; i++) { - serverReceiveClient(c); - unSerializeResult(&result); - counter(result, ntest); - - } - } - /* Add local test results */ - for (i = 0; i < dp.nclnt; i++) { - read(masterReader, message, M_SIZE); - unSerializeResult(&result); - counter(result, ntest); - } - - return 0; -} - -#ifdef DEBUG -#define P(a,b) memset(dbg,0,16);sprintf(dbg,a,b);write(0,dbg,16); -#endif - -/* In the case of a network use, the master of the client application si only - * a 'repeater' of information. It resends server-master instructions to its own slaves. - */ -void masterClient(void) -{ - fd_set fdread; - struct timeval tv; - int n, i, r, m, start; -#ifdef DEBUG - char dbg[16]; -#endif - struct flock lock; - int t; - - masterReader = dp.master[0]; - FD_ZERO(&fdread); - tv.tv_sec = 50; - tv.tv_usec = 0; - n = fdServer > masterReader ? fdServer : masterReader; - printf("Master Client - fdServer=%d\n", fdServer); - while (1) { - /* Add slave and server pipe file descriptors */ - FD_ZERO(&fdread); - FD_SET(fdServer, &fdread); - FD_SET(masterReader, &fdread); - r = select(n + 1, &fdread, NULL, NULL, &tv); - if (r < 0) { - perror("select:\n"); - continue; - } - if (r == 0) { - exit(0); - } - - if (FD_ISSET(fdServer, &fdread)) { - /* We just have received information from the server. - * We repeat it to slaves. - */ - i = readFromServer(message); - t = message[0]; - switch (t) { - case 'L': - /* Lock instruction. We need to send a different section to lock to each process */ - unSerializeFLock(&lock); - start = lock.l_start; - for (i = 0; i < dp.nclnt; i++) { - lock.l_start = start + i; - serializeFLock(&lock); - write(dp.lclnt[i][1], message, M_SIZE); - } - printf("\n"); - continue; - case 'T': - /* Test instruction. Ensure server is not sending the END(ish) instruction to end tests */ - /* To be rewritten asap */ - m = atoi(&(message[2])); - if (m == END) - break; - if (m == CLEAN) - printf("\n"); - - serverSendLocal(); - continue; - } - break; - } else { - /* Else, we read information from slaves and repeat them to the server */ - for (i = 0; i < dp.nclnt; i++) { - r = read(masterReader, message, M_SIZE); - r = write(fdServer, message, M_SIZE); - if (r < 0) - perror("write : "); - - } - continue; - } - } - - /* Receive the END(ish) instruction */ - - /* Repeat it to the slaves */ - printf("Exitting...\n"); - serverSendLocal(); - - /* Ok, we can quit */ - printf("Bye :)\n"); - -} - -int master(void) -{ - int i, n, bl; - int clnt; - char tmp[MAXLEN], *buf; -#ifdef DEBUG - char dbg[16]; -#endif - struct flock request; - struct s_test tLock; - enum state_t state; - int offset; - /* A test sentence written in the file */ - char phraseTest[] = - "Ceci est une phrase test ecrite par le maitre dans le fichier"; - bl = -1; - clnt = dp.nclnt; - masterReader = dp.master[0]; - state = SELECT; - /* Start with the first test ;) */ - n = 0; - printf("\n--------------------------------------\n"); - while (1) { - switch (state) { - case SELECT: - /* Select the test to perform */ - printf("\n"); - E("Master: SELECT"); - selectTest(n, &tLock); - state = tLock.type; - bl = 0; - if (n < MAXTEST) { - memset(tmp, 0, MAXLEN); - sprintf(tmp, "TEST : TRY TO %s:", - LIST_NAMES_TESTS[n]); - write(0, tmp, strlen(tmp)); - } else - state = END; - P("state=%d\n", state); - n += 1; - continue; - - case RDONLY: - case WRONLY: - - case READLOCK: - P("Read lock :%d\n", state); - request.l_type = F_RDLCK; - state = LOCK; - continue; - - case WRITELOCK: - P("Write lock :%d\n", state); - request.l_type = F_WRLCK; - state = LOCK; - continue; - - case LOCK: - /* Apply the wanted lock */ - E("Master: LOCK"); - write(dp.fd, phraseTest, strlen(phraseTest)); - lockWholeFile(&request); - if (fcntl(dp.fd, F_SETLK, &request) < 0) { - perror("Master: can't set lock\n"); - perror("Echec\n"); - exit(0); - } - E("Master"); - state = SYNC; - continue; - - case BYTELOCK_READ: - bl = 1; - request.l_type = F_RDLCK; - state = SYNC; - continue; - - case BYTELOCK_WRITE: - bl = 1; - request.l_type = F_WRLCK; - state = SYNC; - continue; - - case BYTELOCK: - /* The main idea is to lock all the bytes in a file. Each slave process locks one byte. - * - * We need : - * - To create a file of a length equal to the total number of slave processes - * - send the exact section to lock to each slave - * - ensure locks have been correctly set - */ - - /* Create a string to record in the test file. Length is exactly the number of sub process */ - P("Master: BYTELOCK: %d\n", state); - buf = malloc(clnt * (maxClients + 1)); - memset(buf, '*', clnt); - write(dp.fd, buf, clnt); - free(buf); - - /* Each slave process re-writes its own field to lock */ - request.l_whence = SEEK_SET; - request.l_start = 0; - request.l_len = 1; - - /* Start to send sections to lock to remote process (network clients) */ - for (i = 0; i < maxClients; i++) { - /* Set the correct byte to lock */ - offset = (i + 1) * clnt; - request.l_start = (off_t) offset; - serverSendLockClient(&request, i); - } - - /* Now send sections to local processes */ - for (i = 0; i < clnt; i++) { - request.l_start = i; - serverSendLockLocal(&request, i); - } - state = RESULT; - continue; - - case SYNC: - sendLockTest(&tLock); - if (bl) { - state = BYTELOCK; - continue; - } - - if (n < MAXTEST + 1) - state = RESULT; - else - state = END; - continue; - - case RESULT: - /* Read results by one */ - getResults(n - 1); - if (bl) - validationResults(n - 1); - state = CLEAN; - continue; - - case CLEAN: - /* Ask the clients to stop testing ... */ - tLock.test = CLEAN; - serializeTLock(&tLock); - serverSend(); - /* ... and wait for an ack before closing */ - serverReceive(); - /* Ignore message content : that is only an ack */ - - /* close and open file */ - close(dp.fd); - initTest(); - state = SELECT; - continue; - case END: - tLock.test = END; - serializeTLock(&tLock); - serverSend(); - sleep(2); - break; - - printf("(end)\n"); - exit(0); - - } - break; - } - - return report(clnt); -} - -/* Slave process/thread */ - -void *slave(void *data) -{ - struct dataChild *df; - int i, a, result, ftest; - struct s_test tLock; - struct flock request; - char tmp[16]; -#ifdef DEBUG - char dbg[16]; -#endif - char *phraseTest = "L'ecriture a reussi"; - int len; - enum state_t state; - - result = -1; - ftest = -1; - len = strlen(phraseTest); - df = (struct dataChild *)data; - i = df->dpr->whoami; - P("Slave n=%d\n", i); - slaveReader = dp.lclnt[i][0]; - slaveWriter = dp.master[1]; - state = SYNC; - errno = 0; - memset(tmp, 0, 16); - while (1) { - switch (state) { - case SELECT: - case SYNC: - getLockTest(&tLock); - state = tLock.test; - P("Slave State=%d\n", state); - - continue; - case RDONLY: - /* Try to read a file */ - P("TEST READ ONLY %d\n", RDONLY); - if ((ftest = open(dp.fname, O_RDONLY | O_NONBLOCK)) < 0) { - result = ECHEC; - state = RESULT; - if (dp.verbose) - perror("Open:"); - continue; - } - P("fd=%d\n", ftest); - a = read(ftest, tmp, 16); - if (a < 16) - result = ECHEC; - else - result = SUCCES; - state = RESULT; - continue; - - case WRONLY: - /* Try to write a file */ - P("TEST WRITE ONLY %d\n", WRONLY); - if ((ftest = open(dp.fname, O_WRONLY | O_NONBLOCK)) < 0) { - result = ECHEC; - state = RESULT; - if (dp.verbose) - perror("Open read only:"); - continue; - } - P("fd=%d\n", ftest); - if (write(ftest, phraseTest, len) < len) - result = ECHEC; - else - result = SUCCES; - state = RESULT; - continue; - - case LOCK: - - case READLOCK: - /* Try to read a read-locked section */ - P("READ LOCK %d\n", F_RDLCK); - if ((ftest = open(dp.fname, O_RDONLY | O_NONBLOCK)) < 0) { - result = ECHEC; - state = RESULT; - if (dp.verbose) - perror("Open read-write:"); - continue; - } - - P("fd=%d\n", ftest); - /* Lock the whole file */ - request.l_type = F_RDLCK; - request.l_whence = SEEK_SET; - request.l_start = 0; - request.l_len = 0; - - if (fcntl(ftest, F_SETLK, &request) < 0) { - if (dp.verbose || errno != EAGAIN) - perror("RDONLY: fcntl"); - result = ECHEC; - } else - result = SUCCES; - state = RESULT; - continue; - - case WRITELOCK: - /* Try to write a file */ - P("WRITE LOCK %d\n", F_WRLCK); - if ((ftest = open(dp.fname, O_WRONLY | O_NONBLOCK)) < 0) { - result = ECHEC; - state = RESULT; - if (dp.verbose) - perror("\nOpen:"); - continue; - } - /* Lock the whole file */ - P("fd=%d\n", ftest); - request.l_type = F_WRLCK; - request.l_whence = SEEK_SET; - request.l_start = 0; - request.l_len = 0; - - if (fcntl(ftest, F_SETLK, &request) < 0) { - if (dp.verbose || errno != EAGAIN) - perror("\nWRONLY: fcntl"); - result = ECHEC; - } else - result = SUCCES; - state = RESULT; - continue; - - case BYTELOCK_READ: - P("BYTE LOCK READ: %d\n", state); - state = BYTELOCK; - continue; - - case BYTELOCK_WRITE: - P("BYTE LOCK WRITE: %d\n", state); - state = BYTELOCK; - continue; - - case BYTELOCK: - /* Wait for the exact section to lock. The whole file is sent by the master */ - P("BYTE LOCK %d\n", state); - getLockSection(&request); - if ((ftest = open(dp.fname, O_RDWR | O_NONBLOCK)) < 0) { - result = ECHEC; - state = RESULT; - if (dp.verbose) - perror("\nOpen:"); - continue; - } - - if (fcntl(ftest, F_SETLK, &request) < 0) { - if (dp.verbose || errno != EAGAIN) - perror("\nBTLOCK: fcntl"); - result = ECHEC; - state = RESULT; - continue; - } - /* Change the character at the given position for an easier verification */ - a = lseek(ftest, request.l_start, SEEK_SET); - write(ftest, "=", 1); - result = SUCCES; - state = RESULT; - continue; - - case RESULT: - if (result == SUCCES) - write(0, "=", 1); - else - write(0, "x", 1); - P("RESULT: %d\n", result); - sendResult(result); - state = SYNC; - continue; - - case CLEAN: - close(ftest); - /* Send CLEAN Ack */ - sendResult(result); - state = SYNC; - continue; - - case END: - E("(End)\n"); - finish(0); - printf("Unknown command\n"); - finish(1); - - } - } - -} - -char *nextArg(int argc, char **argv, int *i) -{ - if (((*i) + 1) < argc) { - (*i) += 1; - return argv[(*i)]; - } - return NULL; -} - -int usage(void) -{ - printf("locktest -n -f [-T]\n"); - printf("Number of child process must be higher than 1\n"); - exit(0); - return 0; -} - -int main(int argc, char **argv) -{ - int rc = 0; - int i, nThread = 0; - char *tmp; - int type = 0; - int clients; - type = PROCESS; - dp.fname = NULL; - dp.verbose = 0; - int server = 1; - char *host; - - host = NULL; - clients = 0; - - for (i = 1; i < argc; i++) { - - if (!strcmp("-n", argv[i])) { - if (!(tmp = nextArg(argc, argv, &i))) - usage(); - nThread = atoi(tmp); - continue; - } - - if (!strcmp("-f", argv[i])) { - if (!(dp.fname = nextArg(argc, argv, &i))) - usage(); - continue; - } - if (!strcmp("-v", argv[i])) { - dp.verbose = TRUE; - continue; - } - if (!strcmp("-c", argv[i])) { - if (!(clients = atoi(nextArg(argc, argv, &i)))) - usage(); - continue; - } - - if (!strcmp("--server", argv[i])) { - if (!(host = nextArg(argc, argv, &i))) - usage(); - server = 0; - continue; - } - printf("Ignoring unknown option: %s\n", argv[i]); - } - - if (server) { - if (!(dp.fname && nThread)) - usage(); - if (clients > 0) { - configureServer(clients); - setupClients(type, dp.fname, nThread); - } - } else { - configureClient(host); - dp.fname = malloc(512); - memset(dp.fname, 0, 512); - getConfiguration(&type, dp.fname, &nThread); - } - - if (dp.verbose) - printf("By process.\n"); - load = loadProcess; - eType = "process"; - finish = finishProcess; - LIST_RESULTS = LIST_RESULTS_PROCESS; - initialize(nThread); - if (server) { - rc = master(); - } else { - masterClient(); - free(dp.fname); - } - clean(); - - return rc; -} diff --git a/testcases/network/nfsv4/locks/locktests.h b/testcases/network/nfsv4/locks/locktests.h deleted file mode 100644 index a40e4172e..000000000 --- a/testcases/network/nfsv4/locks/locktests.h +++ /dev/null @@ -1,165 +0,0 @@ -/* ************************************************* - * *********** README ****************************** - * ************************************************* - * - * COMPILE : make - * RUN : ./locktests -n -f [-P] - * - * GOAL : This test tries to stress the fcntl locking functions. A - * master process sets a lock on a file region (this is called "byte - * range locking"). Some slave processes try to perform operations on - * this region, such as read, write, set a new lock ... The expected - * results of these operations are known. If the operation's result is - * the same as the expected one, the test suceeds, else it fails. - * - * Slaves are either concurent processes or threads. - * -n : Number of threads to use (mandatory). - * -f : Run the test on a test file defined by the -f option (mandatory). - * -T : Use threads instead of processes (optional). - * - * HISTORY : This program has been written to stress NFSv4 locks. -P - * option was created to verify NFSv4 locking was thread-aware, and so, - * locking behaviour over NFSv4 was POSIX correct both using threads and - * process. This option may not be useful to stress. - * - * EXAMPLE : ./locktests -n 50 -f /file/system/to/test - * - * - * Vincent ROQUETA 2005 - vincent.roqueta@ext.bull.net - * BULL S.A. - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef STDARG -#include -#endif -#include -#include -#include -#include -#ifdef MMAP -#include -#endif -#include -#include -#include -#include -#include - -#ifdef O_SYNC -#define OPENFLAGS (O_CREAT | O_RDWR | O_SYNC ) -#else -#define OPENFLAGS (O_CREAT | O_RDWR ) -#endif -#define OPENMODES (0600) -#define MANDMODES (0600) -/*(02666)*/ - -#define SUCCES 1 -#define ECHEC 0 - -#define TRUE 1 -#define FALSE 0 - -#define PROCESS 0 -#define THREAD 1 - - -//#define DEBUG -#ifdef DEBUG - #define E(a) perror(a) - #define P(a,b) printf(a,b) -#else - #define E(a) - #define P(a,b) -#endif - - - -#ifndef LOCKTESTS_H -#define LOCKTESTS_H - -#define M_SIZE 512 - -int writeToAllClients(char *foo); - -int serverReceiveNet(); -int clientReceiveNet(); -int serverReceiveClient(int n); -int setupClients(int type, char *fname, int nThread); -int serverCloseConnection(); -int getConfiguration(int *type, char *fname, int *nThread); -int readFromServer(char *message); -int serverSendClient(int n); - - -enum state_t { - CLEAN, - RDONLY, - RESULT, - WRONLY, - SELECT, - LOCK, - SYNC, - END, - READLOCK, - WRITELOCK, - BYTELOCK, - BYTELOCK_READ, - BYTELOCK_WRITE -}; - -/* Public data */ -struct dataPub { - /* Number of clients */ - int nclnt; - /* List of master to slave pipes */ - int **lclnt; - /* Slave to master pipe */ - int master[2]; - /* Thread list */ - pthread_t *lthreads; - /* test file name */ - char *fname; - /* test file file-descriptor */ - int fd; - /* Detailed error messages */ - int verbose; -}; - -/* private data */ -struct dataPriv { - /* thread number */ - int whoami; -}; - -struct dataChild{ - struct dataPub *dp; - struct dataPriv *dpr; -}; - - -struct s_test { - int test; - int type; - char *nom; - int resAtt; - -}; - - - - -int configureServer(int max); -int configureClient(char *s); - -#endif diff --git a/testcases/network/nfsv4/locks/locktests.py b/testcases/network/nfsv4/locks/locktests.py deleted file mode 100755 index 9876a86ef..000000000 --- a/testcases/network/nfsv4/locks/locktests.py +++ /dev/null @@ -1,236 +0,0 @@ -#!/usr/bin/env python3 -# This script aims to help to run locktests with several clients. -# -# Report bugs to Vincent ROQUETA : vincent.roqueta@ext.bull.net - -import encodings -import shutil -import os, sys -import getopt, sys -import string -import socket -from stat import * -from sys import * -from os import * - -NFS4_PATH="/mnt/nfsv4" -NFS4_SERVER="" -TEST_HOME="/home/vincent/locks/" -testfile=NFS4_PATH+"/testfile" - -app="locktests" -SRC="locktests.tar.gz" -SRC_PATH="deploy" -install="'tar xzf "+SRC+"; cd locks; make `" -user="root" - - - - - -class Machine: - - def mkdir(self,dir): - self.command="mkdir -p "+dir - self.do() - def rmdir(self,dir): - self.command="rm -rf "+dir - self.do() - - def printc(self): - print("->"+self.command) - print("\n") - -class Client(Machine): - - def __init__(self, machine): - self.command="" - self.machine=machine - self.mountPath=NFS4_PATH - - def do(self): - self.command="ssh "+user+"@"+self.machine+" "+self.command - os.system(self.command) - - def isomount(self, dir): - export=NFS4_SERVER - mntpoint=NFS4_PATH - self.command="'mkdir -p "+mntpoint+"; mount -t nfs4 "+export+" "+mntpoint+"'" - self.do() - - def umount(self, dir): - mntpoint=self.mountPath+"/"+dir - self.command="umount "+mntpoint - self.do() - def install(self, path): - self.command="'cd "+path+"; tar xzf "+SRC+"; cd locks; make'" - self.do() - - def run(self, appli): - self.command=appli - self.do() - def cp(self, fichier, path): - command="scp "+fichier+" "+user+"@"+self.machine+":"+path - os.system(command) - - -class Serveur(Machine): - - def __init__(self, ip, exportPath): - self.SERVEUR=ip - self.exportPath=exportPath - - def do(self): - self.command="ssh "+self.SERVEUR+" "+self.command - os.system(self.command) - - def configure(self, dir): - exportDir=self.exportPath+'/'+dir - self. mkdir(exportDir) -#self.printc() - self.export(exportDir) -#self.printc() - def clean(self, dir): - unexportDir=self.exportPath+'/'+dir - self.unexport(unexportDir) - self.rmdir(unexportDir) -def usage(): - print("\n") - print("usage:") - print("locktests.py <-n process -f testfile ><--setup -s fs_server> -c host1, host2, host3 ... ") - print("--setup : setup the configuration, deploy test on other test machines; This option also requires -c and -s") - print("-c : host list to deploy/run/clean the test") - print("-s : NFS server to use to setup the test") - print("-n : number of processes each test machine will lauch to perform the test") - print("-f : test file. This must be the same on each machine") - print(" ") - print("Example :") - print("=========") - print("*Setup machines for testing") - print("./locktests.py --setup -c testmachine1 testmachine2 testmachine3 -s my_nfs_server:/") - print("\n") - print("*Run test on testmachine1,testmachine2 with 50 process on each machine using /mnt/nfsv4/testfile") - print("./locktests.py -n 50 -f /mnt/nfsv4/testfile -c testmachine1 testmachine2") - print("\n") - print("_________________________________") - print("Vincent ROQUETA - Bull SA - 2005\n") - - return 0 - - - -def setup(): - path=os.path.abspath(".") - fichier=SRC_PATH+"/"+SRC - commande="" - for i in clients: - print("Setting up machine "+i) - c=Client(i) - c.mkdir(path) - c.cp(fichier, path) - c.install(path) - c.isomount(NFS4_PATH) - #Setup localhost - print("Setting up localhost") - commande="make; mkdir -p "+NFS4_PATH+" ; mount -t nfs4 "+NFS4_SERVER+" "+NFS4_PATH+" &" - os.system(commande) - - -def run(): - path=os.path.abspath(".") - nbreClients=len(clients) - hostname=socket.gethostname() - # Lancement du serveur en local - # Launch the server locally - commande=path+"/"+app+" -n "+nbreProcess+" -f "+filename+" -c "+str(nbreClients)+" &" - os.system(commande) - commande=path+"/locks/"+app+" --server "+hostname - for i in clients: - c=Client(i) - c.run(commande) - -def clean(): - for i in clients: - client.umount(NFS4_PATH) - - - - - - -args=sys.argv[1:] -rge=list(range(len(args))) -a="" -r=True -s=False -nfsServer=False -c=False -f=False -n=False -clients=[] -for i in rge: - if args[i] in ("--install", "-i", "--setup"): - r=False - s=True - continue - if args[i] in ("-s", "--server"): - a="nfsServer" - nfsServer=True - continue - if args[i] in ("-h", "--help"): - usage() - sys.exit(1) - if args[i] in ("--clients", "-c"): - a="clients" - c=True - continue - if args[i] == "-n": - a="nbre" - n=True - continue - if args[i] == "-f": - a="file" - f=True - continue - - if a=="clients": - clients.append(args[i]) - continue - if a=="file": - filename=args[i] - continue - if a=="nbre": - nbreProcess=args[i] - continue - if a=="nfsServer": - NFS4_SERVER=args[i] - continue - - - usage() -# For ... -if s: - if (not c) or (not nfsServer): - usage() - sys.exit(1) - print("Setup") - print(NFS4_SERVER) - setup() - print("Setup complete") - -if r: - if (not c) or (not f) or (not n): - usage() - sys.exit(1) - - print("Running test") - run() - - - - - - - - - diff --git a/testcases/network/nfsv4/locks/netsync.c b/testcases/network/nfsv4/locks/netsync.c deleted file mode 100644 index b40c002fe..000000000 --- a/testcases/network/nfsv4/locks/netsync.c +++ /dev/null @@ -1,201 +0,0 @@ -#include "locktests.h" - -#include -#include -#define PORT 12346 -#define MAX_CONNECTION 16 - -int maxClients; -int *fdClient; -char *server_name; -int fdServer; -extern char message[M_SIZE]; - -int serverReceiveClient(int c) -{ - char tmp[M_SIZE]; - int r, s; - /* Ensure we read _exactly_ M_SIZE characters in the message */ - memset(message, 0, M_SIZE); - memset(tmp, 0, M_SIZE); - r = 0; - s = 0; - - while (s < M_SIZE) { - r = read(fdClient[c], tmp, M_SIZE - s); - /* Loop until we have a complete message */ - strncpy(message + s, tmp, r); - s += r; - } - return s; -} - -int serverSendClient(int n) -{ - return write(fdClient[n], message, M_SIZE); -} - -int clientReceiveNet(void) -{ - readFromServer(message); - return 0; -} - -int setupConnectionServer(void) -{ - struct sockaddr_in local; - int c; - socklen_t size; - int sock; - struct sockaddr_in remote; - - if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - perror("socket"); - exit(1); - } - memset(&local, 0x00, sizeof(local)); - local.sin_family = AF_INET; - local.sin_port = htons(PORT); - local.sin_addr.s_addr = INADDR_ANY; - memset(&(local.sin_zero), 0x00, 8); - - if (bind(sock, (struct sockaddr *)&local, sizeof(struct sockaddr)) == - -1) { - perror("bind"); - exit(1); - } - - if (listen(sock, MAX_CONNECTION) == -1) { - perror("listen"); - return 1; - } - size = sizeof(struct sockaddr_in); - for (c = 0; c < maxClients; c++) { - if ((fdClient[c] = - accept(sock, (struct sockaddr *)&remote, &size)) == -1) { - perror("accept"); - return 1; - } - - } - return 0; -} - -int writeToClient(int c, char *message) -{ - return write(fdClient[c], message, 512); -} - -int serverCloseConnection(void) -{ - int c; - for (c = 0; c < maxClients; c++) - close(fdClient[c]); - return 0; - -} - -int writeToAllClients(char *foo) -{ - int c; - for (c = 0; c < maxClients; c++) - writeToClient(c, foo); - return 0; -} - -int setupClients(int type, char *fname, int nThread) -{ - /* - * Send parameters to all slaves : - * - * We must send : - * - the position of the test file - * - the number of slaves for each client - * - The kind of slaves : process or thread - */ - char message[512]; - sprintf(message, "%d:%s:%d::", type, fname, nThread); - writeToAllClients(message); - return 0; -} - -int configureServer(int max) -{ - maxClients = max; - fdClient = malloc(sizeof(int) * max); - - setupConnectionServer(); - - return 0; -} - -int setupConnectionClient(void) -{ - - struct hostent *server; - struct sockaddr_in serv_addr; - - if (!(server = gethostbyname(server_name))) { - printf("erreur DNS\n"); - return 1; - } - - fdServer = socket(AF_INET, SOCK_STREAM, 0); - if (fdServer < 0) { - perror("socket"); - return 1; - } - - serv_addr.sin_addr = *(struct in_addr *)server->h_addr; - serv_addr.sin_port = htons(PORT); - serv_addr.sin_family = AF_INET; - if (connect(fdServer, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) - < 0) { - perror("connect"); - return 1; - } - return 0; -} - -int readFromServer(char *message) -{ - char tmp[M_SIZE]; - int r, s; - /* Ensure we read exactly M_SIZE characters */ - memset(message, 0, M_SIZE); - memset(tmp, 0, M_SIZE); - r = 0; - s = 0; - while (s < M_SIZE) { - r = read(fdServer, tmp, M_SIZE - s); - /* Loop until we have a complete message */ - strncpy(message + s, tmp, r); - s += r; - } - return s; -} - -int getConfiguration(int *type, char *fname, int *nThread) -{ - char conf[M_SIZE]; - char *p; - int i; - readFromServer(conf); - p = strtok(conf, ":"); - printf("%s\n", p); - *type = atoi(p); - p = strtok(NULL, ":"); - i = strlen(p); - strncpy(fname, p, i); - p = strtok(NULL, ":"); - *nThread = atoi(p); - - return 0; -} - -int configureClient(char *s) -{ - server_name = s; - setupConnectionClient(); - return 0; -} -- 2.27.0