Imported Upstream version 1.5.1
This commit is contained in:
154
tests/test_scripts/01_simple_metadata.py
Executable file
154
tests/test_scripts/01_simple_metadata.py
Executable file
@@ -0,0 +1,154 @@
|
||||
#! /usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2009-2011 by Bjoern Kolbeck, Minor Gordon, Zuse Institute Berlin
|
||||
# Licensed under the BSD License, see LICENSE file for details.
|
||||
|
||||
import os, shutil, stat, unittest, sys
|
||||
|
||||
|
||||
TEST_FILE_NAME = "simple_metadata_file.txt"
|
||||
TEST_DIR_NAME = "simple_metadata_dir"
|
||||
TEST_LINK_NAME = "simple_metadata_link"
|
||||
TEST_SUBDIR_NAME = "simple_metadata_subdir"
|
||||
TEST_SUBDIR_PATH = os.path.join( TEST_DIR_NAME, TEST_SUBDIR_NAME )
|
||||
TEST_SUBDIRNONASCII_NAME = "subdir_ÄöíŁ€"
|
||||
TEST_SUBDIRNONASCII_PATH = os.path.join( TEST_DIR_NAME, TEST_SUBDIRNONASCII_NAME )
|
||||
|
||||
|
||||
class SimpleMetadataTestCase(unittest.TestCase):
|
||||
def tearDown( self ):
|
||||
try: os.unlink( TEST_FILE_NAME )
|
||||
except: pass
|
||||
try: os.unlink( TEST_LINK_NAME )
|
||||
except: pass
|
||||
try: shutil.rmtree( TEST_DIR_NAME )
|
||||
except: pass
|
||||
|
||||
|
||||
class chmodTest(SimpleMetadataTestCase):
|
||||
def runTest( self ):
|
||||
open( TEST_FILE_NAME, "w+" ).close()
|
||||
os.chmod( TEST_FILE_NAME, stat.S_IWRITE | stat.S_IREAD )
|
||||
|
||||
class chownTest(SimpleMetadataTestCase):
|
||||
def runTest( self ):
|
||||
open( TEST_FILE_NAME, "w+" ).close()
|
||||
os.chown( TEST_FILE_NAME, 1001, 100 )
|
||||
open( TEST_FILE_NAME, "r" ).close()
|
||||
|
||||
|
||||
class creatTest(SimpleMetadataTestCase):
|
||||
def runTest( self ):
|
||||
open( TEST_FILE_NAME, "w+" ).close()
|
||||
assert os.path.exists( TEST_FILE_NAME )
|
||||
|
||||
|
||||
class linkTest(SimpleMetadataTestCase):
|
||||
def runTest(self ):
|
||||
open( TEST_FILE_NAME, "w+" ).close()
|
||||
assert os.path.exists( TEST_FILE_NAME )
|
||||
os.link( TEST_FILE_NAME, TEST_LINK_NAME )
|
||||
assert os.path.exists( TEST_LINK_NAME )
|
||||
os.unlink( TEST_LINK_NAME )
|
||||
assert not os.path.exists( TEST_LINK_NAME )
|
||||
assert os.path.exists( TEST_FILE_NAME )
|
||||
|
||||
|
||||
class mkdirTest(SimpleMetadataTestCase):
|
||||
def runTest( self ):
|
||||
os.mkdir( TEST_DIR_NAME )
|
||||
assert os.path.exists( TEST_DIR_NAME )
|
||||
os.mkdir( TEST_SUBDIR_PATH )
|
||||
assert os.path.exists( TEST_SUBDIR_PATH )
|
||||
|
||||
class mkdirNonASCIITest(SimpleMetadataTestCase):
|
||||
def runTest( self ):
|
||||
os.mkdir( TEST_DIR_NAME )
|
||||
assert os.path.exists( TEST_DIR_NAME )
|
||||
os.mkdir( TEST_SUBDIRNONASCII_PATH )
|
||||
assert os.path.exists( TEST_SUBDIRNONASCII_PATH )
|
||||
|
||||
|
||||
class readdirTest(SimpleMetadataTestCase):
|
||||
def runTest( self ):
|
||||
os.mkdir( TEST_DIR_NAME )
|
||||
os.mkdir( TEST_SUBDIR_PATH )
|
||||
assert len( os.listdir( TEST_DIR_NAME ) ) >= 1
|
||||
|
||||
|
||||
class renamedirTest(SimpleMetadataTestCase):
|
||||
def runTest( self ):
|
||||
os.mkdir( TEST_DIR_NAME )
|
||||
assert os.path.exists( TEST_DIR_NAME )
|
||||
os.rename( TEST_DIR_NAME, "renameddir" )
|
||||
assert not os.path.exists( TEST_DIR_NAME )
|
||||
assert os.path.exists( "renameddir" )
|
||||
os.rename( "renameddir", TEST_DIR_NAME )
|
||||
assert os.path.exists( TEST_DIR_NAME )
|
||||
assert not os.path.exists( "renameddir" )
|
||||
|
||||
|
||||
class renamefileTest(SimpleMetadataTestCase):
|
||||
def runTest( self ):
|
||||
open( TEST_FILE_NAME, "w+" ).close()
|
||||
assert os.path.exists( TEST_FILE_NAME )
|
||||
os.rename( TEST_FILE_NAME, "renamefile" )
|
||||
assert not os.path.exists( TEST_FILE_NAME )
|
||||
assert os.path.exists( "renamefile" )
|
||||
os.unlink( "renamefile" )
|
||||
assert not os.path.exists( "renamefile" )
|
||||
open( TEST_FILE_NAME, "w+" ).close()
|
||||
assert os.path.exists( TEST_FILE_NAME )
|
||||
|
||||
|
||||
class rmdirTest(SimpleMetadataTestCase):
|
||||
def runTest( self ):
|
||||
os.mkdir( TEST_DIR_NAME )
|
||||
os.mkdir( os.path.join( TEST_DIR_NAME, TEST_SUBDIR_NAME ) )
|
||||
os.rmdir( os.path.join( TEST_DIR_NAME, TEST_SUBDIR_NAME ) )
|
||||
os.rmdir( TEST_DIR_NAME )
|
||||
|
||||
|
||||
class symlinkTest(SimpleMetadataTestCase):
|
||||
def runTest( self ):
|
||||
open( TEST_FILE_NAME, "w+" ).close()
|
||||
assert os.path.exists( TEST_FILE_NAME )
|
||||
os.symlink( TEST_FILE_NAME, TEST_LINK_NAME )
|
||||
assert os.path.exists( TEST_LINK_NAME )
|
||||
assert os.readlink( TEST_LINK_NAME ) == TEST_FILE_NAME
|
||||
os.rename( TEST_LINK_NAME, "renamedlink" )
|
||||
assert os.readlink( "renamedlink" ) == TEST_FILE_NAME
|
||||
os.unlink( "renamedlink" )
|
||||
assert os.path.exists( TEST_FILE_NAME )
|
||||
|
||||
|
||||
class unlinkTest(SimpleMetadataTestCase):
|
||||
def runTest( self ):
|
||||
open( TEST_FILE_NAME, "w+" ).close()
|
||||
assert os.path.exists( TEST_FILE_NAME )
|
||||
os.unlink( TEST_FILE_NAME )
|
||||
assert not os.path.exists( TEST_FILE_NAME )
|
||||
|
||||
|
||||
def createTestSuite( *args, **kwds ):
|
||||
test_suite = unittest.TestSuite()
|
||||
test_suite.addTest( chmodTest() )
|
||||
test_suite.addTest( creatTest() )
|
||||
if hasattr( os, "link" ): test_suite.addTest( linkTest() )
|
||||
test_suite.addTest( mkdirTest() )
|
||||
test_suite.addTest( mkdirNonASCIITest() )
|
||||
test_suite.addTest( readdirTest() )
|
||||
test_suite.addTest( renamedirTest() )
|
||||
test_suite.addTest( renamefileTest() )
|
||||
test_suite.addTest( rmdirTest() )
|
||||
if hasattr( os, "symlink" ): test_suite.addTest( symlinkTest() )
|
||||
test_suite.addTest( unlinkTest() )
|
||||
return test_suite
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
result = unittest.TextTestRunner( verbosity=2 ).run( createTestSuite() )
|
||||
if not result.wasSuccessful():
|
||||
sys.exit(1)
|
||||
|
||||
63
tests/test_scripts/02_erichs_ddwrite.py
Executable file
63
tests/test_scripts/02_erichs_ddwrite.py
Executable file
@@ -0,0 +1,63 @@
|
||||
#! /usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2009-2011 by Bjoern Kolbeck, Minor Gordon, Zuse Institute Berlin
|
||||
# Licensed under the BSD License, see LICENSE file for details.
|
||||
|
||||
import unittest, subprocess, time, os, sys
|
||||
from glob import glob
|
||||
|
||||
|
||||
class ErichsddwriteTest(unittest.TestCase):
|
||||
def __init__( self, stdout=sys.stdout, stderr=sys.stderr, *args, **kwds ):
|
||||
unittest.TestCase.__init__( self )
|
||||
self.stdout = stdout
|
||||
self.stderr = stderr
|
||||
|
||||
def setUp( self ):
|
||||
self.client_processes = []
|
||||
|
||||
def tearDown( self ):
|
||||
for client_process in self.client_processes:
|
||||
client_process.terminate()
|
||||
client_process.wait()
|
||||
|
||||
for file_name in glob( self.__class__.__name__ + "*" ):
|
||||
os.unlink( file_name )
|
||||
|
||||
def runTest( self ):
|
||||
class_name = self.__class__.__name__
|
||||
for clients_count in xrange( 2, 4, 2 ):
|
||||
for client_i in xrange( clients_count ):
|
||||
args = "dd if=/dev/zero of=%(class_name)s_%(client_i)u bs=1MB count=10" % locals()
|
||||
client_process = subprocess.Popen( args, shell=True, stdout=self.stdout, stderr=self.stderr )
|
||||
self.client_processes.append( client_process )
|
||||
|
||||
while len( self.client_processes ) > 0:
|
||||
client_i = 0
|
||||
while client_i < len( self.client_processes ):
|
||||
retcode = self.client_processes[client_i].poll()
|
||||
if retcode is not None:
|
||||
if retcode != 0:
|
||||
self.fail()
|
||||
else:
|
||||
del self.client_processes[client_i]
|
||||
else:
|
||||
client_i ++ 1
|
||||
|
||||
time.sleep( 0.5 )
|
||||
|
||||
|
||||
def createTestSuite( *args, **kwds ):
|
||||
if not sys.platform.startswith( "win" ):
|
||||
return unittest.TestSuite( [ErichsddwriteTest( *args, **kwds )] )
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if not sys.platform.startswith( "win" ):
|
||||
result = unittest.TextTestRunner( verbosity=2 ).run( createTestSuite() )
|
||||
if not result.wasSuccessful():
|
||||
sys.exit(1)
|
||||
else:
|
||||
print sys.modules[__name__].__file__.split( os.sep )[-1], "not supported on Windows"
|
||||
|
||||
39
tests/test_scripts/03_erichs_data_integrity_test.py
Executable file
39
tests/test_scripts/03_erichs_data_integrity_test.py
Executable file
@@ -0,0 +1,39 @@
|
||||
#! /usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2009-2011 by Bjoern Kolbeck, Minor Gordon, Zuse Institute Berlin
|
||||
# Licensed under the BSD License, see LICENSE file for details.
|
||||
|
||||
import unittest, os.path, sys, subprocess
|
||||
|
||||
|
||||
# Constants
|
||||
MY_DIR_PATH = os.path.dirname( os.path.abspath( sys.modules[__name__].__file__ ) )
|
||||
MARKED_BLOCK_PL_FILE_PATH = os.path.join( MY_DIR_PATH, "marked_block.pl" )
|
||||
|
||||
|
||||
class ErichsDataIntegrityTest(unittest.TestCase):
|
||||
def __init__( self, stdout=sys.stdout, stderr=sys.stderr, *args, **kwds ):
|
||||
unittest.TestCase.__init__( self )
|
||||
self.stdout = stdout
|
||||
self.stderr = stderr
|
||||
|
||||
def runTest( self ):
|
||||
p = subprocess.Popen( MARKED_BLOCK_PL_FILE_PATH + " --start=1 --nfiles=20 --size=1 --group=10 --base=.", shell=True, stdout=self.stdout, stderr=self.stderr )
|
||||
retcode = p.wait()
|
||||
self.assertEqual( retcode, 0 )
|
||||
|
||||
|
||||
def createTestSuite( *args, **kwds ):
|
||||
if not sys.platform.startswith( "win" ):
|
||||
return unittest.TestSuite( [ErichsDataIntegrityTest( *args, **kwds )] )
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if not sys.platform.startswith( "win" ):
|
||||
result = unittest.TextTestRunner( verbosity=2 ).run( createTestSuite() )
|
||||
if not result.wasSuccessful():
|
||||
sys.exit(1)
|
||||
else:
|
||||
print sys.modules[__name__].__file__.split( os.sep )[-1], "not supported on Windows"
|
||||
|
||||
18
tests/test_scripts/05_findgreptar.sh
Executable file
18
tests/test_scripts/05_findgreptar.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
XTREEMFS_DIR="$1"
|
||||
TGZ_ARCHIVE="cpp.tgz"
|
||||
|
||||
MOUNT="$PWD"
|
||||
|
||||
cd "$XTREEMFS_DIR"
|
||||
tar czf "${MOUNT}/${TGZ_ARCHIVE}" "cpp" --exclude="build" --exclude="thirdparty"
|
||||
cd "$MOUNT"
|
||||
|
||||
tar zxf "$TGZ_ARCHIVE"
|
||||
|
||||
find . -name '*.cpp' >/dev/null
|
||||
|
||||
grep -R 'test' . >/dev/null
|
||||
48
tests/test_scripts/09_fsx.py
Executable file
48
tests/test_scripts/09_fsx.py
Executable file
@@ -0,0 +1,48 @@
|
||||
#! /usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2009-2011 by Bjoern Kolbeck, Minor Gordon, Zuse Institute Berlin
|
||||
# Licensed under the BSD License, see LICENSE file for details.
|
||||
|
||||
import distutils.ccompiler
|
||||
import os.path
|
||||
import unittest, subprocess, sys, os
|
||||
|
||||
MY_DIR_PATH = os.path.dirname( os.path.abspath( sys.modules[__name__].__file__ ) )
|
||||
|
||||
class fsxTest(unittest.TestCase):
|
||||
def __init__( self, direct_io=True, stdout=sys.stdout, stderr=sys.stderr, *args, **kwds ):
|
||||
unittest.TestCase.__init__( self )
|
||||
self.direct_io = direct_io
|
||||
self.stdout = stdout
|
||||
self.stderr = stderr
|
||||
|
||||
def runTest( self ):
|
||||
if os.path.exists(MY_DIR_PATH+"/../utils/fsx.bin") == False:
|
||||
compiler = distutils.ccompiler.new_compiler()
|
||||
cwd = os.getcwd()
|
||||
os.chdir(MY_DIR_PATH+"/../utils")
|
||||
|
||||
compiler.compile(["ltp-fsx.c"])
|
||||
compiler.link_executable(["ltp-fsx.o"],"fsx.bin")
|
||||
os.chdir(cwd)
|
||||
|
||||
args = MY_DIR_PATH+"/../utils/fsx.bin -R -W -N 100000 ./fsx.tmpfile" # -s 100"
|
||||
p = subprocess.Popen( args, shell=True, stdout=self.stdout, stderr=self.stderr )
|
||||
retcode = p.wait()
|
||||
self.assertEqual( retcode, 0 )
|
||||
|
||||
|
||||
def createTestSuite( *args, **kwds ):
|
||||
if not sys.platform.startswith( "win" ):
|
||||
return unittest.TestSuite( [fsxTest( *args, **kwds )] )
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if not sys.platform.startswith( "win" ):
|
||||
result = unittest.TextTestRunner( verbosity=2 ).run( createTestSuite() )
|
||||
if not result.wasSuccessful():
|
||||
sys.exit(1)
|
||||
else:
|
||||
print sys.modules[__name__].__file__.split( os.sep )[-1], "not supported on Windows"
|
||||
|
||||
40
tests/test_scripts/10_bonnie.py
Executable file
40
tests/test_scripts/10_bonnie.py
Executable file
@@ -0,0 +1,40 @@
|
||||
#! /usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2009-2011 by Bjoern Kolbeck, Minor Gordon, Zuse Institute Berlin
|
||||
# Licensed under the BSD License, see LICENSE file for details.
|
||||
|
||||
|
||||
import unittest, subprocess, sys, os
|
||||
|
||||
|
||||
class bonnieTest(unittest.TestCase):
|
||||
def __init__( self, direct_io=True, stdout=sys.stdout, stderr=sys.stderr, *args, **kwds ):
|
||||
unittest.TestCase.__init__( self )
|
||||
self.direct_io = direct_io
|
||||
self.stdout = stdout
|
||||
self.stderr = stderr
|
||||
|
||||
def runTest( self ):
|
||||
if self.direct_io:
|
||||
args = "bonnie++ -d ." # -s 100"
|
||||
p = subprocess.Popen( args, shell=True, stdout=self.stdout, stderr=self.stderr )
|
||||
retcode = p.wait()
|
||||
# self.assertEqual( retcode, 0 )
|
||||
else:
|
||||
print >>self.stdout, self.__class__.__name__ + ": skipping nondirect volume", os.getcwd()
|
||||
|
||||
|
||||
def createTestSuite( *args, **kwds ):
|
||||
if not sys.platform.startswith( "win" ):
|
||||
return unittest.TestSuite( [bonnieTest( *args, **kwds )] )
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if not sys.platform.startswith( "win" ):
|
||||
result = unittest.TextTestRunner( verbosity=2 ).run( createTestSuite() )
|
||||
if not result.wasSuccessful():
|
||||
sys.exit(1)
|
||||
else:
|
||||
print sys.modules[__name__].__file__.split( os.sep )[-1], "not supported on Windows"
|
||||
|
||||
39
tests/test_scripts/11_iozone_diagnostic.py
Executable file
39
tests/test_scripts/11_iozone_diagnostic.py
Executable file
@@ -0,0 +1,39 @@
|
||||
#! /usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2009-2011 by Bjoern Kolbeck, Minor Gordon, Zuse Institute Berlin
|
||||
# Licensed under the BSD License, see LICENSE file for details.
|
||||
|
||||
import unittest, subprocess, sys, os
|
||||
|
||||
|
||||
class iozoneDiagnosticTest(unittest.TestCase):
|
||||
def __init__( self, direct_io=True, stdout=sys.stdout, stderr=sys.stderr, *args, **kwds ):
|
||||
unittest.TestCase.__init__( self )
|
||||
self.direct_io = direct_io
|
||||
self.stdout = stdout
|
||||
self.stderr = stderr
|
||||
|
||||
def runTest( self ):
|
||||
if self.direct_io:
|
||||
args = "iozone -a -+d"
|
||||
p = subprocess.Popen( args, shell=True, stdout=self.stdout, stderr=self.stderr )
|
||||
retcode = p.wait()
|
||||
self.assertEqual( retcode, 0 )
|
||||
else:
|
||||
print >>self.stdout, self.__class__.__name__ + ": skipping nondirect volume", os.getcwd()
|
||||
|
||||
|
||||
def createTestSuite( *args, **kwds ):
|
||||
if not sys.platform.startswith( "win" ):
|
||||
return unittest.TestSuite( [iozoneDiagnosticTest( *args, **kwds )] )
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if not sys.platform.startswith( "win" ):
|
||||
result = unittest.TextTestRunner( verbosity=2 ).run( createTestSuite() )
|
||||
if not result.wasSuccessful():
|
||||
sys.exit(1)
|
||||
else:
|
||||
print sys.modules[__name__].__file__.split( os.sep )[-1], "not supported on Windows"
|
||||
|
||||
38
tests/test_scripts/12_iozone_throughput.py
Executable file
38
tests/test_scripts/12_iozone_throughput.py
Executable file
@@ -0,0 +1,38 @@
|
||||
#! /usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2009-2011 by Bjoern Kolbeck, Minor Gordon, Zuse Institute Berlin
|
||||
# Licensed under the BSD License, see LICENSE file for details.
|
||||
|
||||
import unittest, subprocess, sys, os
|
||||
|
||||
|
||||
class iozoneThroughputTest(unittest.TestCase):
|
||||
def __init__( self, stdout=sys.stdout, stderr=sys.stderr, *args, **kwds ):
|
||||
unittest.TestCase.__init__( self )
|
||||
self.stdout = stdout
|
||||
self.stderr = stderr
|
||||
|
||||
def runTest( self ):
|
||||
args = "iozone -t 1 -r 128k -s 20m"
|
||||
p = subprocess.Popen( args, shell=True, stdout=self.stdout, stderr=self.stderr )
|
||||
retcode = p.wait()
|
||||
if retcode == 0:
|
||||
pass # TODO: parse output
|
||||
else:
|
||||
self.assertEqual( retcode, 0 )
|
||||
|
||||
|
||||
def createTestSuite( *args, **kwds ):
|
||||
if not sys.platform.startswith( "win" ):
|
||||
return unittest.TestSuite( [iozoneThroughputTest( *args, **kwds )] )
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if not sys.platform.startswith( "win" ):
|
||||
result = unittest.TextTestRunner( verbosity=2 ).run( createTestSuite() )
|
||||
if not result.wasSuccessful():
|
||||
sys.exit(1)
|
||||
else:
|
||||
print sys.modules[__name__].__file__.split( os.sep )[-1], "not supported on Windows"
|
||||
|
||||
51
tests/test_scripts/13_dbench.py
Executable file
51
tests/test_scripts/13_dbench.py
Executable file
@@ -0,0 +1,51 @@
|
||||
#! /usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2009-2011 by Bjoern Kolbeck, Minor Gordon, Zuse Institute Berlin
|
||||
# Licensed under the BSD License, see LICENSE file for details.
|
||||
|
||||
import unittest, os.path, sys, subprocess, gzip
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
# Constants
|
||||
MY_DIR_PATH = os.path.dirname( os.path.abspath( sys.modules[__name__].__file__ ) )
|
||||
DBENCH_CLIENT_TXT_GZ_FILE_PATH = os.path.join( MY_DIR_PATH, "dbench-client.txt.gz" )
|
||||
|
||||
|
||||
class dbenchTest(unittest.TestCase):
|
||||
def __init__( self, direct_io=True, stdout=sys.stdout, stderr=sys.stderr, *args, **kwds ):
|
||||
unittest.TestCase.__init__( self )
|
||||
self.direct_io = direct_io
|
||||
self.stdout = stdout
|
||||
self.stderr = stderr
|
||||
|
||||
def runTest( self ):
|
||||
if self.direct_io:
|
||||
gzip_client_txt_gz_data = gzip.GzipFile( DBENCH_CLIENT_TXT_GZ_FILE_PATH, mode="rb" ).read()
|
||||
assert len( gzip_client_txt_gz_data ) > 0
|
||||
open( "dbench-client.txt", "wb" ).write( gzip_client_txt_gz_data )
|
||||
assert os.stat( "dbench-client.txt" ).st_size > 0
|
||||
|
||||
args = "dbench -c dbench-client.txt -D . 5"
|
||||
isodatetime = datetime.today().isoformat()[:-7].replace( '-', '' ).replace( ':', '' )
|
||||
stdout = open(sys.argv[4] + "/log/dbench-stdout-"+isodatetime+".txt", "a+" )
|
||||
p = subprocess.Popen( args, shell=True, stdout=stdout, stderr=subprocess.STDOUT )
|
||||
retcode = p.wait()
|
||||
self.assertEqual( retcode, 0 )
|
||||
else:
|
||||
print >>self.stdout, self.__class__.__name__ + ": skipping nondirect volume", os.getcwd()
|
||||
|
||||
|
||||
def createTestSuite( *args, **kwds ):
|
||||
if not sys.platform.startswith( "win" ):
|
||||
return unittest.TestSuite( [dbenchTest( *args, **kwds )] )
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if not sys.platform.startswith( "win" ):
|
||||
result = unittest.TextTestRunner( verbosity=2 ).run( createTestSuite() )
|
||||
if not result.wasSuccessful():
|
||||
sys.exit(1)
|
||||
else:
|
||||
print sys.modules[__name__].__file__.split( os.sep )[-1], "not supported on Windows"
|
||||
17
tests/test_scripts/14_xtfs_benchmark.sh
Executable file
17
tests/test_scripts/14_xtfs_benchmark.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
# run a series of benchmarks with the xtfs_benchmark tools on the test setup
|
||||
|
||||
XTREEMFS=$1
|
||||
DIR_SERVER=$2
|
||||
MRC_SERVER=$3
|
||||
TEST_DIR=$4
|
||||
VOLUME="$(basename $(dirname $(pwd)))"
|
||||
|
||||
exec $JAVA_HOME/bin/java -ea -cp $XTREEMFS/java/servers/dist/XtreemFS.jar:$XTREEMFS/java/foundation/dist/Foundation.jar:$XTREEMFS/java/lib/*:/usr/share/java/XtreemFS.jar:/usr/share/java/protobuf-java-2.5.0.jar:/usr/share/java/Foundation.jar:. \
|
||||
org.xtreemfs.utils.xtfs_benchmark.xtfs_benchmark -sw -sr -rw -rr -fw -fr --stripe-size 128K --stripe-width 1 -ssize 500m -rsize 100m --file-size 64K --basefile-size 500m --dir-addresses $DIR_SERVER --user $USER --group $USER $VOLUME
|
||||
|
||||
# minimal version for testing
|
||||
# exec $JAVA_HOME/bin/java -ea -cp $XTREEMFS/java/servers/dist/XtreemFS.jar:$XTREEMFS/java/foundation/dist/Foundation.jar:$XTREEMFS/java/lib/*:/usr/share/java/XtreemFS.jar:/usr/share/java/protobuf-java-2.5.0.jar:/usr/share/java/Foundation.jar:. \
|
||||
# org.xtreemfs.utils.xtfs_benchmark.xtfs_benchmark -sw -sr -rw -rr -fw -fr -t 1 --stripe-size 128K --stripe-width 1 -ssize 10m -rsize 1m --file-size 64K --basefile-size 100m --dir-address $DIR_SERVER $VOLUME
|
||||
|
||||
53
tests/test_scripts/15_makextreemfs.py
Executable file
53
tests/test_scripts/15_makextreemfs.py
Executable file
@@ -0,0 +1,53 @@
|
||||
#! /usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2009-2011 by Bjoern Kolbeck, Minor Gordon, Zuse Institute Berlin
|
||||
# Licensed under the BSD License, see LICENSE file for details.
|
||||
|
||||
import unittest
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
|
||||
global have_called_createTestSuite
|
||||
have_called_createTestSuite = False
|
||||
|
||||
|
||||
class makextreemfsTest(unittest.TestCase):
|
||||
def __init__( self, direct_io=False, stdout=sys.stdout, stderr=sys.stderr, *args, **kwds ):
|
||||
unittest.TestCase.__init__( self )
|
||||
self.stdout = stdout
|
||||
self.stderr = stderr
|
||||
self.direct_io = direct_io
|
||||
|
||||
def runTest( self ):
|
||||
|
||||
if self.direct_io:
|
||||
print >>self.stdout, self.__class__.__name__ + ": skipping nondirect volume", os.getcwd()
|
||||
else:
|
||||
retcode = subprocess.call( "wget https://github.com/xtreemfs/xtreemfs/archive/unstable.tar.gz >/dev/null", shell=True )
|
||||
self.assertEqual( retcode, 0 )
|
||||
|
||||
retcode = subprocess.call( "tar xvzf unstable.tar.gz >/dev/null", shell=True )
|
||||
self.assertEqual( retcode, 0 )
|
||||
|
||||
retcode = subprocess.call( "cd xtreemfs-unstable && make >/dev/null", shell=True )
|
||||
self.assertEqual( retcode, 0 )
|
||||
|
||||
|
||||
def createTestSuite( *args, **kwds ):
|
||||
if not sys.platform.startswith( "win" ):
|
||||
if not have_called_createTestSuite:
|
||||
globals()["have_called_createTestSuite"] = True
|
||||
return unittest.TestSuite( [makextreemfsTest( *args, **kwds )] )
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if not sys.platform.startswith( "win" ):
|
||||
result = unittest.TextTestRunner( verbosity=2 ).run( createTestSuite() )
|
||||
if not result.wasSuccessful():
|
||||
sys.exit(1)
|
||||
else:
|
||||
print sys.modules[__name__].__file__.split( os.sep )[-1], "not supported on Windows"
|
||||
|
||||
39
tests/test_scripts/16_iozone_multithread.py
Executable file
39
tests/test_scripts/16_iozone_multithread.py
Executable file
@@ -0,0 +1,39 @@
|
||||
#! /usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2009-2011 by Bjoern Kolbeck, Minor Gordon, Zuse Institute Berlin
|
||||
# 2013 by Christoph Kleineweber, Zuse Institute Berlin
|
||||
# Licensed under the BSD License, see LICENSE file for details.
|
||||
|
||||
import unittest, subprocess, sys, os
|
||||
|
||||
|
||||
class iozoneThroughputTest(unittest.TestCase):
|
||||
def __init__( self, stdout=sys.stdout, stderr=sys.stderr, *args, **kwds ):
|
||||
unittest.TestCase.__init__( self )
|
||||
self.stdout = stdout
|
||||
self.stderr = stderr
|
||||
|
||||
def runTest( self ):
|
||||
args = "iozone -T -t 10 -r 128k -s 200"
|
||||
p = subprocess.Popen( args, shell=True, stdout=self.stdout, stderr=self.stderr )
|
||||
retcode = p.wait()
|
||||
if retcode == 0:
|
||||
pass # TODO: parse output
|
||||
else:
|
||||
self.assertEqual( retcode, 0 )
|
||||
|
||||
|
||||
def createTestSuite( *args, **kwds ):
|
||||
if not sys.platform.startswith( "win" ):
|
||||
return unittest.TestSuite( [iozoneThroughputTest( *args, **kwds )] )
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if not sys.platform.startswith( "win" ):
|
||||
result = unittest.TextTestRunner( verbosity=2 ).run( createTestSuite() )
|
||||
if not result.wasSuccessful():
|
||||
sys.exit(1)
|
||||
else:
|
||||
print sys.modules[__name__].__file__.split( os.sep )[-1], "not supported on Windows"
|
||||
|
||||
41
tests/test_scripts/17_bonnie_multithread.py
Executable file
41
tests/test_scripts/17_bonnie_multithread.py
Executable file
@@ -0,0 +1,41 @@
|
||||
#! /usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2009-2011 by Bjoern Kolbeck, Minor Gordon, Zuse Institute Berlin
|
||||
# 2013 by Christoph Kleineweber, Zuse Institute Berlin
|
||||
# Licensed under the BSD License, see LICENSE file for details.
|
||||
|
||||
|
||||
import unittest, subprocess, sys, os
|
||||
|
||||
|
||||
class bonnieTest(unittest.TestCase):
|
||||
def __init__( self, direct_io=True, stdout=sys.stdout, stderr=sys.stderr, *args, **kwds ):
|
||||
unittest.TestCase.__init__( self )
|
||||
self.direct_io = direct_io
|
||||
self.stdout = stdout
|
||||
self.stderr = stderr
|
||||
|
||||
def runTest( self ):
|
||||
if self.direct_io:
|
||||
args = "bonnie++ -c 10 -d ." # -s 100"
|
||||
p = subprocess.Popen( args, shell=True, stdout=self.stdout, stderr=self.stderr )
|
||||
retcode = p.wait()
|
||||
# self.assertEqual( retcode, 0 )
|
||||
else:
|
||||
print >>self.stdout, self.__class__.__name__ + ": skipping nondirect volume", os.getcwd()
|
||||
|
||||
|
||||
def createTestSuite( *args, **kwds ):
|
||||
if not sys.platform.startswith( "win" ):
|
||||
return unittest.TestSuite( [bonnieTest( *args, **kwds )] )
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if not sys.platform.startswith( "win" ):
|
||||
result = unittest.TextTestRunner( verbosity=2 ).run( createTestSuite() )
|
||||
if not result.wasSuccessful():
|
||||
sys.exit(1)
|
||||
else:
|
||||
print sys.modules[__name__].__file__.split( os.sep )[-1], "not supported on Windows"
|
||||
|
||||
132
tests/test_scripts/18_view_renewal.py
Executable file
132
tests/test_scripts/18_view_renewal.py
Executable file
@@ -0,0 +1,132 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2014 by Johannes Dillmann, Zuse Institute Berlin
|
||||
# Licensed under the BSD License, see LICENSE file for details.
|
||||
|
||||
from os import path, getcwd, remove, rmdir
|
||||
import subprocess
|
||||
import argparse
|
||||
from tempfile import mkdtemp, mkstemp
|
||||
from time import sleep
|
||||
|
||||
|
||||
# Parse the Arguments
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("xtreemfs_dir")
|
||||
parser.add_argument("dir_url")
|
||||
parser.add_argument("mrc_url")
|
||||
parser.add_argument("test_dir")
|
||||
|
||||
args = parser.parse_args()
|
||||
dir_url = args.dir_url.rstrip("/")
|
||||
|
||||
# Parse the volume name and the test name from the directory structure
|
||||
test_name = path.basename(getcwd())
|
||||
volume_name = path.basename(path.dirname(getcwd()))
|
||||
|
||||
# Paths of the used tools
|
||||
xtfsutil = path.join(args.xtreemfs_dir, "bin", "xtfsutil")
|
||||
mount_xtreemfs = path.join(args.xtreemfs_dir, "bin", "mount.xtreemfs")
|
||||
umount_xtreemfs = path.join(args.xtreemfs_dir, "bin", "umount.xtreemfs")
|
||||
|
||||
# Store the paths to the control and the temp mountpoints
|
||||
tmpdir = mkdtemp(prefix="xtfs")
|
||||
mnt_path = path.join(tmpdir, test_name)
|
||||
ctrl_path = getcwd()
|
||||
|
||||
|
||||
#################################
|
||||
# Test transparent view renewal #
|
||||
#################################
|
||||
|
||||
# Mount the volume at a temp dir
|
||||
subprocess.check_call([mount_xtreemfs,
|
||||
"--max-view-renewals", "0",
|
||||
"--retry-delay", "1",
|
||||
dir_url + "/" + volume_name, tmpdir])
|
||||
|
||||
# Create the file and write some ascii 1.
|
||||
file_name = "test1"
|
||||
file_mnt = path.join(mnt_path, file_name)
|
||||
file_ctrl = path.join(ctrl_path, file_name)
|
||||
with open(file_ctrl, "w", 0) as f:
|
||||
f.write("1111")
|
||||
|
||||
# Make it read only replicated
|
||||
subprocess.check_call([xtfsutil, "-r", "RONLY", file_ctrl])
|
||||
|
||||
try:
|
||||
# Reopen the tmp mounted file unbuffered and read after the view was
|
||||
# changed on the control volume
|
||||
with open(file_mnt, "r", 0) as f:
|
||||
|
||||
# Add a replica to assert the XLocSet version increases.
|
||||
subprocess.check_call([xtfsutil, "-a", file_ctrl])
|
||||
|
||||
# Try to read from the file and assert its content is the same.
|
||||
result = f.read(1)
|
||||
assert result == "1", "Read returned wrong file contents."
|
||||
finally:
|
||||
# Cleanup
|
||||
subprocess.call([umount_xtreemfs, tmpdir])
|
||||
remove(file_ctrl)
|
||||
|
||||
|
||||
#######################################################
|
||||
# Test error on invalid view (with renewals disabled) #
|
||||
#######################################################
|
||||
|
||||
# Mount the volume at a temp dir and log its output
|
||||
_, logfile = mkstemp(suffix=".log", prefix=tmpdir)
|
||||
subprocess.check_call([mount_xtreemfs,
|
||||
"--max-view-renewals", "1",
|
||||
"--retry-delay", "1",
|
||||
"-l", logfile, "-d", "WARNING",
|
||||
dir_url + "/" + volume_name, tmpdir])
|
||||
|
||||
# Create the file and write some ascii 1.
|
||||
file_name = "test2"
|
||||
file_mnt = path.join(mnt_path, file_name)
|
||||
file_ctrl = path.join(ctrl_path, file_name)
|
||||
with open(file_ctrl, "w", 0) as f:
|
||||
f.write("1111")
|
||||
|
||||
# Make it read only replicated
|
||||
subprocess.check_call([xtfsutil, "-r", "RONLY", file_ctrl])
|
||||
|
||||
try:
|
||||
# Reopen the tmp mounted file unbuffered and read after the view was
|
||||
# changed on the control volume
|
||||
with open(file_mnt, "r", 0) as f:
|
||||
|
||||
# Add a replica to assert the XLocSet version increases.
|
||||
subprocess.check_call([xtfsutil, "-a", file_ctrl])
|
||||
|
||||
# Try to read from the file and assert its content is the same.
|
||||
# Should throw IOError
|
||||
result = f.read(1)
|
||||
|
||||
assert False, "The Filehandle should be invalid due to the new view"
|
||||
|
||||
except IOError as e:
|
||||
assert True
|
||||
finally:
|
||||
# Cleanup
|
||||
subprocess.call([umount_xtreemfs, tmpdir])
|
||||
remove(file_ctrl)
|
||||
|
||||
view_error = False
|
||||
with open(logfile, "r") as f:
|
||||
for line in f:
|
||||
view_error = view_error or (
|
||||
"denied the requested operation because the clients view is "
|
||||
"outdated. The request will be retried once the view is renewed."
|
||||
in line)
|
||||
|
||||
|
||||
# Cleanup tmpfiles
|
||||
remove(logfile)
|
||||
rmdir(tmpdir)
|
||||
|
||||
assert view_error, "View error should have occured"
|
||||
22
tests/test_scripts/cpp_unit_tests.sh
Executable file
22
tests/test_scripts/cpp_unit_tests.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2013 by Michael Berlin, Zuse Institute Berlin
|
||||
#
|
||||
# Licensed under the BSD License, see LICENSE file for details.
|
||||
|
||||
# This test executes all C++ unit tests. Make sure that you did run
|
||||
# export BUILD_CLIENT_TESTS=true before running "make client_debug".
|
||||
# Otherwise, the unit tests won't be built.
|
||||
|
||||
set -e
|
||||
|
||||
XTREEMFS_DIR="$1"
|
||||
|
||||
cd "$XTREEMFS_DIR"
|
||||
|
||||
export XTREEMFS_DIR_URL="$2"
|
||||
export XTREEMFS_MRC_URL="$3"
|
||||
export XTREEMFS_TEST_DIR="$4"
|
||||
|
||||
cd cpp/build
|
||||
make test
|
||||
95
tests/test_scripts/cpp_unit_tests_valgrind.sh
Executable file
95
tests/test_scripts/cpp_unit_tests_valgrind.sh
Executable file
@@ -0,0 +1,95 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2014 by Michael Berlin, Zuse Institute Berlin
|
||||
#
|
||||
# Licensed under the BSD License, see LICENSE file for details.
|
||||
|
||||
# This test runs all C++ unit tests through Valgrind which will check for
|
||||
# memory leaks.
|
||||
#
|
||||
# Make sure that you did run export BUILD_CLIENT_TESTS=true before running
|
||||
# "make client_debug". Otherwise, the unit tests won't be built.
|
||||
|
||||
set -e
|
||||
|
||||
function warn_missing_url() {
|
||||
cat <<EOF
|
||||
INFO: URL to XtreemFS $1 not given as $2 parameter.
|
||||
|
||||
INFO: Tests will use the default URL at localhost and the default port.
|
||||
INFO: Make sure to run an XtreemFS setup on this address or specify a different URL as argument.
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
hash valgrind 2>/dev/null || {
|
||||
echo "ERROR: valgrind not found, but required by this test."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Parse arguments.
|
||||
TEST_DIR=$4
|
||||
if [ -z $TEST_DIR ]
|
||||
then
|
||||
TEST_DIR=/tmp/xtreemfs-cpp-valgrind
|
||||
if [ ! -d "$TEST_DIR" ]; then mkdir "$TEST_DIR"; fi
|
||||
if [ ! -d "${TEST_DIR}/log" ]; then mkdir "${TEST_DIR}/log"; fi
|
||||
fi
|
||||
export XTREEMFS_TEST_DIR="$TEST_DIR"
|
||||
echo "INFO: TEST_DIR: $TEST_DIR"
|
||||
VALGRIND_LOG_FILE="${TEST_DIR}/log/valgrind.log"
|
||||
|
||||
if [ -n "$1" ]
|
||||
then
|
||||
XTREEMFS_DIR="$1"
|
||||
else
|
||||
# Try to guess the path of the XtreemFS repository.
|
||||
[ -d "cpp" ] && XTREEMFS_DIR="."
|
||||
[ -d "../cpp" ] && XTREEMFS_DIR=".."
|
||||
[ -d "../../cpp" ] && XTREEMFS_DIR="../.."
|
||||
if [ -n "$XTREEMFS_DIR" ]
|
||||
then
|
||||
echo "INFO: Path to XtreemFS repository auto-detected and set to: ${XTREEMFS_DIR}"
|
||||
else
|
||||
echo "ERROR: Path to XtreemFS repository not found. Set it as first parameter. Aborting."
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$2" ]
|
||||
then
|
||||
export XTREEMFS_DIR_URL="$2"
|
||||
else
|
||||
warn_missing_url "DIR" "second"
|
||||
fi
|
||||
if [ -n "$3" ]
|
||||
then
|
||||
export XTREEMFS_MRC_URL="$3"
|
||||
else
|
||||
warn_missing_url "MRC" "third"
|
||||
fi
|
||||
|
||||
# Run tests
|
||||
cd "$XTREEMFS_DIR"
|
||||
cd cpp/build
|
||||
|
||||
global_rc=0
|
||||
for test in test_*
|
||||
do
|
||||
set +e
|
||||
valgrind --leak-check=full --show-reachable=yes --error-exitcode=23 --suppressions="${XTREEMFS_DIR}/cpp/valgrind.supp" ./$test &>>$VALGRIND_LOG_FILE
|
||||
rc=$?
|
||||
set -e
|
||||
# Add some whitespace to the logfile between runs.
|
||||
echo -e "\n\n\n" >> $VALGRIND_LOG_FILE
|
||||
|
||||
if [ $rc -eq 0 ]
|
||||
then
|
||||
echo "Valgrind memory-leak check PASSED for: $test"
|
||||
else
|
||||
echo "Valgrind memory-leak check FAILED for: $test"
|
||||
global_rc=1
|
||||
fi
|
||||
done
|
||||
|
||||
exit $global_rc
|
||||
BIN
tests/test_scripts/dbench-client.txt.gz
Normal file
BIN
tests/test_scripts/dbench-client.txt.gz
Normal file
Binary file not shown.
13
tests/test_scripts/fsx.sh
Executable file
13
tests/test_scripts/fsx.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
XTREEMFS_DIR=$1
|
||||
|
||||
if [ ! -e ${XTREEMFS_DIR}/tests/utils/fsx.bin ]
|
||||
then
|
||||
echo "Compiling fsx.bin..."
|
||||
current_dir=`pwd`
|
||||
cd ${XTREEMFS_DIR}/tests/utils
|
||||
gcc -o fsx.bin ltp-fsx.c
|
||||
cd $current_dir
|
||||
fi
|
||||
|
||||
${XTREEMFS_DIR}/tests/utils/fsx.bin -R -W -N 100000 ./fsx.tmpfile
|
||||
250
tests/test_scripts/hadoop2_test.sh
Executable file
250
tests/test_scripts/hadoop2_test.sh
Executable file
@@ -0,0 +1,250 @@
|
||||
#!/bin/bash
|
||||
|
||||
XTREEMFS=$1
|
||||
TEST_DIR=$4
|
||||
HADOOP_VERSIONS="2.6.0"
|
||||
VOLUME="$(basename $(dirname $(pwd)))"
|
||||
|
||||
for VERSION in $HADOOP_VERSIONS; do
|
||||
|
||||
echo "Test XtreemFS with hadoop $VERSION"
|
||||
|
||||
#download and extract hadoop
|
||||
echo "Download Hadoop $VERSION..."
|
||||
wget -nv -O $TEST_DIR/hadoop-$VERSION.tar.gz http://archive.apache.org/dist/hadoop/core/hadoop-$VERSION/hadoop-$VERSION.tar.gz
|
||||
VOLUME_DIR=$PWD
|
||||
cd $TEST_DIR
|
||||
echo "Extract Hadoop $VERSION..."
|
||||
tar -zxf $TEST_DIR/hadoop-$VERSION.tar.gz
|
||||
rm -rf $TEST_DIR/hadoop-$VERSION.tar.gz
|
||||
cd $VOLUME_DIR
|
||||
|
||||
#configure hadoop
|
||||
export HADOOP_PREFIX=$TEST_DIR/hadoop-$VERSION
|
||||
echo "Set HADOOP_PREFIX=$HADOOP_PREFIX"
|
||||
|
||||
export HADOOP_MAPRED_HOME=$HADOOP_PREFIX
|
||||
export HADOOP_COMMON_HOME=$HADOOP_PREFIX
|
||||
export HADOOP_HDFS_HOME=$HADOOP_PREFIX
|
||||
export YARN_HOME=$HADOOP_PREFIX
|
||||
|
||||
export HADOOP_CONF_DIR=$HADOOP_PREFIX/etc/hadoop
|
||||
echo "Set HADOOP_CONF_DIR=$HADOOP_CONF_DIR"
|
||||
|
||||
export HADOOP_LOG_DIR="$TEST_DIR/log/hadoop.log"
|
||||
echo "Set HADOOP_LOG_DIR=$HADOOP_LOG_DIR"
|
||||
|
||||
echo "Copy XtreeemFSHadoopClient.jar to $HADOOP_PREFIX/share/hadoop/common"
|
||||
cp $XTREEMFS/contrib/hadoop/dist/XtreemFSHadoopClient.jar $HADOOP_PREFIX/share/hadoop/common
|
||||
|
||||
echo "configure core-site.xml"
|
||||
|
||||
CORE_SITE="
|
||||
<configuration>
|
||||
|
||||
<property>
|
||||
<name>fs.xtreemfs.impl</name>
|
||||
<value>org.xtreemfs.common.clients.hadoop.XtreemFSFileSystem</value>
|
||||
<description>The file system for xtreemfs: URIs.</description>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>fs.AbstractFileSystem.xtreemfs.impl</name>
|
||||
<value>org.xtreemfs.common.clients.hadoop.XtreemFS</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>fs.default.name</name>
|
||||
<value>xtreemfs://localhost:32638</value>
|
||||
<description>Address for the DIR.</description>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>xtreemfs.defaultVolumeName</name>
|
||||
<value>$VOLUME</value>
|
||||
<description>Name of the volume to use within XtreemFS.</description>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>xtreemfs.client.debug</name>
|
||||
<value>false</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>io.file.buffer.size</name>
|
||||
<value>131072</value>
|
||||
<description>Default buffer size when accessing files.</description>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>xtreemfs.io.read.buffer</name>
|
||||
<value>false</value>
|
||||
<description>
|
||||
Enable/Disable the read buffer in theXtreemFSHadoopClient
|
||||
</description>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>xtreemfs.io.buffer.size.read</name>
|
||||
<value>64</value>
|
||||
<description>
|
||||
Buffer size of the read buffer in the XtreemFSHadoopClient
|
||||
</description>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>xtreemfs.io.write.buffer</name>
|
||||
<value>false</value>
|
||||
<description>
|
||||
Enable/Disable the write buffer in the XtreemFSHadoopClient
|
||||
</description>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>xtreemfs.io.buffer.size.write</name>
|
||||
<value>64</value>
|
||||
<description>
|
||||
Buffer size of the write buffer in the XtreemFSHadoopClient
|
||||
</description>
|
||||
</property>
|
||||
|
||||
</configuration>"
|
||||
|
||||
echo $CORE_SITE > $HADOOP_CONF_DIR/core-site.xml
|
||||
|
||||
echo "configure mapred-site.xml"
|
||||
|
||||
MAPRED_SITE="
|
||||
<configuration>
|
||||
|
||||
<property>
|
||||
<name>mapred.job.tracker</name>
|
||||
<value>localhost:9001</value>
|
||||
<description>Listening address for the JobTracker.</description>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>mapreduce.framework.name</name>
|
||||
<value>yarn</value>
|
||||
</property>
|
||||
|
||||
</configuration>"
|
||||
|
||||
echo $MAPRED_SITE > $HADOOP_CONF_DIR/mapred-site.xml
|
||||
|
||||
echo "configure yarn-site.xml"
|
||||
|
||||
YARN_SITE="
|
||||
<configuration>
|
||||
|
||||
<property>
|
||||
<name>yarn.nodemanager.aux-services</name>
|
||||
<value>mapreduce_shuffle</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>yarn.nodemanager.aux-services.mapreduce_shuffle.class</name>
|
||||
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
|
||||
</property>
|
||||
|
||||
</configuration>"
|
||||
|
||||
echo $YARN_SITE > $HADOOP_CONF_DIR/yarn-site.xml
|
||||
|
||||
#prepare input
|
||||
mkdir input
|
||||
|
||||
wget -nv http://www.gutenberg.org/ebooks/76.txt.utf-8
|
||||
iconv -c -f utf-8 -t ascii 76.txt.utf-8 > test.txt
|
||||
|
||||
#test hadoop fs shell
|
||||
if [ -z "$($HADOOP_PREFIX/bin/hadoop fs -ls /hadoop2_test | grep test.txt)" ]
|
||||
then echo "hadoop fs -ls does not show test file!"; RESULT=-1;
|
||||
fi
|
||||
|
||||
$HADOOP_PREFIX/bin/hadoop fs -copyFromLocal test.txt /hadoop2_test/input/
|
||||
|
||||
if [ -z "$(ls | grep test.txt)" ]
|
||||
then echo "ls does not show test file!"; RESULT=-1;
|
||||
fi
|
||||
|
||||
#run simple hadoop-job
|
||||
|
||||
echo "Start NodeManager, ResourceManager and JobHistoryServer..."
|
||||
$HADOOP_PREFIX/sbin/yarn-daemon.sh start nodemanager
|
||||
$HADOOP_PREFIX/sbin/yarn-daemon.sh start resourcemanager
|
||||
$HADOOP_PREFIX/sbin/mr-jobhistory-daemon.sh start historyserver
|
||||
#wait for complete start up
|
||||
sleep 10s
|
||||
|
||||
if [[ -z "$(jps | grep NodeManager)" || -z "$(jps | grep ResourceManager)" || -z "$(jps | grep JobHistoryServer)" ]]
|
||||
then echo "Hadoop start up failed!"; RESULT=-1;
|
||||
else
|
||||
echo "Run wordcount without buffer..."
|
||||
$HADOOP_PREFIX/bin/hadoop jar $HADOOP_PREFIX/share/hadoop/mapreduce/hadoop-mapreduce-examples-$VERSION.jar wordcount /hadoop2_test/input /hadoop2_test/output
|
||||
|
||||
if [ -z "$($HADOOP_PREFIX/bin/mapred job -list all | grep _0001.*SUCCEEDED)" ]
|
||||
then echo "Hadoop job without buffer failed!"; RESULT=-1;
|
||||
else echo "Hadoop job without buffer was successfull";
|
||||
|
||||
#verify output
|
||||
sed "s/^\(.*\)[[:space:]*]\(.*\)/\2 \1/" output/part-r-00000 | sort -bnr > hadoop_tmp.txt
|
||||
cat input/test.txt | tr -s [:space:] '\n' | grep -v "^\s*$" | sort | uniq -c | sort -bnr > cross_check.txt
|
||||
if [ -n "$(diff -w hadoop_tmp.txt cross_check.txt)" ]
|
||||
then echo "Hadoop produced wrong output!"; RESULT=-1;
|
||||
fi
|
||||
fi
|
||||
$HADOOP_PREFIX/bin/hadoop fs -rm -r /hadoop2_test/output
|
||||
|
||||
echo "Run wordcount with buffer..."
|
||||
$HADOOP_PREFIX/bin/hadoop jar $HADOOP_PREFIX/share/hadoop/mapreduce/hadoop-mapreduce-examples-$VERSION.jar wordcount -D xtreemfs.io.read.buffer=true -D xtreemfs.io.write.buffer=true /hadoop2_test/input /hadoop2_test/output
|
||||
|
||||
|
||||
if [ -z "$($HADOOP_PREFIX/bin/mapred job -list all | grep _0002.*SUCCEEDED)" ]
|
||||
then echo "Hadoop job with buffer failed!"; RESULT=-1;
|
||||
else
|
||||
echo "Hadoop job with buffer was successfull"
|
||||
|
||||
#verify output
|
||||
sed "s/^\(.*\)[[:space:]*]\(.*\)/\2 \1/" output/part-r-00000 | sort -bnr > hadoop_tmp.txt
|
||||
cat input/test.txt | tr -s [:space:] '\n' | grep -v "^\s*$" | sort | uniq -c | sort -bnr > cross_check.txt
|
||||
if [ -n "$(diff -w hadoop_tmp.txt cross_check.txt)" ]
|
||||
then echo "Hadoop produced wrong output!"; RESULT=-1;
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Stop Hadoop..."
|
||||
$HADOOP_PREFIX/sbin/yarn-daemon.sh stop nodemanager
|
||||
$HADOOP_PREFIX/sbin/yarn-daemon.sh stop resourcemanager
|
||||
$HADOOP_PREFIX/sbin/mr-jobhistory-daemon.sh stop historyserver
|
||||
|
||||
# check if servers stop
|
||||
if [ -n "$(jps | grep NodeManager)" ]
|
||||
then
|
||||
echo "NodeManager does not stop, kill manually"
|
||||
NODEMANAGER_PID=$(jps | grep NodeManager | cut -d ' ' -f1)
|
||||
kill $NODEMANAGER_PID
|
||||
fi
|
||||
|
||||
if [ -n "$(jps | grep ResourceManager)" ]
|
||||
then
|
||||
echo "ResourceManager does not stop, kill manually"
|
||||
RESOURCEMANAGER_PID=$(jps | grep ResourceManager | cut -d ' ' -f1)
|
||||
kill $RESOURCEMANAGER_PID
|
||||
fi
|
||||
|
||||
if [ -n "$(jps | grep JobHistoryServer)" ]
|
||||
then
|
||||
echo "JobHistoryServer does not stop, kill manually"
|
||||
HISTORYSERVER_PID=$(jps | grep JobHistoryServer | cut -d ' ' -f1)
|
||||
kill $HISTORYSERVER_PID
|
||||
fi
|
||||
#kill all remaining child processes
|
||||
CHILD_PIDS=$(jps | grep Child | cut -d ' ' -f1)
|
||||
if [ -n "$CHILD_PIDS" ]
|
||||
then kill $CHILD_PIDS
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
exit $RESULT
|
||||
195
tests/test_scripts/hadoop_ssl_test.sh
Executable file
195
tests/test_scripts/hadoop_ssl_test.sh
Executable file
@@ -0,0 +1,195 @@
|
||||
#!/bin/bash
|
||||
|
||||
XTREEMFS=$1
|
||||
TEST_DIR=$4
|
||||
HADOOP_VERSIONS="1.2.1"
|
||||
VOLUME="$(basename $(dirname $(pwd)))"
|
||||
|
||||
for VERSION in $HADOOP_VERSIONS; do
|
||||
|
||||
echo "Test XtreemFS with hadoop $VERSION"
|
||||
|
||||
#download and extract hadoop
|
||||
echo "Download Hadoop $VERSION..."
|
||||
wget -nv -O $TEST_DIR/hadoop-$VERSION.tar.gz http://archive.apache.org/dist/hadoop/core/hadoop-$VERSION/hadoop-$VERSION.tar.gz
|
||||
VOLUME_DIR=$PWD
|
||||
cd $TEST_DIR
|
||||
echo "Extract Hadoop $VERSION..."
|
||||
tar -zxf $TEST_DIR/hadoop-$VERSION.tar.gz
|
||||
rm -rf $TEST_DIR/hadoop-$VERSION.tar.gz
|
||||
cd $VOLUME_DIR
|
||||
|
||||
#configure hadoop
|
||||
|
||||
export HADOOP_PREFIX=$TEST_DIR/hadoop-$VERSION
|
||||
echo "Set HADOOP_PREFIX=$HADOOP_PREFIX"
|
||||
|
||||
export HADOOP_CONF_DIR=$HADOOP_PREFIX/conf/
|
||||
echo "Set HADOOP_CONF_DIR=$HADOOP_CONF_DIR"
|
||||
|
||||
export HADOOP_LOG_DIR="$TEST_DIR/log/hadoop.log"
|
||||
echo "Set HADOOP_LOG_DIR=$HADOOP_LOG_DIR"
|
||||
|
||||
|
||||
echo "Copy XtreeemFSHadoopClient.jar to $HADOOP_PREFIX/lib/"
|
||||
cp $XTREEMFS/contrib/hadoop/dist/XtreemFSHadoopClient.jar $HADOOP_PREFIX/lib/
|
||||
|
||||
echo "configure core-site.xml"
|
||||
|
||||
CORE_SITE="
|
||||
<configuration>
|
||||
|
||||
<property>
|
||||
<name>fs.xtreemfs.impl</name>
|
||||
<value>org.xtreemfs.common.clients.hadoop.XtreemFSFileSystem</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>fs.default.name</name>
|
||||
<value>xtreemfs://localhost:32638</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>xtreemfs.defaultVolumeName</name>
|
||||
<value>$VOLUME</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>xtreemfs.client.debug</name>
|
||||
<value>false</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>io.file.buffer.size</name>
|
||||
<value>131072</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>xtreemfs.io.read.buffer</name>
|
||||
<value>false</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>xtreemfs.io.buffer.size.read</name>
|
||||
<value>64</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>xtreemfs.io.write.buffer</name>
|
||||
<value>false</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>xtreemfs.io.buffer.size.write</name>
|
||||
<value>64</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>xtreemfs.ssl.enabled</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>xtreemfs.ssl.credentialFile</name>
|
||||
<value>$XTREEMFS/tests/certs/Client.p12</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>xtreemfs.ssl.credentialFile.passphrase</name>
|
||||
<value>passphrase</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>xtreemfs.ssl.trustedCertificatesFile</name>
|
||||
<value>$XTREEMFS/tests/certs/trusted.jks</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>xtreemfs.ssl.trustedCertificatesFile.passphrase</name>
|
||||
<value>passphrase</value>
|
||||
</property>
|
||||
|
||||
</configuration>"
|
||||
|
||||
echo $CORE_SITE > $HADOOP_PREFIX/conf/core-site.xml
|
||||
|
||||
echo "configure mapred-site.xml"
|
||||
|
||||
MAPRED_SITE="
|
||||
<configuration>
|
||||
|
||||
<property>
|
||||
<name>mapred.job.tracker</name>
|
||||
<value>localhost:9001</value>
|
||||
</property>
|
||||
|
||||
</configuration>"
|
||||
|
||||
echo $MAPRED_SITE > $HADOOP_PREFIX/conf/mapred-site.xml
|
||||
|
||||
#prepare input
|
||||
mkdir input
|
||||
|
||||
wget -nv -O test.txt http://www.gutenberg.org/cache/epub/1661/pg1661.txt
|
||||
|
||||
#test hadoop fs shell
|
||||
if [ -z "$($HADOOP_PREFIX/bin/hadoop fs -ls /hadoop_with_ssl_test | grep test.txt)" ]
|
||||
then echo hadoop fs -ls does not show test file!; RESULT=-1;
|
||||
fi
|
||||
|
||||
$HADOOP_PREFIX/bin/hadoop fs -copyFromLocal test.txt /hadoop_with_ssl_test/input/
|
||||
|
||||
if [ -z "$(ls | grep test.txt)" ]
|
||||
then echo ls does not show test file!; RESULT=-1;
|
||||
fi
|
||||
|
||||
#run simple hadoop-job
|
||||
|
||||
echo "Start JobTracker and TaskTracker..."
|
||||
$HADOOP_PREFIX/bin/hadoop-daemon.sh start jobtracker
|
||||
$HADOOP_PREFIX/bin/hadoop-daemon.sh start tasktracker
|
||||
#wait for complete start up
|
||||
sleep 10s
|
||||
|
||||
if [[ -z "$(jps | grep TaskTracker)" || -z "$(jps | grep JobTracker)" ]]
|
||||
then echo "Hadoop start up failed!"; RESULT=-1;
|
||||
else
|
||||
echo "Run wordcount"
|
||||
$HADOOP_PREFIX/bin/hadoop jar $HADOOP_PREFIX/hadoop-examples-$VERSION.jar wordcount /hadoop_with_ssl_test/input /hadoop_with_ssl_test/output
|
||||
|
||||
JOB_STATUS=$($HADOOP_PREFIX/bin/hadoop job -list all | grep _0001 | cut -c 23)
|
||||
if [ "$JOB_STATUS" != "2" ]
|
||||
then echo "Hadoop job without buffer failed!"; RESULT=-1;
|
||||
else echo "Hadoop job without buffer was successfull";
|
||||
fi
|
||||
|
||||
$HADOOP_PREFIX/bin/hadoop fs -rmr /hadoop_with_ssl_test/output
|
||||
|
||||
echo "Stop JobTracker and TaskTracker..."
|
||||
$HADOOP_PREFIX/bin/hadoop-daemon.sh stop jobtracker
|
||||
$HADOOP_PREFIX/bin/hadoop-daemon.sh stop tasktracker
|
||||
|
||||
# check if JobTacker and TaskTracker stop
|
||||
if [ -n "$(jps | grep TaskTracker)" ]
|
||||
then
|
||||
echo "TaskTracker does not stop, kill manually"
|
||||
TASKTRACKER_PID=$(jps | grep TaskTracker | cut -d ' ' -f1)
|
||||
kill $TASKTRACKER_PID
|
||||
fi
|
||||
|
||||
if [ -n "$(jps | grep JobTracker)" ]
|
||||
then
|
||||
echo "JobTracker does not stop, kill manually"
|
||||
JOBTRACKER_PID=$(jps | grep JobTracker | cut -d ' ' -f1)
|
||||
kill $JOBTRACKER_PID
|
||||
fi
|
||||
|
||||
#kill all remaining child processes
|
||||
CHILD_PIDS=$(jps | grep Child | cut -d ' ' -f1)
|
||||
if [ -n "$CHILD_PIDS" ]
|
||||
then kill $CHILD_PIDS
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
exit $RESULT
|
||||
216
tests/test_scripts/hadoop_test.sh
Executable file
216
tests/test_scripts/hadoop_test.sh
Executable file
@@ -0,0 +1,216 @@
|
||||
#!/bin/bash
|
||||
|
||||
XTREEMFS=$1
|
||||
TEST_DIR=$4
|
||||
HADOOP_VERSIONS="1.2.1"
|
||||
VOLUME="$(basename $(dirname $(pwd)))"
|
||||
|
||||
echo "Prepare hadoop input"
|
||||
|
||||
for VERSION in $HADOOP_VERSIONS; do
|
||||
|
||||
echo "Test XtreemFS with hadoop $VERSION"
|
||||
|
||||
#download and extract hadoop
|
||||
echo "Download Hadoop $VERSION..."
|
||||
wget -nv -O $TEST_DIR/hadoop-$VERSION.tar.gz http://archive.apache.org/dist/hadoop/core/hadoop-$VERSION/hadoop-$VERSION.tar.gz
|
||||
VOLUME_DIR=$PWD
|
||||
cd $TEST_DIR
|
||||
echo "Extract Hadoop $VERSION..."
|
||||
tar -zxf $TEST_DIR/hadoop-$VERSION.tar.gz
|
||||
rm -rf $TEST_DIR/hadoop-$VERSION.tar.gz
|
||||
cd $VOLUME_DIR
|
||||
|
||||
#configure hadoop
|
||||
|
||||
export HADOOP_PREFIX=$TEST_DIR/hadoop-$VERSION
|
||||
echo "Set HADOOP_PREFIX=$HADOOP_PREFIX"
|
||||
|
||||
export HADOOP_CONF_DIR=$HADOOP_PREFIX/conf/
|
||||
echo "Set HADOOP_CONF_DIR=$HADOOP_CONF_DIR"
|
||||
|
||||
export HADOOP_LOG_DIR="$TEST_DIR/log/hadoop.log"
|
||||
echo "Set HADOOP_LOG_DIR=$HADOOP_LOG_DIR"
|
||||
|
||||
|
||||
echo "Copy XtreeemFSHadoopClient.jar to $HADOOP_PREFIX/lib/"
|
||||
cp $XTREEMFS/contrib/hadoop/dist/XtreemFSHadoopClient.jar $HADOOP_PREFIX/lib/
|
||||
|
||||
echo "configure core-site.xml"
|
||||
|
||||
CORE_SITE="
|
||||
<configuration>
|
||||
|
||||
<property>
|
||||
<name>fs.xtreemfs.impl</name>
|
||||
<value>org.xtreemfs.common.clients.hadoop.XtreemFSFileSystem</value>
|
||||
<description>The file system for xtreemfs: URIs.</description>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>fs.default.name</name>
|
||||
<value>xtreemfs://localhost:32638</value>
|
||||
<description>Address for the DIR.</description>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>xtreemfs.defaultVolumeName</name>
|
||||
<value>$VOLUME</value>
|
||||
<description>Name of the volume to use within XtreemFS.</description>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>xtreemfs.client.debug</name>
|
||||
<value>false</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>io.file.buffer.size</name>
|
||||
<value>131072</value>
|
||||
<description>Default buffer size when accessing files.</description>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>xtreemfs.io.read.buffer</name>
|
||||
<value>false</value>
|
||||
<description>
|
||||
Enable/Disable the read buffer in theXtreemFSHadoopClient
|
||||
</description>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>xtreemfs.io.buffer.size.read</name>
|
||||
<value>64</value>
|
||||
<description>
|
||||
Buffer size of the read buffer in the XtreemFSHadoopClient
|
||||
</description>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>xtreemfs.io.write.buffer</name>
|
||||
<value>false</value>
|
||||
<description>
|
||||
Enable/Disable the write buffer in the XtreemFSHadoopClient
|
||||
</description>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>xtreemfs.io.buffer.size.write</name>
|
||||
<value>64</value>
|
||||
<description>
|
||||
Buffer size of the write buffer in the XtreemFSHadoopClient
|
||||
</description>
|
||||
</property>
|
||||
|
||||
</configuration>"
|
||||
|
||||
echo $CORE_SITE > $HADOOP_PREFIX/conf/core-site.xml
|
||||
|
||||
echo "configure mapred-site.xml"
|
||||
|
||||
MAPRED_SITE="
|
||||
<configuration>
|
||||
|
||||
<property>
|
||||
<name>mapred.job.tracker</name>
|
||||
<value>localhost:9001</value>
|
||||
<description>Listening address for the JobTracker.</description>
|
||||
</property>
|
||||
|
||||
</configuration>"
|
||||
|
||||
echo $MAPRED_SITE > $HADOOP_PREFIX/conf/mapred-site.xml
|
||||
|
||||
#prepare input
|
||||
mkdir input
|
||||
|
||||
wget -nv -O test.txt http://www.gutenberg.org/cache/epub/1661/pg1661.txt
|
||||
|
||||
#test hadoop fs shell
|
||||
if [ -z "$($HADOOP_PREFIX/bin/hadoop fs -ls /hadoop_test | grep test.txt)" ]
|
||||
then echo hadoop fs -ls does not show test file!; RESULT=-1;
|
||||
fi
|
||||
|
||||
$HADOOP_PREFIX/bin/hadoop fs -copyFromLocal test.txt /hadoop_test/input/
|
||||
|
||||
if [ -z "$(ls | grep test.txt)" ]
|
||||
then echo ls does not show test file!; RESULT=-1;
|
||||
fi
|
||||
|
||||
#run simple hadoop-job
|
||||
|
||||
echo "Start JobTracker and TaskTracker..."
|
||||
$HADOOP_PREFIX/bin/hadoop-daemon.sh start jobtracker
|
||||
$HADOOP_PREFIX/bin/hadoop-daemon.sh start tasktracker
|
||||
#wait for complete start up
|
||||
sleep 10s
|
||||
|
||||
if [[ -z "$(jps | grep TaskTracker)" || -z "$(jps | grep JobTracker)" ]]
|
||||
then echo "Hadoop start up failed!"; RESULT=-1;
|
||||
else
|
||||
echo "Run wordcount without buffer..."
|
||||
$HADOOP_PREFIX/bin/hadoop jar $HADOOP_PREFIX/hadoop-examples-$VERSION.jar wordcount /hadoop_test/input /hadoop_test/output
|
||||
|
||||
JOB_STATUS=$($HADOOP_PREFIX/bin/hadoop job -list all | grep _0001 | cut -c 23)
|
||||
if [ "$JOB_STATUS" != "2" ]
|
||||
then echo "Hadoop job without buffer failed!"; RESULT=-1;
|
||||
else echo "Hadoop job without buffer was successfull";
|
||||
|
||||
#verify output
|
||||
sed "s/^\(.*\)[[:space:]*]\(.*\)/\2 \1/" output/part-r-00000 | sort -bnr > hadoop_tmp.txt
|
||||
cat input/test.txt | tr -s [:space:] '\n' | grep -v "^\s*$" | sort | uniq -c | sort -bnr > cross_check.txt
|
||||
if [ -n "$(diff -w hadoop_tmp.txt cross_check.txt)" ]
|
||||
then echo "Hadoop produced wrong output!"; RESULT=-1;
|
||||
fi
|
||||
fi
|
||||
|
||||
$HADOOP_PREFIX/bin/hadoop fs -rmr /hadoop_test/output
|
||||
|
||||
echo "Run wordcount with buffer..."
|
||||
$HADOOP_PREFIX/bin/hadoop jar $HADOOP_PREFIX/hadoop-examples-$VERSION.jar wordcount -D xtreemfs.io.read.buffer=true -D xtreemfs.io.write.buffer=true /hadoop_test/input /hadoop_test/output
|
||||
|
||||
JOB_STATUS=$($HADOOP_PREFIX/bin/hadoop job -list all | grep _0002 | cut -c 23)
|
||||
|
||||
if [ "$JOB_STATUS" != "2" ]
|
||||
then echo "Hadoop job with buffer failed!"; RESULT=-1;
|
||||
else
|
||||
echo "Hadoop job with buffer was successfull"
|
||||
|
||||
#verify output
|
||||
sed "s/^\(.*\)[[:space:]*]\(.*\)/\2 \1/" output/part-r-00000 | sort -bnr > hadoop_tmp.txt
|
||||
cat input/test.txt | tr -s [:space:] '\n' | grep -v "^\s*$" | sort | uniq -c | sort -bnr > cross_check.txt
|
||||
if [ -n "$(diff -w hadoop_tmp.txt cross_check.txt)" ]
|
||||
then echo "Hadoop produced wrong output!"; RESULT=-1;
|
||||
fi
|
||||
fi
|
||||
|
||||
$HADOOP_PREFIX/bin/hadoop fs -rmr /hadoop_test/output
|
||||
|
||||
echo "Stop JobTracker and TaskTracker..."
|
||||
$HADOOP_PREFIX/bin/hadoop-daemon.sh stop jobtracker
|
||||
$HADOOP_PREFIX/bin/hadoop-daemon.sh stop tasktracker
|
||||
|
||||
# check if JobTacker and TaskTracker stop
|
||||
if [ -n "$(jps | grep TaskTracker)" ]
|
||||
then
|
||||
echo "TaskTracker does not stop, kill manually"
|
||||
TASKTRACKER_PID=$(jps | grep TaskTracker | cut -d ' ' -f1)
|
||||
kill $TASKTRACKER_PID
|
||||
fi
|
||||
|
||||
if [ -n "$(jps | grep JobTracker)" ]
|
||||
then
|
||||
echo "JobTracker does not stop, kill manually"
|
||||
JOBTRACKER_PID=$(jps | grep JobTracker | cut -d ' ' -f1)
|
||||
kill $JOBTRACKER_PID
|
||||
fi
|
||||
|
||||
#kill all remaining child processes
|
||||
CHILD_PIDS=$(jps | grep Child | cut -d ' ' -f1)
|
||||
if [ -n "$CHILD_PIDS" ]
|
||||
then kill $CHILD_PIDS
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
exit $RESULT
|
||||
147
tests/test_scripts/junit_tests.sh
Executable file
147
tests/test_scripts/junit_tests.sh
Executable file
@@ -0,0 +1,147 @@
|
||||
#!/bin/bash
|
||||
|
||||
# runs all JUnit tests in the subpackage 'org.xtreemfs.test' that end with '*Test.java'
|
||||
|
||||
TEST_DIR=$4
|
||||
if [ -z $TEST_DIR ]
|
||||
then
|
||||
TEST_DIR=/tmp/xtreemfs-junit
|
||||
if [ ! -d "$TEST_DIR" ]; then mkdir "$TEST_DIR"; fi
|
||||
if [ ! -d "${TEST_DIR}/log" ]; then mkdir "${TEST_DIR}/log"; fi
|
||||
fi
|
||||
echo "TEST_DIR: $TEST_DIR"
|
||||
|
||||
JUNIT_LOG_FILE="${TEST_DIR}/log/junit.log"
|
||||
|
||||
XTREEMFS=$1
|
||||
if [ -z "$XTREEMFS" ]
|
||||
then
|
||||
# Try to guess the XtreemFS svn root.
|
||||
if [ -d "java/servers" ]; then XTREEMFS="."; fi
|
||||
fi
|
||||
echo "XTREEMFS=$XTREEMFS"
|
||||
|
||||
# Method which returns a regex list of possible ports in use by the server webinterface and RPC server.
|
||||
function get_xtreemfs_ports() {
|
||||
offset=$(grep "PORT_RANGE_OFFSET = " "${XTREEMFS}/java/servers/test/org/xtreemfs/test/SetupUtils.java" | grep -oE "[0-9]+")
|
||||
|
||||
default_ports="30638 30636 30639 29637 29640 29641 29642 29643 29644 29645 29646 29647 29648 29649 29650 29651 32638 32636 32639 32637 32640 32641 32642 32643 32644 32645 32646 32647 32648 32649 32650 32651"
|
||||
|
||||
for port in $default_ports
|
||||
do
|
||||
default_ports=${default_ports/$port/$(($port + $offset))}
|
||||
done
|
||||
|
||||
# Construct final regex:
|
||||
echo ":("${default_ports// /|}")"
|
||||
}
|
||||
|
||||
# The used Sun webserver does allow to set the socket option SO_REUSEADDR.
|
||||
# Therefore, a subsequent JUnit test may fail with "address already in use"
|
||||
# because the webinterface of an XtreemFS server from a previous test is still
|
||||
# in the TIME_WAIT state.
|
||||
# Additionally, it also checks for regular ports since ReplicationTest keeps
|
||||
# failing with BindException despite enabled SO_REUSEADDR.
|
||||
function wait_for_time_wait_ports() {
|
||||
ports_regex=$(get_xtreemfs_ports)
|
||||
|
||||
while [ -n "$(netstat -n -a -t | grep -E "$ports_regex")" ]
|
||||
do
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
|
||||
# find all jars; build the classpath for running the JUnit tests
|
||||
CLASSPATH="."
|
||||
while read LINE; do
|
||||
CLASSPATH="$CLASSPATH:$LINE"
|
||||
done < <(find $XTREEMFS/java -name \*.jar)
|
||||
|
||||
# find all source files for the unit tests
|
||||
SOURCES=""
|
||||
for PROJECT in servers flease foundation
|
||||
do
|
||||
SOURCES="$SOURCES "$(find "java/${PROJECT}/test" -name \*.java -printf "%p ")
|
||||
done
|
||||
|
||||
CLASSES_DIR=$TEST_DIR/classes
|
||||
|
||||
# compile JUnit tests; store results in $CLASSES_DIR
|
||||
mkdir -p $CLASSES_DIR
|
||||
JAVAC_CALL="$JAVA_HOME/bin/javac -cp $CLASSPATH -d $TEST_DIR/classes $SOURCES"
|
||||
echo "Compiling tests..."
|
||||
# echo "Compiling tests: ${JAVAC_CALL}"
|
||||
$JAVAC_CALL
|
||||
RESULT=$?
|
||||
if [ "$RESULT" -ne "0" ]; then echo "$COMMAND failed"; exit $RESULT; fi
|
||||
|
||||
CLASSPATH="$CLASSPATH:$CLASSES_DIR"
|
||||
|
||||
# find and execute all JUnit tests among the class files
|
||||
rm -f "$JUNIT_LOG_FILE"
|
||||
COUNTER=0
|
||||
FAILED=0
|
||||
JUNIT_TESTS=""
|
||||
while read LINE; do
|
||||
|
||||
if [[ $LINE = *ExternalIntegrationTest.class ]]
|
||||
then
|
||||
# not a valid JUnit test
|
||||
continue;
|
||||
fi
|
||||
|
||||
# Transform a path of the form "/tmp/xtreemfs-junit/classes/org/xtreemfs/test/mrc/OSDPolicyTest.class" to the form "org.xtreemfs.test.mrc.OSDPolicyTest".
|
||||
TEST=`echo $LINE | sed -r -e 's|^.*(org\/xtreemfs\/.+)\.class\$|\1|'`
|
||||
# replace '/' with '.'
|
||||
TEST=${TEST//\//\.}
|
||||
|
||||
# run each JUnit test separately in its own JVM
|
||||
JAVA_CALL="$JAVA_HOME/bin/java -ea -cp $CLASSPATH org.junit.runner.JUnitCore $TEST"
|
||||
|
||||
RESULT=1
|
||||
i=0
|
||||
while [ $i -le 3 -a $RESULT -ne 0 ]
|
||||
do
|
||||
echo -n "Running test `expr $COUNTER + 1`: $TEST ... "
|
||||
$JAVA_CALL >> "$JUNIT_LOG_FILE" 2>&1
|
||||
RESULT=$?
|
||||
i=`expr $i + 1`
|
||||
|
||||
if [ "$RESULT" -ne "0" ]; then
|
||||
echo -n "FAILURE, waiting for ports to become free before retrying ... "
|
||||
|
||||
# Log netstat output to debug "address already in use" problems.
|
||||
temp_file="$(mktemp netstat.XXXXXX)"
|
||||
netstat -n -t -a &> "$temp_file.all"
|
||||
netstat -n -t -l &> "$temp_file.listen"
|
||||
netstat -n -t -a -o &> "$temp_file.all+timer"
|
||||
|
||||
# Wait for all ports to become free before retrying in case the cause was the "address already in use" problem.
|
||||
before_wait_ports=$(date +%s)
|
||||
wait_for_time_wait_ports
|
||||
after_wait_ports=$(date +%s)
|
||||
echo " ports free after $((after_wait_ports - before_wait_ports))s."
|
||||
else
|
||||
echo "ok"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$RESULT" -ne "0" ]; then
|
||||
FAILED=`expr $FAILED + 1`
|
||||
fi
|
||||
|
||||
COUNTER=`expr $COUNTER + 1`
|
||||
|
||||
done < <(find $CLASSES_DIR -name *Test.class -type f)
|
||||
|
||||
echo "`expr $COUNTER - $FAILED` / $COUNTER tests successfully executed."
|
||||
|
||||
if [ "$FAILED" -ne "0" ]; then exit 1; fi
|
||||
|
||||
# Report crashes.
|
||||
grep "has crashed" "$JUNIT_LOG_FILE" >/dev/null
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
echo "However, during the test services did crash. Examine the log file junit.log for more information."
|
||||
exit 2
|
||||
fi
|
||||
196
tests/test_scripts/marked_block.pl
Executable file
196
tests/test_scripts/marked_block.pl
Executable file
@@ -0,0 +1,196 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# Trying to detect disk write errors...
|
||||
# Write a bunch of large files with a fixed pattern for each 512 bytes
|
||||
# block. The block and file name can be recognised from its content.
|
||||
#
|
||||
# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# Copyright (c) Erich Focht <efocht@hpce.nec.com>
|
||||
# All rights reserved
|
||||
|
||||
use strict;
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
use Getopt::Long;
|
||||
|
||||
sub usage {
|
||||
|
||||
print <<'EOF';
|
||||
Trying to detect disk write errors...
|
||||
-------------------------------------
|
||||
Write a bunch of large files with a fixed pattern for each 512 bytes
|
||||
block. The block and file name can be recognised from its content,
|
||||
each block contains a repetition of the filename and the block number
|
||||
filled up to 512 bytes with "x" characters.
|
||||
|
||||
The md5sum of the file is computed on the fly and written to a corresponding
|
||||
file, such that the integrity of each file can be checked separately.
|
||||
|
||||
The file checking is done in groups, the default group size is 50 files.
|
||||
The group size should be chosen such that at check time the file is flushed
|
||||
to disk. Whether this makes sense or not depends on the origin of the error,
|
||||
of course...
|
||||
|
||||
Usage:
|
||||
marked_block.pl [--start=<startindex>] [--nfiles=<number_of_files>] \
|
||||
[--group=<groupsize>] [--check] [--file <name>]
|
||||
|
||||
--start=startindex : file number to start with (default = 1)
|
||||
--nfiles=n : number of files to write (default = 100)
|
||||
--group=groupsize : invoke md5sum after writing <groupsize> files
|
||||
(default = 50)
|
||||
--check : check files instead of writing, compare with
|
||||
expected content and print deviating blocks.
|
||||
--file <name> : write/check only one particular file
|
||||
--base <basename> : basename for building the filename
|
||||
--size <megabytes> : size of testfiles (default: 100MB)
|
||||
--help : print this help message
|
||||
|
||||
Typical usage:
|
||||
marked_blocks.pl --start=1 --nfiles=1000
|
||||
runs until it finds some checksum discrepancy in a file,
|
||||
suppose this is file testfile0054. In order to display the
|
||||
discrepancy to the file on disk:
|
||||
marked_blocks.pl --start=54 --nfiles=1 --check
|
||||
or
|
||||
marked_blocks.pl --file testfile0054 --check
|
||||
|
||||
Written and (c) by Erich Focht @ NEC. Use at your own risk!
|
||||
|
||||
EOF
|
||||
exit 0;
|
||||
}
|
||||
|
||||
sub min {
|
||||
my ($a, $b) = @_;
|
||||
return $a if ($a <= $b);
|
||||
return $b;
|
||||
}
|
||||
|
||||
my $filesize = 100 * 1024 * 1024;
|
||||
my $nfiles = 100;
|
||||
my $namebase = "testfile";
|
||||
my $nfstart = 1;
|
||||
my $group = 50;
|
||||
my $check = 0;
|
||||
my $file;
|
||||
|
||||
GetOptions(
|
||||
"help|h" => \&usage,
|
||||
"start=i" => \$nfstart,
|
||||
"nfiles|n=i"=> \$nfiles,
|
||||
"group=i" => \$group,
|
||||
"check" => \$check,
|
||||
"file=s" => \$file,
|
||||
"base=s" => \$namebase,
|
||||
"size=i" => \$filesize,
|
||||
) || &usage();
|
||||
|
||||
my $nblocks = $filesize * 1024 * 1024 / 512; # 100MB
|
||||
|
||||
if ($file) {
|
||||
$file =~ /^(\D+)(\d+)$/;
|
||||
$namebase = $1;
|
||||
$nfstart = int($2);
|
||||
$nfiles = 1;
|
||||
}
|
||||
|
||||
if (!$check) {
|
||||
print "Writing $nfiles files with prefix $namebase, starting with $nfstart.\n";
|
||||
} else {
|
||||
print "Checking $nfiles files with prefix $namebase, starting with $nfstart.\n";
|
||||
}
|
||||
|
||||
my ($string, $block, $slen, $written, $read, $bread);
|
||||
|
||||
my $nfend = $nfstart + $nfiles - 1;
|
||||
|
||||
for (my $fb = $nfstart; $fb <= $nfend; $fb = $fb + $group) {
|
||||
|
||||
for (my $f = $fb; $f <= min($fb + $group - 1, $nfend); $f++) {
|
||||
my $name = sprintf("%s%04d",$namebase,$f);
|
||||
my @bad;
|
||||
|
||||
$| = 1;
|
||||
print "File: $name\n";
|
||||
|
||||
if (!$check) {
|
||||
open OUT, "> $name" or die "Could not open file $name: $!";
|
||||
} else {
|
||||
open IN, "$name" or die "Could not open file $name: $!";
|
||||
}
|
||||
|
||||
my $md5 = Digest::MD5->new;
|
||||
|
||||
for (my $i = 0; $i < $nblocks; $i++) {
|
||||
$string = "file $name block $i:";
|
||||
$slen = length($string);
|
||||
$block = $string x int(512/$slen);
|
||||
$block .= "x" x (512 - length($block));
|
||||
|
||||
if (!$check) {
|
||||
$written = syswrite(OUT, $block, 512);
|
||||
die "written = $written instead of 512!" if ($written != 512);
|
||||
$md5->add($block);
|
||||
} else {
|
||||
$read = sysread(IN, $bread, 512);
|
||||
die "read = $read instead of 512!" if ($read != 512);
|
||||
if (substr($bread, 0, 512) ne substr($block, 0, 512)) {
|
||||
push @bad, $i;
|
||||
print "Block $i has unexpected content:\n";
|
||||
print_hex($bread,512);
|
||||
print "-" x 70 . "\n";
|
||||
$bread =~ s/[:^print:]/./g;
|
||||
print "$bread\n";
|
||||
print "-" x 70 . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$check) {
|
||||
close OUT;
|
||||
open MD5, "> $name.md5" or die "Could not open $name.md5 : $!";
|
||||
print MD5 $md5->hexdigest . " $name\n";
|
||||
close MD5;
|
||||
} else {
|
||||
if (@bad) {
|
||||
print "Following 512 byte blocks were bad: "
|
||||
. join(" ",@bad) . "\n";
|
||||
}
|
||||
close IN;
|
||||
}
|
||||
}
|
||||
if (!$check) {
|
||||
for (my $f = $fb; $f <= min($fb + $group - 1, $nfend); $f++) {
|
||||
my $mdfile = sprintf("%s%04d%s",$namebase,$f,".md5");
|
||||
!system("md5sum -c $mdfile") or die "md5sum failed!";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
exit 0;
|
||||
|
||||
sub print_hex {
|
||||
my ($data, $len) = @_;
|
||||
for (my $i = 0; $i < $len; $i += 24) {
|
||||
printf "%03d: ",$i;
|
||||
for (my $j = $i; $j < min($i + 24, $len); $j++) {
|
||||
my $b = unpack "C", substr($data,$j,1);
|
||||
printf "%02x ", $b;
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
196
tests/test_scripts/marked_block_helper.pl
Executable file
196
tests/test_scripts/marked_block_helper.pl
Executable file
@@ -0,0 +1,196 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# Trying to detect disk write errors...
|
||||
# Write a bunch of large files with a fixed pattern for each 512 bytes
|
||||
# block. The block and file name can be recognised from its content.
|
||||
#
|
||||
# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# Copyright (c) Erich Focht <efocht@hpce.nec.com>
|
||||
# All rights reserved
|
||||
|
||||
use strict;
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
use Getopt::Long;
|
||||
|
||||
sub usage {
|
||||
|
||||
print <<'EOF';
|
||||
Trying to detect disk write errors...
|
||||
-------------------------------------
|
||||
Write a bunch of large files with a fixed pattern for each 512 bytes
|
||||
block. The block and file name can be recognised from its content,
|
||||
each block contains a repetition of the filename and the block number
|
||||
filled up to 512 bytes with "x" characters.
|
||||
|
||||
The md5sum of the file is computed on the fly and written to a corresponding
|
||||
file, such that the integrity of each file can be checked separately.
|
||||
|
||||
The file checking is done in groups, the default group size is 50 files.
|
||||
The group size should be chosen such that at check time the file is flushed
|
||||
to disk. Whether this makes sense or not depends on the origin of the error,
|
||||
of course...
|
||||
|
||||
Usage:
|
||||
marked_block.pl [--start=<startindex>] [--nfiles=<number_of_files>] \
|
||||
[--group=<groupsize>] [--check] [--file <name>]
|
||||
|
||||
--start=startindex : file number to start with (default = 1)
|
||||
--nfiles=n : number of files to write (default = 100)
|
||||
--group=groupsize : invoke md5sum after writing <groupsize> files
|
||||
(default = 50)
|
||||
--check : check files instead of writing, compare with
|
||||
expected content and print deviating blocks.
|
||||
--file <name> : write/check only one particular file
|
||||
--base <basename> : basename for building the filename
|
||||
--size <megabytes> : size of testfiles (default: 100MB)
|
||||
--help : print this help message
|
||||
|
||||
Typical usage:
|
||||
marked_blocks.pl --start=1 --nfiles=1000
|
||||
runs until it finds some checksum discrepancy in a file,
|
||||
suppose this is file testfile0054. In order to display the
|
||||
discrepancy to the file on disk:
|
||||
marked_blocks.pl --start=54 --nfiles=1 --check
|
||||
or
|
||||
marked_blocks.pl --file testfile0054 --check
|
||||
|
||||
Written and (c) by Erich Focht @ NEC. Use at your own risk!
|
||||
|
||||
EOF
|
||||
exit 0;
|
||||
}
|
||||
|
||||
sub min {
|
||||
my ($a, $b) = @_;
|
||||
return $a if ($a <= $b);
|
||||
return $b;
|
||||
}
|
||||
|
||||
my $filesize = 100 * 1024 * 1024;
|
||||
my $nfiles = 100;
|
||||
my $namebase = "testfile";
|
||||
my $nfstart = 1;
|
||||
my $group = 50;
|
||||
my $check = 0;
|
||||
my $file;
|
||||
|
||||
GetOptions(
|
||||
"help|h" => \&usage,
|
||||
"start=i" => \$nfstart,
|
||||
"nfiles|n=i"=> \$nfiles,
|
||||
"group=i" => \$group,
|
||||
"check" => \$check,
|
||||
"file=s" => \$file,
|
||||
"base=s" => \$namebase,
|
||||
"size=i" => \$filesize,
|
||||
) || &usage();
|
||||
|
||||
my $nblocks = $filesize * 1024 * 1024 / 512; # 100MB
|
||||
|
||||
if ($file) {
|
||||
$file =~ /^(\D+)(\d+)$/;
|
||||
$namebase = $1;
|
||||
$nfstart = int($2);
|
||||
$nfiles = 1;
|
||||
}
|
||||
|
||||
if (!$check) {
|
||||
print "Writing $nfiles files with prefix $namebase, starting with $nfstart.\n";
|
||||
} else {
|
||||
print "Checking $nfiles files with prefix $namebase, starting with $nfstart.\n";
|
||||
}
|
||||
|
||||
my ($string, $block, $slen, $written, $read, $bread);
|
||||
|
||||
my $nfend = $nfstart + $nfiles - 1;
|
||||
|
||||
for (my $fb = $nfstart; $fb <= $nfend; $fb = $fb + $group) {
|
||||
|
||||
for (my $f = $fb; $f <= min($fb + $group - 1, $nfend); $f++) {
|
||||
my $name = sprintf("%s%04d",$namebase,$f);
|
||||
my @bad;
|
||||
|
||||
$| = 1;
|
||||
print "File: $name\n";
|
||||
|
||||
if (!$check) {
|
||||
open OUT, "> $name" or die "Could not open file $name: $!";
|
||||
} else {
|
||||
open IN, "$name" or die "Could not open file $name: $!";
|
||||
}
|
||||
|
||||
my $md5 = Digest::MD5->new;
|
||||
|
||||
for (my $i = 0; $i < $nblocks; $i++) {
|
||||
$string = "file $name block $i:";
|
||||
$slen = length($string);
|
||||
$block = $string x int(512/$slen);
|
||||
$block .= "x" x (512 - length($block));
|
||||
|
||||
if (!$check) {
|
||||
$written = syswrite(OUT, $block, 512);
|
||||
die "written = $written instead of 512!" if ($written != 512);
|
||||
$md5->add($block);
|
||||
} else {
|
||||
$read = sysread(IN, $bread, 512);
|
||||
die "read = $read instead of 512!" if ($read != 512);
|
||||
if (substr($bread, 0, 512) ne substr($block, 0, 512)) {
|
||||
push @bad, $i;
|
||||
print "Block $i has unexpected content:\n";
|
||||
print_hex($bread,512);
|
||||
print "-" x 70 . "\n";
|
||||
$bread =~ s/[:^print:]/./g;
|
||||
print "$bread\n";
|
||||
print "-" x 70 . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$check) {
|
||||
close OUT;
|
||||
open MD5, "> $name.md5" or die "Could not open $name.md5 : $!";
|
||||
print MD5 $md5->hexdigest . " $name\n";
|
||||
close MD5;
|
||||
} else {
|
||||
if (@bad) {
|
||||
print "Following 512 byte blocks were bad: "
|
||||
. join(" ",@bad) . "\n";
|
||||
}
|
||||
close IN;
|
||||
}
|
||||
}
|
||||
if (!$check) {
|
||||
for (my $f = $fb; $f <= min($fb + $group - 1, $nfend); $f++) {
|
||||
my $mdfile = sprintf("%s%04d%s",$namebase,$f,".md5");
|
||||
!system("md5sum -c $mdfile") or die "md5sum failed!";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
exit 0;
|
||||
|
||||
sub print_hex {
|
||||
my ($data, $len) = @_;
|
||||
for (my $i = 0; $i < $len; $i += 24) {
|
||||
printf "%03d: ",$i;
|
||||
for (my $j = $i; $j < min($i + 24, $len); $j++) {
|
||||
my $b = unpack "C", substr($data,$j,1);
|
||||
printf "%02x ", $b;
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
27
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/LICENSE
Normal file
27
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/LICENSE
Normal file
@@ -0,0 +1,27 @@
|
||||
$FreeBSD: src/tools/regression/fstest/LICENSE,v 1.1 2007/01/17 01:42:07 pjd Exp $
|
||||
|
||||
License for all regression tests available with fstest:
|
||||
|
||||
Copyright (c) 2006-2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
16
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/Makefile
Normal file
16
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/Makefile
Normal file
@@ -0,0 +1,16 @@
|
||||
# $FreeBSD: src/tools/regression/fstest/Makefile,v 1.1 2007/01/17 01:42:07 pjd Exp $
|
||||
|
||||
#CFLAGS+=-DHAS_LCHMOD
|
||||
#CFLAGS+=-DHAS_CHFLAGS
|
||||
#CFLAGS+=-DHAS_LCHFLAGS
|
||||
#CFLAGS+=-DHAS_TRUNCATE64
|
||||
#CFLAGS+=-DHAS_STAT64
|
||||
CFLAGS+=-DHAS_ACL -lacl
|
||||
|
||||
all: fstest
|
||||
|
||||
fstest: fstest.c
|
||||
gcc -Wall ${CFLAGS} fstest.c -o fstest
|
||||
|
||||
clean:
|
||||
rm -f fstest
|
||||
28
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/README
Normal file
28
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/README
Normal file
@@ -0,0 +1,28 @@
|
||||
$FreeBSD: src/tools/regression/fstest/README,v 1.1 2007/01/28 00:10:28 pjd Exp $
|
||||
|
||||
Few notes on how to use fstest in short steps:
|
||||
|
||||
# cd fstest
|
||||
# vi tests/conf
|
||||
Change 'fs' to file system type you want to test. These can be:
|
||||
UFS, ZFS, ext3, ntfs-3g and xfs.
|
||||
# vi Makefile
|
||||
You may need to manually tweak few things by editing CFLAGS lines
|
||||
at the top of the file.
|
||||
# make
|
||||
It will compile fstest utility which is used by regression tests.
|
||||
# cd /path/to/file/system/you/want/to/test/
|
||||
The test must be run as root user.
|
||||
# prove -r /path/to/fstest/
|
||||
|
||||
That's all. Enjoy.
|
||||
|
||||
Currently supported operating systems: FreeBSD, Solaris, Linux.
|
||||
Currently supported file system types: UFS, ZFS, ext3, ntfs-3g, xfs.
|
||||
|
||||
Author:
|
||||
Pawel Jakub Dawidek <pjd@FreeBSD.org>
|
||||
|
||||
Linux port:
|
||||
Jean-Pierre Andre <jean-pierre.andre@wanadoo.fr>
|
||||
Szabolcs Szakacsits <szaka@ntfs-3g.org>
|
||||
@@ -0,0 +1,14 @@
|
||||
This directory contains the POSIX file system test suite, obtained from: http://www.tuxera.com/community/posix-test-suite/
|
||||
|
||||
Additionally, some changes were applied:
|
||||
- Some tests were disabled (by renaming them from xx.t to xx.t.<reason>, e.g. tests/chmod/02.t.length) as they do not apply to XtreemFS.
|
||||
- Also, the "mkfifo" and "xacl" directories were moved from the "tests" directory to the parent directory to disable them.
|
||||
- FIFO related test sequences were disabled by substituting "except" and "test_check" with its newly added "_noop" variants.
|
||||
|
||||
In order to successfully run the POSIX Test Suite on a XtreemFS volume, the following conditions must be met:
|
||||
- volume must be created with option --chown-non-root
|
||||
- volume must be mounted with option -o allow_other
|
||||
- tests have to be executed as root
|
||||
|
||||
To execute the tests, change to the to be tested XtreemFS directory first and run
|
||||
$ prove -r tests
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "1..1"
|
||||
echo "ok 1"
|
||||
1173
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/fstest.c
Normal file
1173
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/fstest.c
Normal file
File diff suppressed because it is too large
Load Diff
73
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/00.t
Executable file
73
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/00.t
Executable file
@@ -0,0 +1,73 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/00.t,v 1.2 2007/01/25 20:50:02 pjd Exp $
|
||||
|
||||
desc="mkfifo creates fifo files"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..36"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
expect 0 mkdir ${n1} 0755
|
||||
cdir=`pwd`
|
||||
cd ${n1}
|
||||
|
||||
# POSIX: The file permission bits of the new FIFO shall be initialized from
|
||||
# mode. The file permission bits of the mode argument shall be modified by the
|
||||
# process' file creation mask.
|
||||
expect 0 mkfifo ${n0} 0755
|
||||
expect fifo,0755 lstat ${n0} type,mode
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 mkfifo ${n0} 0151
|
||||
expect fifo,0151 lstat ${n0} type,mode
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 -U 077 mkfifo ${n0} 0151
|
||||
expect fifo,0100 lstat ${n0} type,mode
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 -U 070 mkfifo ${n0} 0345
|
||||
expect fifo,0305 lstat ${n0} type,mode
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 -U 0501 mkfifo ${n0} 0345
|
||||
expect fifo,0244 lstat ${n0} type,mode
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
# POSIX: The FIFO's user ID shall be set to the process' effective user ID.
|
||||
# The FIFO's group ID shall be set to the group ID of the parent directory or to
|
||||
# the effective group ID of the process.
|
||||
expect 0 chown . 65535 65535
|
||||
expect 0 -u 65535 -g 65535 mkfifo ${n0} 0755
|
||||
expect 65535,65535 lstat ${n0} uid,gid
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 -u 65535 -g 65534 mkfifo ${n0} 0755
|
||||
expect "65535,6553[45]" lstat ${n0} uid,gid
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 chmod . 0777
|
||||
expect 0 -u 65534 -g 65533 mkfifo ${n0} 0755
|
||||
expect "65534,6553[35]" lstat ${n0} uid,gid
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
# POSIX: Upon successful completion, mkfifo() shall mark for update the
|
||||
# st_atime, st_ctime, and st_mtime fields of the file. Also, the st_ctime and
|
||||
# st_mtime fields of the directory that contains the new entry shall be marked
|
||||
# for update.
|
||||
expect 0 chown . 0 0
|
||||
time=`${fstest} stat . ctime`
|
||||
sleep 1
|
||||
expect 0 mkfifo ${n0} 0755
|
||||
atime=`${fstest} stat ${n0} atime`
|
||||
test_check $time -lt $atime
|
||||
mtime=`${fstest} stat ${n0} mtime`
|
||||
test_check $time -lt $mtime
|
||||
ctime=`${fstest} stat ${n0} ctime`
|
||||
test_check $time -lt $ctime
|
||||
mtime=`${fstest} stat . mtime`
|
||||
test_check $time -lt $mtime
|
||||
ctime=`${fstest} stat . ctime`
|
||||
test_check $time -lt $ctime
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n1}
|
||||
18
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/01.t
Executable file
18
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/01.t
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/01.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="mkfifo returns ENOTDIR if a component of the path prefix is not a directory"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..5"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect 0 create ${n0}/${n1} 0644
|
||||
expect ENOTDIR mkfifo ${n0}/${n1}/test 0644
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
expect 0 rmdir ${n0}
|
||||
13
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/02.t
Executable file
13
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/02.t
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/02.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="mkfifo returns ENAMETOOLONG if a component of a pathname exceeded 255 characters"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..3"
|
||||
|
||||
expect 0 mkfifo ${name255} 0644
|
||||
expect 0 unlink ${name255}
|
||||
expect ENAMETOOLONG mkfifo ${name256} 0644
|
||||
23
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/03.t
Executable file
23
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/03.t
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/03.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="mkfifo returns ENAMETOOLONG if an entire path name exceeded 1023 characters"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..11"
|
||||
|
||||
expect 0 mkdir ${name255} 0755
|
||||
expect 0 mkdir ${name255}/${name255} 0755
|
||||
expect 0 mkdir ${name255}/${name255}/${name255} 0755
|
||||
expect 0 mkdir ${path1021} 0755
|
||||
expect 0 mkfifo ${path1023} 0644
|
||||
expect 0 unlink ${path1023}
|
||||
create_too_long
|
||||
expect ENAMETOOLONG mkfifo ${too_long} 0644
|
||||
unlink_too_long
|
||||
expect 0 rmdir ${path1021}
|
||||
expect 0 rmdir ${name255}/${name255}/${name255}
|
||||
expect 0 rmdir ${name255}/${name255}
|
||||
expect 0 rmdir ${name255}
|
||||
16
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/04.t
Executable file
16
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/04.t
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/04.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="mkfifo returns ENOENT if a component of the path prefix does not exist"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..3"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect ENOENT mkfifo ${n0}/${n1}/test 0644
|
||||
expect 0 rmdir ${n0}
|
||||
29
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/05.t
Executable file
29
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/05.t
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/05.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="mkfifo returns EACCES when search permission is denied for a component of the path prefix"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..12"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
cdir=`pwd`
|
||||
cd ${n0}
|
||||
expect 0 mkdir ${n1} 0755
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n2} 0644
|
||||
expect 0 -u 65534 -g 65534 unlink ${n1}/${n2}
|
||||
expect 0 chmod ${n1} 0644
|
||||
expect EACCES -u 65534 -g 65534 mkfifo ${n1}/${n2} 0644
|
||||
expect 0 chmod ${n1} 0755
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n2} 0644
|
||||
expect 0 -u 65534 -g 65534 unlink ${n1}/${n2}
|
||||
expect 0 rmdir ${n1}
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n0}
|
||||
29
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/06.t
Executable file
29
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/06.t
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/06.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="mkfifo returns EACCES when write permission is denied on the parent directory of the file to be created"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..12"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
cdir=`pwd`
|
||||
cd ${n0}
|
||||
expect 0 mkdir ${n1} 0755
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n2} 0644
|
||||
expect 0 -u 65534 -g 65534 unlink ${n1}/${n2}
|
||||
expect 0 chmod ${n1} 0555
|
||||
expect EACCES -u 65534 -g 65534 mkfifo ${n1}/${n2} 0644
|
||||
expect 0 chmod ${n1} 0755
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n2} 0644
|
||||
expect 0 -u 65534 -g 65534 unlink ${n1}/${n2}
|
||||
expect 0 rmdir ${n1}
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n0}
|
||||
19
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/07.t
Executable file
19
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/07.t
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/07.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="mkfifo returns ELOOP if too many symbolic links were encountered in translating the pathname"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..6"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
expect 0 symlink ${n0} ${n1}
|
||||
expect 0 symlink ${n1} ${n0}
|
||||
expect ELOOP mkfifo ${n0}/test 0644
|
||||
expect ELOOP mkfifo ${n1}/test 0644
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 unlink ${n1}
|
||||
34
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/08.t
Executable file
34
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/08.t
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/08.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="mkfifo returns EROFS if the named file resides on a read-only file system"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
case "${os}:${fs}" in
|
||||
FreeBSD:UFS)
|
||||
echo "1..7"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
n=`mdconfig -a -n -t malloc -s 1m`
|
||||
newfs /dev/md${n} >/dev/null
|
||||
mount /dev/md${n} ${n0}
|
||||
expect 0 mkfifo ${n0}/${n1} 0644
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
mount -ur /dev/md${n}
|
||||
expect EROFS mkfifo ${n0}/${n1} 0644
|
||||
mount -uw /dev/md${n}
|
||||
expect 0 mkfifo ${n0}/${n1} 0644
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
umount /dev/md${n}
|
||||
mdconfig -d -u ${n}
|
||||
expect 0 rmdir ${n0}
|
||||
;;
|
||||
*)
|
||||
quick_exit
|
||||
;;
|
||||
esac
|
||||
27
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/09.t
Executable file
27
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/09.t
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/09.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="mkfifo returns EEXIST if the named file exists"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..12"
|
||||
|
||||
n0=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect EEXIST mkfifo ${n0} 0644
|
||||
expect 0 rmdir ${n0}
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect EEXIST mkfifo ${n0} 0644
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 symlink test ${n0}
|
||||
expect EEXIST mkfifo ${n0} 0644
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mkfifo ${n0} 0644
|
||||
expect EEXIST mkfifo ${n0} 0644
|
||||
expect 0 unlink ${n0}
|
||||
53
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/10.t
Executable file
53
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/10.t
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/10.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="mkfifo returns EPERM if the parent directory of the file to be created has its immutable flag set"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
require chflags
|
||||
|
||||
echo "1..30"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
|
||||
expect 0 mkfifo ${n0}/${n1} 0644
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
|
||||
expect 0 chflags ${n0} SF_IMMUTABLE
|
||||
expect EPERM mkfifo ${n0}/${n1} 0644
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 mkfifo ${n0}/${n1} 0644
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
|
||||
expect 0 chflags ${n0} UF_IMMUTABLE
|
||||
expect EPERM mkfifo ${n0}/${n1} 0644
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 mkfifo ${n0}/${n1} 0644
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
|
||||
expect 0 chflags ${n0} SF_APPEND
|
||||
expect 0 mkfifo ${n0}/${n1} 0644
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
|
||||
expect 0 chflags ${n0} UF_APPEND
|
||||
expect 0 mkfifo ${n0}/${n1} 0644
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
|
||||
expect 0 chflags ${n0} SF_NOUNLINK
|
||||
expect 0 mkfifo ${n0}/${n1} 0644
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
expect 0 chflags ${n0} none
|
||||
|
||||
expect 0 chflags ${n0} UF_NOUNLINK
|
||||
expect 0 mkfifo ${n0}/${n1} 0644
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
expect 0 chflags ${n0} none
|
||||
|
||||
expect 0 rmdir ${n0}
|
||||
36
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/11.t
Executable file
36
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/11.t
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/11.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="mkfifo returns ENOSPC if there are no free inodes on the file system on which the file is being created"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
case "${os}:${fs}" in
|
||||
FreeBSD:UFS)
|
||||
echo "1..3"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
n=`mdconfig -a -n -t malloc -s 256k`
|
||||
newfs /dev/md${n} >/dev/null
|
||||
mount /dev/md${n} ${n0}
|
||||
i=0
|
||||
while :; do
|
||||
mkfifo ${n0}/${i} >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
break
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
expect ENOSPC mkfifo ${n0}/${n1} 0644
|
||||
umount /dev/md${n}
|
||||
mdconfig -d -u ${n}
|
||||
expect 0 rmdir ${n0}
|
||||
;;
|
||||
*)
|
||||
quick_exit
|
||||
;;
|
||||
esac
|
||||
12
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/12.t
Executable file
12
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/mkfifo/12.t
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/12.t,v 1.1 2007/01/17 01:42:10 pjd Exp $
|
||||
|
||||
desc="mkfifo returns EFAULT if the path argument points outside the process's allocated address space"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..2"
|
||||
|
||||
expect EFAULT mkfifo NULL 0644
|
||||
expect EFAULT mkfifo DEADCODE 0644
|
||||
178
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/00.t
Executable file
178
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/00.t
Executable file
@@ -0,0 +1,178 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chflags/00.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chflags changes flags"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
require chflags
|
||||
|
||||
echo "1..191"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
|
||||
expect 0 mkdir ${n2} 0755
|
||||
cdir=`pwd`
|
||||
cd ${n2}
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect none stat ${n0} flags
|
||||
expect 0 chflags ${n0} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
|
||||
expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK stat ${n0} flags
|
||||
expect 0 chflags ${n0} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE
|
||||
expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE stat ${n0} flags
|
||||
expect 0 chflags ${n0} SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
|
||||
expect SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK stat ${n0} flags
|
||||
expect 0 chflags ${n0} none
|
||||
expect none stat ${n0} flags
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mkdir ${n0} 0644
|
||||
expect none stat ${n0} flags
|
||||
expect 0 chflags ${n0} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
|
||||
expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK stat ${n0} flags
|
||||
expect 0 chflags ${n0} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE
|
||||
expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE stat ${n0} flags
|
||||
expect 0 chflags ${n0} SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
|
||||
expect SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK stat ${n0} flags
|
||||
expect 0 chflags ${n0} none
|
||||
expect none stat ${n0} flags
|
||||
expect 0 rmdir ${n0}
|
||||
|
||||
expect 0 mkfifo ${n0} 0644
|
||||
expect none stat ${n0} flags
|
||||
expect 0 chflags ${n0} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
|
||||
expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK stat ${n0} flags
|
||||
expect 0 chflags ${n0} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE
|
||||
expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE stat ${n0} flags
|
||||
expect 0 chflags ${n0} SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
|
||||
expect SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK stat ${n0} flags
|
||||
expect 0 chflags ${n0} none
|
||||
expect none stat ${n0} flags
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 symlink ${n0} ${n1}
|
||||
expect none stat ${n1} flags
|
||||
expect none lstat ${n1} flags
|
||||
expect 0 chflags ${n1} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
|
||||
expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK stat ${n1} flags
|
||||
expect none lstat ${n1} flags
|
||||
expect 0 chflags ${n1} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE
|
||||
expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE stat ${n1} flags
|
||||
expect none lstat ${n1} flags
|
||||
expect 0 chflags ${n1} SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
|
||||
expect SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK stat ${n1} flags
|
||||
expect none lstat ${n1} flags
|
||||
expect 0 chflags ${n1} none
|
||||
expect none stat ${n1} flags
|
||||
expect none lstat ${n1} flags
|
||||
expect 0 unlink ${n1}
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 symlink ${n0} ${n1}
|
||||
expect none stat ${n1} flags
|
||||
expect none lstat ${n1} flags
|
||||
expect 0 lchflags ${n1} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
|
||||
expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK lstat ${n1} flags
|
||||
expect none stat ${n1} flags
|
||||
expect 0 lchflags ${n1} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE
|
||||
expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE lstat ${n1} flags
|
||||
expect none stat ${n1} flags
|
||||
expect 0 lchflags ${n1} SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
|
||||
expect SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK lstat ${n1} flags
|
||||
expect none stat ${n1} flags
|
||||
expect 0 lchflags ${n1} none
|
||||
expect none lstat ${n1} flags
|
||||
expect none stat ${n1} flags
|
||||
expect 0 unlink ${n1}
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
# successful chflags(2) updates ctime.
|
||||
expect 0 create ${n0} 0644
|
||||
for flag in UF_NODUMP UF_IMMUTABLE UF_APPEND UF_NOUNLINK UF_OPAQUE SF_ARCHIVED SF_IMMUTABLE SF_APPEND SF_NOUNLINK none; do
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 chflags ${n0} ${flag}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
done
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
for flag in UF_NODUMP UF_IMMUTABLE UF_APPEND UF_NOUNLINK UF_OPAQUE SF_ARCHIVED SF_IMMUTABLE SF_APPEND SF_NOUNLINK none; do
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 chflags ${n0} ${flag}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
done
|
||||
expect 0 rmdir ${n0}
|
||||
|
||||
expect 0 mkfifo ${n0} 0644
|
||||
for flag in UF_NODUMP UF_IMMUTABLE UF_APPEND UF_NOUNLINK UF_OPAQUE SF_ARCHIVED SF_IMMUTABLE SF_APPEND SF_NOUNLINK none; do
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 chflags ${n0} ${flag}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
done
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 symlink ${n1} ${n0}
|
||||
for flag in UF_NODUMP UF_IMMUTABLE UF_APPEND UF_NOUNLINK UF_OPAQUE SF_ARCHIVED SF_IMMUTABLE SF_APPEND SF_NOUNLINK none; do
|
||||
ctime1=`${fstest} lstat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 lchflags ${n0} ${flag}
|
||||
ctime2=`${fstest} lstat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
done
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
# unsuccessful chflags(2) does not update ctime.
|
||||
expect 0 create ${n0} 0644
|
||||
for flag in UF_IMMUTABLE SF_IMMUTABLE none; do
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EPERM -u 65534 chflags ${n0} ${flag}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
done
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
for flag in UF_IMMUTABLE SF_IMMUTABLE none; do
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EPERM -u 65534 chflags ${n0} ${flag}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
done
|
||||
expect 0 rmdir ${n0}
|
||||
|
||||
expect 0 mkfifo ${n0} 0644
|
||||
for flag in UF_IMMUTABLE SF_IMMUTABLE none; do
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EPERM -u 65534 chflags ${n0} ${flag}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
done
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 symlink ${n1} ${n0}
|
||||
for flag in UF_IMMUTABLE SF_IMMUTABLE none; do
|
||||
ctime1=`${fstest} lstat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EPERM -u 65534 lchflags ${n0} ${flag}
|
||||
ctime2=`${fstest} lstat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
done
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n2}
|
||||
20
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/01.t
Executable file
20
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/01.t
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chflags/01.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chflags returns ENOTDIR if a component of the path prefix is not a directory"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
require chflags
|
||||
|
||||
echo "1..5"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect 0 create ${n0}/${n1} 0644
|
||||
expect ENOTDIR chflags ${n0}/${n1}/test UF_IMMUTABLE
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
expect 0 rmdir ${n0}
|
||||
18
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/02.t
Executable file
18
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/02.t
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chflags/02.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chflags returns ENAMETOOLONG if a component of a pathname exceeded 255 characters"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
require chflags
|
||||
|
||||
echo "1..6"
|
||||
|
||||
expect 0 create ${name255} 0644
|
||||
expect 0 chflags ${name255} UF_IMMUTABLE
|
||||
expect UF_IMMUTABLE stat ${name255} flags
|
||||
expect 0 chflags ${name255} none
|
||||
expect 0 unlink ${name255}
|
||||
expect ENAMETOOLONG chflags ${name256} UF_IMMUTABLE
|
||||
25
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/03.t
Executable file
25
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/03.t
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chflags/03.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chflags returns ENAMETOOLONG if an entire path name exceeded 1023 characters"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
require chflags
|
||||
|
||||
echo "1..13"
|
||||
|
||||
expect 0 mkdir ${name255} 0755
|
||||
expect 0 mkdir ${name255}/${name255} 0755
|
||||
expect 0 mkdir ${name255}/${name255}/${name255} 0755
|
||||
expect 0 mkdir ${path1021} 0755
|
||||
expect 0 create ${path1023} 0644
|
||||
expect 0 chflags ${path1023} UF_IMMUTABLE
|
||||
expect 0 chflags ${path1023} none
|
||||
expect 0 unlink ${path1023}
|
||||
expect ENAMETOOLONG chflags ${path1024} UF_IMMUTABLE
|
||||
expect 0 rmdir ${path1021}
|
||||
expect 0 rmdir ${name255}/${name255}/${name255}
|
||||
expect 0 rmdir ${name255}/${name255}
|
||||
expect 0 rmdir ${name255}
|
||||
19
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/04.t
Executable file
19
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/04.t
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chflags/04.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chflags returns ENOENT if the named file does not exist"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
require chflags
|
||||
|
||||
echo "1..4"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect ENOENT chflags ${n0}/${n1}/test UF_IMMUTABLE
|
||||
expect ENOENT chflags ${n0}/${n1} UF_IMMUTABLE
|
||||
expect 0 rmdir ${n0}
|
||||
35
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/05.t
Executable file
35
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/05.t
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chflags/05.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chflags returns EACCES when search permission is denied for a component of the path prefix"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
require chflags
|
||||
|
||||
echo "1..16"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
cdir=`pwd`
|
||||
cd ${n0}
|
||||
expect 0 mkdir ${n1} 0755
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644
|
||||
expect 0 -u 65534 -g 65534 chflags ${n1}/${n2} UF_IMMUTABLE
|
||||
expect UF_IMMUTABLE -u 65534 -g 65534 stat ${n1}/${n2} flags
|
||||
expect 0 -u 65534 -g 65534 chflags ${n1}/${n2} none
|
||||
expect 0 chmod ${n1} 0644
|
||||
expect EACCES -u 65534 -g 65534 chflags ${n1}/${n2} UF_IMMUTABLE
|
||||
expect 0 chmod ${n1} 0755
|
||||
expect 0 -u 65534 -g 65534 chflags ${n1}/${n2} UF_IMMUTABLE
|
||||
expect UF_IMMUTABLE -u 65534 -g 65534 stat ${n1}/${n2} flags
|
||||
expect 0 -u 65534 -g 65534 chflags ${n1}/${n2} none
|
||||
expect 0 -u 65534 -g 65534 unlink ${n1}/${n2}
|
||||
expect 0 rmdir ${n1}
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n0}
|
||||
21
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/06.t
Executable file
21
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/06.t
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chflags/06.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chflags returns ELOOP if too many symbolic links were encountered in translating the pathname"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
require chflags
|
||||
|
||||
echo "1..6"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
expect 0 symlink ${n0} ${n1}
|
||||
expect 0 symlink ${n1} ${n0}
|
||||
expect ELOOP chflags ${n0}/test UF_IMMUTABLE
|
||||
expect ELOOP chflags ${n1}/test UF_IMMUTABLE
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 unlink ${n1}
|
||||
54
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/07.t
Executable file
54
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/07.t
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chflags/07.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chflags returns EPERM when the effective user ID does not match the owner of the file and the effective user ID is not the super-user"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
require chflags
|
||||
|
||||
echo "1..30"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
cdir=`pwd`
|
||||
cd ${n0}
|
||||
|
||||
expect 0 create ${n1} 0644
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE
|
||||
expect none stat ${n1} flags
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE
|
||||
expect none stat ${n1} flags
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 mkdir ${n1} 0755
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE
|
||||
expect none stat ${n1} flags
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE
|
||||
expect none stat ${n1} flags
|
||||
expect 0 rmdir ${n1}
|
||||
|
||||
expect 0 mkfifo ${n1} 0644
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE
|
||||
expect none stat ${n1} flags
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE
|
||||
expect none stat ${n1} flags
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 symlink ${n2} ${n1}
|
||||
expect EPERM -u 65534 -g 65534 lchflags ${n1} UF_IMMUTABLE
|
||||
expect none lstat ${n1} flags
|
||||
expect 0 lchown ${n1} 65534 65534
|
||||
expect EPERM -u 65533 -g 65533 lchflags ${n1} UF_IMMUTABLE
|
||||
expect none lstat ${n1} flags
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n0}
|
||||
70
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/08.t
Executable file
70
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/08.t
Executable file
@@ -0,0 +1,70 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chflags/08.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chflags returns EPERM when one of SF_IMMUTABLE, SF_APPEND, or SF_NOUNLINK is set and the user is not the super-user"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
require chflags
|
||||
|
||||
echo "1..78"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
cdir=`pwd`
|
||||
cd ${n0}
|
||||
|
||||
expect 0 create ${n1} 0644
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect 0 chflags ${n1} ${flag}
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE
|
||||
expect ${flag} stat ${n1} flags
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE
|
||||
expect ${flag} stat ${n1} flags
|
||||
done
|
||||
expect 0 chflags ${n1} none
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 mkdir ${n1} 0755
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect 0 chflags ${n1} ${flag}
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE
|
||||
expect ${flag} stat ${n1} flags
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE
|
||||
expect ${flag} stat ${n1} flags
|
||||
done
|
||||
expect 0 chflags ${n1} none
|
||||
expect 0 rmdir ${n1}
|
||||
|
||||
expect 0 mkfifo ${n1} 0644
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect 0 chflags ${n1} ${flag}
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE
|
||||
expect ${flag} stat ${n1} flags
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE
|
||||
expect ${flag} stat ${n1} flags
|
||||
done
|
||||
expect 0 chflags ${n1} none
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 symlink ${n2} ${n1}
|
||||
expect 0 lchown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect 0 lchflags ${n1} ${flag}
|
||||
expect EPERM -u 65533 -g 65533 lchflags ${n1} UF_IMMUTABLE
|
||||
expect ${flag} lstat ${n1} flags
|
||||
expect EPERM -u 65534 -g 65534 lchflags ${n1} UF_IMMUTABLE
|
||||
expect ${flag} lstat ${n1} flags
|
||||
done
|
||||
expect 0 lchflags ${n1} none
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n0}
|
||||
82
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/09.t
Executable file
82
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/09.t
Executable file
@@ -0,0 +1,82 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chflags/09.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chflags returns EPERM when one of SF_IMMUTABLE, SF_APPEND, or SF_NOUNLINK is set and securelevel is greater than 0"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
require chflags
|
||||
|
||||
echo "1..102"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
|
||||
old=`sysctl -n security.jail.chflags_allowed`
|
||||
sysctl security.jail.chflags_allowed=1 >/dev/null
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
cdir=`pwd`
|
||||
cd ${n0}
|
||||
|
||||
expect 0 create ${n1} 0644
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect 0 chflags ${n1} ${flag}
|
||||
jexpect 1 `pwd` EPERM chflags ${n1} UF_IMMUTABLE
|
||||
expect ${flag} stat ${n1} flags
|
||||
jexpect 1 `pwd` EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE
|
||||
expect ${flag} stat ${n1} flags
|
||||
jexpect 1 `pwd` EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE
|
||||
expect ${flag} stat ${n1} flags
|
||||
done
|
||||
expect 0 chflags ${n1} none
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 mkdir ${n1} 0755
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect 0 chflags ${n1} ${flag}
|
||||
jexpect 1 `pwd` EPERM chflags ${n1} UF_IMMUTABLE
|
||||
expect ${flag} stat ${n1} flags
|
||||
jexpect 1 `pwd` EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE
|
||||
expect ${flag} stat ${n1} flags
|
||||
jexpect 1 `pwd` EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE
|
||||
expect ${flag} stat ${n1} flags
|
||||
done
|
||||
expect 0 chflags ${n1} none
|
||||
expect 0 rmdir ${n1}
|
||||
|
||||
expect 0 mkfifo ${n1} 0644
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect 0 chflags ${n1} ${flag}
|
||||
jexpect 1 `pwd` EPERM chflags ${n1} UF_IMMUTABLE
|
||||
expect ${flag} stat ${n1} flags
|
||||
jexpect 1 `pwd` EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE
|
||||
expect ${flag} stat ${n1} flags
|
||||
jexpect 1 `pwd` EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE
|
||||
expect ${flag} stat ${n1} flags
|
||||
done
|
||||
expect 0 chflags ${n1} none
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 symlink ${n2} ${n1}
|
||||
expect 0 lchown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect 0 lchflags ${n1} ${flag}
|
||||
jexpect 1 `pwd` EPERM lchflags ${n1} UF_IMMUTABLE
|
||||
expect ${flag} lstat ${n1} flags
|
||||
jexpect 1 `pwd` EPERM -u 65533 -g 65533 lchflags ${n1} UF_IMMUTABLE
|
||||
expect ${flag} lstat ${n1} flags
|
||||
jexpect 1 `pwd` EPERM -u 65534 -g 65534 lchflags ${n1} UF_IMMUTABLE
|
||||
expect ${flag} lstat ${n1} flags
|
||||
done
|
||||
expect 0 lchflags ${n1} none
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
sysctl security.jail.chflags_allowed=${old} >/dev/null
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n0}
|
||||
62
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/10.t
Executable file
62
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/10.t
Executable file
@@ -0,0 +1,62 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chflags/10.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chflags returns EPERM if non-super-user tries to set one of SF_IMMUTABLE, SF_APPEND, or SF_NOUNLINK"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
require chflags
|
||||
|
||||
echo "1..62"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
cdir=`pwd`
|
||||
cd ${n0}
|
||||
|
||||
expect 0 create ${n1} 0644
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} ${flag}
|
||||
expect none stat ${n1} flags
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} ${flag}
|
||||
expect none stat ${n1} flags
|
||||
done
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 mkdir ${n1} 0755
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} ${flag}
|
||||
expect none stat ${n1} flags
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} ${flag}
|
||||
expect none stat ${n1} flags
|
||||
done
|
||||
expect 0 rmdir ${n1}
|
||||
|
||||
expect 0 mkfifo ${n1} 0644
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} ${flag}
|
||||
expect none stat ${n1} flags
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} ${flag}
|
||||
expect none stat ${n1} flags
|
||||
done
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 symlink ${n2} ${n1}
|
||||
expect 0 lchown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect EPERM -u 65533 -g 65533 lchflags ${n1} ${flag}
|
||||
expect none lstat ${n1} flags
|
||||
expect EPERM -u 65534 -g 65534 lchflags ${n1} ${flag}
|
||||
expect none lstat ${n1} flags
|
||||
done
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n0}
|
||||
70
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/11.t
Executable file
70
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/11.t
Executable file
@@ -0,0 +1,70 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chflags/11.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chflags returns EPERM if a user tries to set or remove the SF_SNAPSHOT flag"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
require chflags
|
||||
|
||||
echo "1..46"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
cdir=`pwd`
|
||||
cd ${n0}
|
||||
|
||||
expect 0 create ${n1} 0644
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT
|
||||
expect none stat ${n1} flags
|
||||
expect EPERM chflags ${n1} SF_SNAPSHOT
|
||||
expect none stat ${n1} flags
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT
|
||||
expect none stat ${n1} flags
|
||||
expect EPERM chflags ${n1} SF_SNAPSHOT
|
||||
expect none stat ${n1} flags
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 mkdir ${n1} 0644
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT
|
||||
expect none stat ${n1} flags
|
||||
expect EPERM chflags ${n1} SF_SNAPSHOT
|
||||
expect none stat ${n1} flags
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT
|
||||
expect none stat ${n1} flags
|
||||
expect EPERM chflags ${n1} SF_SNAPSHOT
|
||||
expect none stat ${n1} flags
|
||||
expect 0 rmdir ${n1}
|
||||
|
||||
expect 0 mkfifo ${n1} 0644
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT
|
||||
expect none stat ${n1} flags
|
||||
expect EPERM chflags ${n1} SF_SNAPSHOT
|
||||
expect none stat ${n1} flags
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT
|
||||
expect none stat ${n1} flags
|
||||
expect EPERM chflags ${n1} SF_SNAPSHOT
|
||||
expect none stat ${n1} flags
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 symlink ${n2} ${n1}
|
||||
expect EPERM -u 65534 -g 65534 lchflags ${n1} SF_SNAPSHOT
|
||||
expect none lstat ${n1} flags
|
||||
expect EPERM lchflags ${n1} SF_SNAPSHOT
|
||||
expect none lstat ${n1} flags
|
||||
expect 0 lchown ${n1} 65534 65534
|
||||
expect EPERM -u 65534 -g 65534 lchflags ${n1} SF_SNAPSHOT
|
||||
expect none lstat ${n1} flags
|
||||
expect EPERM lchflags ${n1} SF_SNAPSHOT
|
||||
expect none lstat ${n1} flags
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n0}
|
||||
43
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/12.t
Executable file
43
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/12.t
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chflags/12.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chflags returns EROFS if the named file resides on a read-only file system"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
require chflags
|
||||
|
||||
case "${os}:${fs}" in
|
||||
FreeBSD:UFS)
|
||||
echo "1..14"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
n=`mdconfig -a -n -t malloc -s 1m`
|
||||
newfs /dev/md${n} >/dev/null
|
||||
mount /dev/md${n} ${n0}
|
||||
expect 0 create ${n0}/${n1} 0644
|
||||
expect 0 chflags ${n0}/${n1} UF_IMMUTABLE
|
||||
expect UF_IMMUTABLE stat ${n0}/${n1} flags
|
||||
expect 0 chflags ${n0}/${n1} none
|
||||
expect none stat ${n0}/${n1} flags
|
||||
mount -ur /dev/md${n}
|
||||
expect EROFS chflags ${n0}/${n1} UF_IMMUTABLE
|
||||
expect none stat ${n0}/${n1} flags
|
||||
mount -uw /dev/md${n}
|
||||
expect 0 chflags ${n0}/${n1} UF_IMMUTABLE
|
||||
expect UF_IMMUTABLE stat ${n0}/${n1} flags
|
||||
expect 0 chflags ${n0}/${n1} none
|
||||
expect none stat ${n0}/${n1} flags
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
umount /dev/md${n}
|
||||
mdconfig -d -u ${n}
|
||||
expect 0 rmdir ${n0}
|
||||
;;
|
||||
*)
|
||||
quick_exit
|
||||
;;
|
||||
esac
|
||||
14
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/13.t
Executable file
14
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chflags/13.t
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chflags/13.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chflags returns EFAULT if the path argument points outside the process's allocated address space"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
require chflags
|
||||
|
||||
echo "1..2"
|
||||
|
||||
expect EFAULT chflags NULL UF_IMMUTABLE
|
||||
expect EFAULT chflags DEADCODE UF_IMMUTABLE
|
||||
161
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chmod/00.t
Executable file
161
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chmod/00.t
Executable file
@@ -0,0 +1,161 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chmod/00.t,v 1.2 2007/01/25 20:48:14 pjd Exp $
|
||||
|
||||
desc="chmod changes permission"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
if supported lchmod; then
|
||||
echo "1..77"
|
||||
else
|
||||
echo "1..58"
|
||||
fi
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
|
||||
expect 0 mkdir ${n2} 0755
|
||||
cdir=`pwd`
|
||||
cd ${n2}
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0644 stat ${n0} mode
|
||||
expect 0 chmod ${n0} 0111
|
||||
expect 0111 stat ${n0} mode
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect 0755 stat ${n0} mode
|
||||
expect 0 chmod ${n0} 0753
|
||||
expect 0753 stat ${n0} mode
|
||||
expect 0 rmdir ${n0}
|
||||
|
||||
expect_noop 0 mkfifo ${n0} 0644
|
||||
expect_noop 0 0644 stat ${n0} mode
|
||||
expect_noop 0 chmod ${n0} 0310
|
||||
expect_noop 0310 stat ${n0} mode
|
||||
expect_noop 0 unlink ${n0}
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 symlink ${n0} ${n1}
|
||||
expect 0644 stat ${n1} mode
|
||||
expect 0 chmod ${n1} 0321
|
||||
expect 0321 stat ${n1} mode
|
||||
expect 0321 lstat ${n0} mode
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
if supported lchmod; then
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 symlink ${n0} ${n1}
|
||||
expect 0644 stat ${n1} mode
|
||||
expect 0 lchmod ${n1} 0321
|
||||
expect 0321 lstat ${n1} mode
|
||||
expect 0 lchmod ${n1} 0531
|
||||
expect 0531 lstat ${n1} mode
|
||||
expect 0644 stat ${n0} mode
|
||||
expect 0644 stat ${n1} mode
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 unlink ${n1}
|
||||
fi
|
||||
|
||||
# successful chmod(2) updates ctime.
|
||||
expect 0 create ${n0} 0644
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 chmod ${n0} 0111
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 chmod ${n0} 0753
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 rmdir ${n0}
|
||||
|
||||
expect_noop 0 mkfifo ${n0} 0644
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
#sleep 1
|
||||
expect_noop 0 chmod ${n0} 0310
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check_noop $ctime1 -lt $ctime2
|
||||
expect_noop 0 unlink ${n0}
|
||||
|
||||
if supported lchmod; then
|
||||
expect 0 symlink ${n1} ${n0}
|
||||
ctime1=`${fstest} lstat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 lchmod ${n0} 0321
|
||||
ctime2=`${fstest} lstat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
fi
|
||||
|
||||
# unsuccessful chmod(2) does not update ctime.
|
||||
expect 0 create ${n0} 0644
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EPERM -u 65534 chmod ${n0} 0111
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EPERM -u 65534 chmod ${n0} 0753
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 rmdir ${n0}
|
||||
|
||||
expect_noop 0 mkfifo ${n0} 0644
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
#sleep 1
|
||||
expect_noop EPERM -u 65534 chmod ${n0} 0310
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check_noop $ctime1 -eq $ctime2
|
||||
expect_noop 0 unlink ${n0}
|
||||
|
||||
if supported lchmod; then
|
||||
expect 0 symlink ${n1} ${n0}
|
||||
ctime1=`${fstest} lstat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EPERM -u 65534 lchmod ${n0} 0321
|
||||
ctime2=`${fstest} lstat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
fi
|
||||
|
||||
# POSIX: If the calling process does not have appropriate privileges, and if
|
||||
# the group ID of the file does not match the effective group ID or one of the
|
||||
# supplementary group IDs and if the file is a regular file, bit S_ISGID
|
||||
# (set-group-ID on execution) in the file's mode shall be cleared upon
|
||||
# successful return from chmod().
|
||||
|
||||
expect 0 create ${n0} 0755
|
||||
expect 0 chown ${n0} 65535 65535
|
||||
expect 0 -u 65535 -g 65535 chmod ${n0} 02755
|
||||
expect 02755 stat ${n0} mode
|
||||
expect 0 -u 65535 -g 65535 chmod ${n0} 0755
|
||||
expect 0755 stat ${n0} mode
|
||||
|
||||
# Unfortunately FreeBSD doesn't clear set-gid bit, but returns EPERM instead.
|
||||
case "${os}" in
|
||||
FreeBSD)
|
||||
expect EPERM -u 65535 -g 65534 chmod ${n0} 02755
|
||||
expect 0755 stat ${n0} mode
|
||||
;;
|
||||
*)
|
||||
expect 0 -u 65535 -g 65534 chmod ${n0} 02755
|
||||
expect 0755 stat ${n0} mode
|
||||
;;
|
||||
esac
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n2}
|
||||
18
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chmod/01.t
Executable file
18
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chmod/01.t
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chmod/01.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chmod returns ENOTDIR if a component of the path prefix is not a directory"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..5"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect 0 create ${n0}/${n1} 0644
|
||||
expect ENOTDIR chmod ${n0}/${n1}/test 0644
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
expect 0 rmdir ${n0}
|
||||
15
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chmod/02.t.length
Executable file
15
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chmod/02.t.length
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chmod/02.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chmod returns ENAMETOOLONG if a component of a pathname exceeded 255 characters"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..5"
|
||||
|
||||
expect 0 create ${name255} 0644
|
||||
expect 0 chmod ${name255} 0620
|
||||
expect 0620 stat ${name255} mode
|
||||
expect 0 unlink ${name255}
|
||||
expect ENAMETOOLONG chmod ${name256} 0620
|
||||
24
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chmod/03.t
Executable file
24
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chmod/03.t
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chmod/03.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chmod returns ENAMETOOLONG if an entire path name exceeded 1023 characters"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..12"
|
||||
|
||||
expect 0 mkdir ${name255} 0755
|
||||
expect 0 mkdir ${name255}/${name255} 0755
|
||||
expect 0 mkdir ${name255}/${name255}/${name255} 0755
|
||||
expect 0 mkdir ${path1021} 0755
|
||||
expect 0 create ${path1023} 0644
|
||||
expect 0 chmod ${path1023} 0642
|
||||
expect 0 unlink ${path1023}
|
||||
create_too_long
|
||||
expect ENAMETOOLONG chmod ${too_long} 0642
|
||||
unlink_too_long
|
||||
expect 0 rmdir ${path1021}
|
||||
expect 0 rmdir ${name255}/${name255}/${name255}
|
||||
expect 0 rmdir ${name255}/${name255}
|
||||
expect 0 rmdir ${name255}
|
||||
17
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chmod/04.t
Executable file
17
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chmod/04.t
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chmod/04.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chmod returns ENOENT if the named file does not exist"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..4"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect ENOENT chmod ${n0}/${n1}/test 0644
|
||||
expect ENOENT chmod ${n0}/${n1} 0644
|
||||
expect 0 rmdir ${n0}
|
||||
31
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chmod/05.t
Executable file
31
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chmod/05.t
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chmod/05.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chmod returns EACCES when search permission is denied for a component of the path prefix"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..14"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
cdir=`pwd`
|
||||
cd ${n0}
|
||||
expect 0 mkdir ${n1} 0755
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644
|
||||
expect 0 -u 65534 -g 65534 chmod ${n1}/${n2} 0642
|
||||
expect 0642 -u 65534 -g 65534 stat ${n1}/${n2} mode
|
||||
expect 0 chmod ${n1} 0644
|
||||
expect EACCES -u 65534 -g 65534 chmod ${n1}/${n2} 0620
|
||||
expect 0 chmod ${n1} 0755
|
||||
expect 0 -u 65534 -g 65534 chmod ${n1}/${n2} 0420
|
||||
expect 0420 -u 65534 -g 65534 stat ${n1}/${n2} mode
|
||||
expect 0 -u 65534 -g 65534 unlink ${n1}/${n2}
|
||||
expect 0 rmdir ${n1}
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n0}
|
||||
19
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chmod/06.t
Executable file
19
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chmod/06.t
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chmod/06.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chmod returns ELOOP if too many symbolic links were encountered in translating the pathname"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..6"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
expect 0 symlink ${n0} ${n1}
|
||||
expect 0 symlink ${n1} ${n0}
|
||||
expect ELOOP chmod ${n0}/test 0644
|
||||
expect ELOOP chmod ${n1}/test 0644
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 unlink ${n1}
|
||||
31
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chmod/07.t
Executable file
31
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chmod/07.t
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chmod/07.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chmod returns EPERM if the operation would change the ownership, but the effective user ID is not the super-user"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..14"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
cdir=`pwd`
|
||||
cd ${n0}
|
||||
expect 0 mkdir ${n1} 0755
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644
|
||||
expect 0 -u 65534 -g 65534 chmod ${n1}/${n2} 0642
|
||||
expect 0642 stat ${n1}/${n2} mode
|
||||
expect EPERM -u 65533 -g 65533 chmod ${n1}/${n2} 0641
|
||||
expect 0642 stat ${n1}/${n2} mode
|
||||
expect 0 chown ${n1}/${n2} 0 0
|
||||
expect EPERM -u 65534 -g 65534 chmod ${n1}/${n2} 0641
|
||||
expect 0642 stat ${n1}/${n2} mode
|
||||
expect 0 unlink ${n1}/${n2}
|
||||
expect 0 rmdir ${n1}
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n0}
|
||||
59
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chmod/08.t
Executable file
59
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chmod/08.t
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chmod/08.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chmod returns EPERM if the named file has its immutable or append-only flag set"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
require chflags
|
||||
|
||||
echo "1..40"
|
||||
|
||||
n0=`namegen`
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chflags ${n0} SF_IMMUTABLE
|
||||
expect EPERM chmod ${n0} 0600
|
||||
expect 0644 stat ${n0} mode
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 chmod ${n0} 0600
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chflags ${n0} UF_IMMUTABLE
|
||||
expect EPERM chmod ${n0} 0600
|
||||
expect 0644 stat ${n0} mode
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 chmod ${n0} 0600
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chflags ${n0} SF_APPEND
|
||||
expect EPERM chmod ${n0} 0600
|
||||
expect 0644 stat ${n0} mode
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 chmod ${n0} 0600
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chflags ${n0} UF_APPEND
|
||||
expect EPERM chmod ${n0} 0600
|
||||
expect 0644 stat ${n0} mode
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 chmod ${n0} 0600
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chflags ${n0} SF_NOUNLINK
|
||||
expect 0 chmod ${n0} 0600
|
||||
expect 0600 stat ${n0} mode
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chflags ${n0} UF_NOUNLINK
|
||||
expect 0 chmod ${n0} 0600
|
||||
expect 0600 stat ${n0} mode
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 unlink ${n0}
|
||||
37
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chmod/09.t
Executable file
37
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chmod/09.t
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chmod/09.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chmod returns EROFS if the named file resides on a read-only file system"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
case "${os}:${fs}" in
|
||||
FreeBSD:UFS)
|
||||
echo "1..10"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
n=`mdconfig -a -n -t malloc -s 1m`
|
||||
newfs /dev/md${n} >/dev/null
|
||||
mount /dev/md${n} ${n0}
|
||||
expect 0 create ${n0}/${n1} 0644
|
||||
expect 0 chmod ${n0}/${n1} 0640
|
||||
expect 0640 stat ${n0}/${n1} mode
|
||||
mount -ur /dev/md${n}
|
||||
expect EROFS chmod ${n0}/${n1} 0600
|
||||
expect 0640 stat ${n0}/${n1} mode
|
||||
mount -uw /dev/md${n}
|
||||
expect 0 chmod ${n0}/${n1} 0600
|
||||
expect 0600 stat ${n0}/${n1} mode
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
umount /dev/md${n}
|
||||
mdconfig -d -u ${n}
|
||||
expect 0 rmdir ${n0}
|
||||
;;
|
||||
*)
|
||||
quick_exit
|
||||
;;
|
||||
esac
|
||||
12
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chmod/10.t
Executable file
12
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chmod/10.t
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chmod/10.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chmod returns EFAULT if the path argument points outside the process's allocated address space"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..2"
|
||||
|
||||
expect EFAULT chmod NULL 0644
|
||||
expect EFAULT chmod DEADCODE 0644
|
||||
53
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chmod/11.t
Executable file
53
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chmod/11.t
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chmod/11.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chmod returns EFTYPE if the effective user ID is not the super-user, the mode includes the sticky bit (S_ISVTX), and path does not refer to a directory"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..20"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
cdir=`pwd`
|
||||
cd ${n0}
|
||||
|
||||
expect 0 mkdir ${n1} 0755
|
||||
expect 0 chmod ${n1} 01755
|
||||
expect 01755 stat ${n1} mode
|
||||
expect 0 rmdir ${n1}
|
||||
|
||||
expect 0 create ${n1} 0644
|
||||
expect 0 chmod ${n1} 01644
|
||||
expect 01644 stat ${n1} mode
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 mkdir ${n1} 0755
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 chmod ${n1} 01755
|
||||
expect 01755 stat ${n1} mode
|
||||
expect 0 rmdir ${n1}
|
||||
|
||||
expect 0 create ${n1} 0644
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
case "${os}" in
|
||||
FreeBSD)
|
||||
expect EFTYPE -u 65534 -g 65534 chmod ${n1} 01644
|
||||
expect 0644 stat ${n1} mode
|
||||
;;
|
||||
SunOS)
|
||||
expect 0 -u 65534 -g 65534 chmod ${n1} 01644
|
||||
expect 0644 stat ${n1} mode
|
||||
;;
|
||||
Linux)
|
||||
expect 0 -u 65534 -g 65534 chmod ${n1} 01644
|
||||
expect 01644 stat ${n1} mode
|
||||
;;
|
||||
esac
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n0}
|
||||
376
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chown/00.t
Executable file
376
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chown/00.t
Executable file
@@ -0,0 +1,376 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chown/00.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chown changes ownership"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
if supported lchmod; then
|
||||
echo "1..186"
|
||||
else
|
||||
echo "1..171"
|
||||
fi
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
|
||||
expect 0 mkdir ${n2} 0755
|
||||
cdir=`pwd`
|
||||
cd ${n2}
|
||||
|
||||
# super-user can always modify ownership
|
||||
# 2
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chown ${n0} 123 456
|
||||
expect 123,456 lstat ${n0} uid,gid
|
||||
expect 0 chown ${n0} 0 0
|
||||
expect 0,0 lstat ${n0} uid,gid
|
||||
expect 0 unlink ${n0}
|
||||
# 8
|
||||
expect_noop 0 mkfifo ${n0} 0644
|
||||
expect_noop 0 chown ${n0} 123 456
|
||||
expect_noop 123,456 lstat ${n0} uid,gid
|
||||
expect_noop 0 chown ${n0} 0 0
|
||||
expect_noop 0,0 lstat ${n0} uid,gid
|
||||
expect_noop 0 unlink ${n0}
|
||||
# 14
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect 0 chown ${n0} 123 456
|
||||
expect 123,456 lstat ${n0} uid,gid
|
||||
expect 0 chown ${n0} 0 0
|
||||
expect 0,0 lstat ${n0} uid,gid
|
||||
expect 0 rmdir ${n0}
|
||||
# 20
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 symlink ${n0} ${n1}
|
||||
expect 0 chown ${n1} 123 456
|
||||
expect 123,456 stat ${n1} uid,gid
|
||||
expect 123,456 stat ${n0} uid,gid
|
||||
expect 0 lchown ${n1} 135 579
|
||||
expect 135,579 lstat ${n1} uid,gid
|
||||
expect 123,456 stat ${n1} uid,gid
|
||||
expect 123,456 stat ${n0} uid,gid
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
# non-super-user can modify file group if he is owner of a file and
|
||||
# gid he is setting is in his groups list.
|
||||
# 31
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
expect 65534,65533 lstat ${n0} uid,gid
|
||||
expect 0 -u 65534 -g 65532,65531 -- chown ${n0} -1 65532
|
||||
expect 65534,65532 lstat ${n0} uid,gid
|
||||
expect 0 -u 65534 -g 65532,65531 chown ${n0} 65534 65531
|
||||
expect 65534,65531 lstat ${n0} uid,gid
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
# chown(2) return 0 if user is not owner of a file, but chown(2) is called
|
||||
# with both uid and gid equal to -1.
|
||||
# 39
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
expect 0 -u 65532 -g 65531 -- chown ${n0} -1 -1
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
# when super-user calls chown(2), set-uid and set-gid bits are not removed.
|
||||
# 43
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
expect 0 chmod ${n0} 06555
|
||||
expect 06555 lstat ${n0} mode
|
||||
expect 0 chown ${n0} 65532 65531
|
||||
case "${os}" in
|
||||
Linux)
|
||||
expect 0555 lstat ${n0} mode
|
||||
;;
|
||||
*)
|
||||
expect 06555 lstat ${n0} mode
|
||||
;;
|
||||
esac
|
||||
expect 0 unlink ${n0}
|
||||
# 50
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chown ${n0} 0 0
|
||||
expect 0 chmod ${n0} 06555
|
||||
expect 06555 lstat ${n0} mode
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
case "${os}" in
|
||||
Linux)
|
||||
expect 0555 lstat ${n0} mode
|
||||
;;
|
||||
*)
|
||||
expect 06555 lstat ${n0} mode
|
||||
;;
|
||||
esac
|
||||
|
||||
expect 0 unlink ${n0}
|
||||
# 57
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
expect 0 chmod ${n0} 06555
|
||||
expect 06555 lstat ${n0} mode
|
||||
expect 0 chown ${n0} 0 0
|
||||
case "${os}" in
|
||||
Linux)
|
||||
expect 0555 lstat ${n0} mode
|
||||
;;
|
||||
*)
|
||||
expect 06555 lstat ${n0} mode
|
||||
;;
|
||||
esac
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
# when non-super-user calls chown(2) successfully, set-uid and set-gid bits are
|
||||
# removed, except when both uid and gid are equal to -1.
|
||||
# 64
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
expect 0 chmod ${n0} 06555
|
||||
expect 06555 lstat ${n0} mode
|
||||
expect 0 -u 65534 -g 65533,65532 chown ${n0} 65534 65532
|
||||
expect 0555,65534,65532 lstat ${n0} mode,uid,gid
|
||||
expect 0 chmod ${n0} 06555
|
||||
expect 06555 lstat ${n0} mode
|
||||
expect 0 -u 65534 -g 65533,65532 -- chown ${n0} -1 65533
|
||||
expect 0555,65534,65533 lstat ${n0} mode,uid,gid
|
||||
expect 0 chmod ${n0} 06555
|
||||
expect 06555 lstat ${n0} mode
|
||||
expect 0 -u 65534 -g 65533,65532 -- chown ${n0} -1 -1
|
||||
case "${os}" in
|
||||
Linux)
|
||||
expect 0555,65534,65533 lstat ${n0} mode,uid,gid
|
||||
;;
|
||||
*)
|
||||
expect 06555,65534,65533 lstat ${n0} mode,uid,gid
|
||||
;;
|
||||
esac
|
||||
|
||||
expect 0 unlink ${n0}
|
||||
# 79
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
expect 0 chmod ${n0} 06555
|
||||
expect 06555 lstat ${n0} mode
|
||||
expect 0 -u 65534 -g 65533,65532 chown ${n0} 65534 65532
|
||||
case "${os}:${fs}" in
|
||||
Linux:ext3|Linux:ntfs-3g|Linux:xtreemfs)
|
||||
expect 06555,65534,65532 lstat ${n0} mode,uid,gid
|
||||
;;
|
||||
*)
|
||||
expect 0555,65534,65532 lstat ${n0} mode,uid,gid
|
||||
;;
|
||||
esac
|
||||
expect 0 chmod ${n0} 06555
|
||||
expect 06555 lstat ${n0} mode
|
||||
expect 0 -u 65534 -g 65533,65532 -- chown ${n0} -1 65533
|
||||
case "${os}:${fs}" in
|
||||
Linux:ext3|Linux:ntfs-3g|Linux:xtreemfs)
|
||||
expect 06555,65534,65533 lstat ${n0} mode,uid,gid
|
||||
;;
|
||||
*)
|
||||
expect 0555,65534,65533 lstat ${n0} mode,uid,gid
|
||||
;;
|
||||
esac
|
||||
expect 0 chmod ${n0} 06555
|
||||
expect 06555 lstat ${n0} mode
|
||||
expect 0 -u 65534 -g 65533,65532 -- chown ${n0} -1 -1
|
||||
expect 06555,65534,65533 lstat ${n0} mode,uid,gid
|
||||
expect 0 rmdir ${n0}
|
||||
# 94
|
||||
if supported lchmod; then
|
||||
expect 0 symlink ${n1} ${n0}
|
||||
expect 0 lchown ${n0} 65534 65533
|
||||
expect 0 lchmod ${n0} 06555
|
||||
expect 06555 lstat ${n0} mode
|
||||
expect 0 -u 65534 -g 65533,65532 lchown ${n0} 65534 65532
|
||||
expect 0555,65534,65532 lstat ${n0} mode,uid,gid
|
||||
expect 0 lchmod ${n0} 06555
|
||||
expect 06555 lstat ${n0} mode
|
||||
expect 0 -u 65534 -g 65533,65532 -- lchown ${n0} -1 65533
|
||||
expect 0555,65534,65533 lstat ${n0} mode,uid,gid
|
||||
expect 0 lchmod ${n0} 06555
|
||||
expect 06555 lstat ${n0} mode
|
||||
expect 0 -u 65534 -g 65533,65532 -- lchown ${n0} -1 -1
|
||||
expect 06555,65534,65533 lstat ${n0} mode,uid,gid
|
||||
expect 0 unlink ${n0}
|
||||
fi
|
||||
|
||||
# successfull chown(2) call (except uid and gid equal to -1) updates ctime.
|
||||
# 109
|
||||
expect 0 create ${n0} 0644
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
expect 65534,65533 lstat ${n0} uid,gid
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
# 114
|
||||
expect 0 mkdir ${n0} 0755
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
expect 65534,65533 lstat ${n0} uid,gid
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 rmdir ${n0}
|
||||
# 119
|
||||
expect_noop 0 mkfifo ${n0} 0644
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
#sleep 1
|
||||
expect_noop 0 chown ${n0} 65534 65533
|
||||
expect_noop 65534,65533 lstat ${n0} uid,gid
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check_noop $ctime1 -lt $ctime2
|
||||
expect_noop 0 unlink ${n0}
|
||||
# 124
|
||||
expect 0 symlink ${n1} ${n0}
|
||||
ctime1=`${fstest} lstat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 lchown ${n0} 65534 65533
|
||||
expect 65534,65533 lstat ${n0} uid,gid
|
||||
ctime2=`${fstest} lstat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
# 129
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 -u 65534 -g 65532 chown ${n0} 65534 65532
|
||||
expect 65534,65532 lstat ${n0} uid,gid
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
# 135
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 -u 65534 -g 65532 chown ${n0} 65534 65532
|
||||
expect 65534,65532 lstat ${n0} uid,gid
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 rmdir ${n0}
|
||||
# 141
|
||||
expect_noop 0 mkfifo ${n0} 0644
|
||||
expect_noop 0 chown ${n0} 65534 65533
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
#sleep 1
|
||||
expect_noop 0 chown ${n0} 65534 65533
|
||||
expect_noop 0 -u 65534 -g 65532 chown ${n0} 65534 65532
|
||||
expect_noop 65534,65532 lstat ${n0} uid,gid
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check_noop $ctime1 -lt $ctime2
|
||||
expect_noop 0 unlink ${n0}
|
||||
# 148
|
||||
expect 0 symlink ${n1} ${n0}
|
||||
expect 0 lchown ${n0} 65534 65533
|
||||
ctime1=`${fstest} lstat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 -u 65534 -g 65532 lchown ${n0} 65534 65532
|
||||
expect 65534,65532 lstat ${n0} uid,gid
|
||||
ctime2=`${fstest} lstat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
# 154
|
||||
expect 0 create ${n0} 0644
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 -- chown ${n0} -1 -1
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
case "${os}:${fs}" in
|
||||
Linux:ext3)
|
||||
test_check $ctime1 -lt $ctime2
|
||||
;;
|
||||
*)
|
||||
test_check $ctime1 -eq $ctime2
|
||||
;;
|
||||
esac
|
||||
expect 0 unlink ${n0}
|
||||
# 158
|
||||
expect 0 mkdir ${n0} 0644
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 -- chown ${n0} -1 -1
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
case "${os}:${fs}" in
|
||||
Linux:ext3)
|
||||
test_check $ctime1 -lt $ctime2
|
||||
;;
|
||||
*)
|
||||
test_check $ctime1 -eq $ctime2
|
||||
;;
|
||||
esac
|
||||
expect 0 rmdir ${n0}
|
||||
# 162
|
||||
expect_noop 0 mkfifo ${n0} 0644
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
#sleep 1
|
||||
expect_noop 0 -- chown ${n0} -1 -1
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
case "${os}:${fs}" in
|
||||
Linux:ext3)
|
||||
test_check_noop $ctime1 -lt $ctime2
|
||||
;;
|
||||
*)
|
||||
test_check_noop $ctime1 -eq $ctime2
|
||||
;;
|
||||
esac
|
||||
expect_noop 0 unlink ${n0}
|
||||
# 166
|
||||
expect 0 symlink ${n1} ${n0}
|
||||
ctime1=`${fstest} lstat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 -- lchown ${n0} -1 -1
|
||||
ctime2=`${fstest} lstat ${n0} ctime`
|
||||
case "${os}:${fs}" in
|
||||
Linux:ext3)
|
||||
test_check $ctime1 -lt $ctime2
|
||||
;;
|
||||
*)
|
||||
test_check $ctime1 -eq $ctime2
|
||||
;;
|
||||
esac
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
# unsuccessful chown(2) does not update ctime.
|
||||
# 170
|
||||
expect 0 create ${n0} 0644
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EPERM -u 65534 -- chown ${n0} 65534 -1
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
# 174
|
||||
expect 0 mkdir ${n0} 0755
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EPERM -u 65534 -g 65534 -- chown ${n0} -1 65534
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 rmdir ${n0}
|
||||
# 178
|
||||
expect_noop 0 mkfifo ${n0} 0644
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
#sleep 1
|
||||
expect_noop EPERM -u 65534 -g 65534 chown ${n0} 65534 65534
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check_noop $ctime1 -eq $ctime2
|
||||
expect_noop 0 unlink ${n0}
|
||||
# 182
|
||||
expect 0 symlink ${n1} ${n0}
|
||||
ctime1=`${fstest} lstat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EPERM -u 65534 -g 65534 lchown ${n0} 65534 65534
|
||||
ctime2=`${fstest} lstat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
# 186
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n2}
|
||||
18
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chown/01.t
Executable file
18
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chown/01.t
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chown/01.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chown returns ENOTDIR if a component of the path prefix is not a directory"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..5"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect 0 create ${n0}/${n1} 0644
|
||||
expect ENOTDIR chown ${n0}/${n1}/test 65534 65534
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
expect 0 rmdir ${n0}
|
||||
15
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chown/02.t.length
Executable file
15
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chown/02.t.length
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh -x
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chown/02.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chown returns ENAMETOOLONG if a component of a pathname exceeded 255 characters"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..5"
|
||||
|
||||
expect 0 create ${name255} 0644
|
||||
expect 0 chown ${name255} 65534 65534
|
||||
expect 65534,65534 stat ${name255} uid,gid
|
||||
expect 0 unlink ${name255}
|
||||
expect ENAMETOOLONG chown ${name256} 65533 65533
|
||||
24
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chown/03.t
Executable file
24
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chown/03.t
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chown/03.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chown returns ENAMETOOLONG if an entire path name exceeded 1023 characters"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..12"
|
||||
|
||||
expect 0 mkdir ${name255} 0755
|
||||
expect 0 mkdir ${name255}/${name255} 0755
|
||||
expect 0 mkdir ${name255}/${name255}/${name255} 0755
|
||||
expect 0 mkdir ${path1021} 0755
|
||||
expect 0 create ${path1023} 0644
|
||||
expect 0 chown ${path1023} 65534 65534
|
||||
expect 0 unlink ${path1023}
|
||||
create_too_long
|
||||
expect ENAMETOOLONG chown ${too_long} 65533 65533
|
||||
unlink_too_long
|
||||
expect 0 rmdir ${path1021}
|
||||
expect 0 rmdir ${name255}/${name255}/${name255}
|
||||
expect 0 rmdir ${name255}/${name255}
|
||||
expect 0 rmdir ${name255}
|
||||
17
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chown/04.t
Executable file
17
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chown/04.t
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chown/04.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chown returns ENOENT if the named file does not exist"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..4"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect ENOENT chown ${n0}/${n1}/test 65534 65534
|
||||
expect ENOENT chown ${n0}/${n1} 65534 65534
|
||||
expect 0 rmdir ${n0}
|
||||
32
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chown/05.t
Executable file
32
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chown/05.t
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chown/05.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chown returns EACCES when search permission is denied for a component of the path prefix"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..15"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
cdir=`pwd`
|
||||
cd ${n0}
|
||||
expect 0 mkdir ${n1} 0755
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644
|
||||
expect 0 -u 65534 -g 65533,65534 -- chown ${n1}/${n2} -1 65533
|
||||
expect 65534,65533 -u 65534 -g 65534 stat ${n1}/${n2} uid,gid
|
||||
expect 0 chmod ${n1} 0644
|
||||
expect EACCES -u 65534 -g 65533,65534 -- chown ${n1}/${n2} -1 65534
|
||||
expect 0 chmod ${n1} 0755
|
||||
expect 65534,65533 -u 65534 -g 65534 stat ${n1}/${n2} uid,gid
|
||||
expect 0 -u 65534 -g 65533,65534 -- chown ${n1}/${n2} -1 65534
|
||||
expect 65534,65534 -u 65534 -g 65534 stat ${n1}/${n2} uid,gid
|
||||
expect 0 -u 65534 -g 65534 unlink ${n1}/${n2}
|
||||
expect 0 rmdir ${n1}
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n0}
|
||||
19
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chown/06.t
Executable file
19
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chown/06.t
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chown/06.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chown returns ELOOP if too many symbolic links were encountered in translating the pathname"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..6"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
expect 0 symlink ${n0} ${n1}
|
||||
expect 0 symlink ${n1} ${n0}
|
||||
expect ELOOP chown ${n0}/test 65534 65534
|
||||
expect ELOOP chown ${n1}/test 65534 65534
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 unlink ${n1}
|
||||
28
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chown/07.t
Executable file
28
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chown/07.t
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chown/07.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chown returns EPERM if the operation would change the ownership, but the effective user ID is not the super-user and the process is not an owner of the file"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..11"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
cdir=`pwd`
|
||||
cd ${n0}
|
||||
expect 0 mkdir ${n1} 0755
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644
|
||||
expect EPERM -u 65534 -g 65534 chown ${n1}/${n2} 65533 65533
|
||||
expect EPERM -u 65533 -g 65533 chown ${n1}/${n2} 65534 65534
|
||||
expect EPERM -u 65533 -g 65533 chown ${n1}/${n2} 65533 65533
|
||||
expect EPERM -u 65534 -g 65534 -- chown ${n1}/${n2} -1 65533
|
||||
expect 0 unlink ${n1}/${n2}
|
||||
expect 0 rmdir ${n1}
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n0}
|
||||
53
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chown/08.t
Executable file
53
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chown/08.t
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chown/08.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chown returns EPERM if the named file has its immutable or append-only flag set"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
require chflags
|
||||
|
||||
echo "1..34"
|
||||
|
||||
n0=`namegen`
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chflags ${n0} SF_IMMUTABLE
|
||||
expect EPERM chown ${n0} 65534 65534
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 chown ${n0} 65534 65534
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chflags ${n0} UF_IMMUTABLE
|
||||
expect EPERM chown ${n0} 65534 65534
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 chown ${n0} 65534 65534
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chflags ${n0} SF_APPEND
|
||||
expect EPERM chown ${n0} 65534 65534
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 chown ${n0} 65534 65534
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chflags ${n0} UF_APPEND
|
||||
expect EPERM chown ${n0} 65534 65534
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 chown ${n0} 65534 65534
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chflags ${n0} SF_NOUNLINK
|
||||
expect 0 chown ${n0} 65534 65534
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chflags ${n0} UF_NOUNLINK
|
||||
expect 0 chown ${n0} 65534 65534
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 unlink ${n0}
|
||||
37
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chown/09.t
Executable file
37
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chown/09.t
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chown/09.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chown returns EROFS if the named file resides on a read-only file system"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
case "${os}:{fs}" in
|
||||
FreeBSD:UFS)
|
||||
echo "1..10"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
n=`mdconfig -a -n -t malloc -s 1m`
|
||||
newfs /dev/md${n} >/dev/null
|
||||
mount /dev/md${n} ${n0}
|
||||
expect 0 create ${n0}/${n1} 0644
|
||||
expect 0 chown ${n0}/${n1} 65534 65534
|
||||
expect 65534,65534 stat ${n0}/${n1} uid,gid
|
||||
mount -ur /dev/md${n}
|
||||
expect EROFS chown ${n0}/${n1} 65533 65533
|
||||
expect 65534,65534 stat ${n0}/${n1} uid,gid
|
||||
mount -uw /dev/md${n}
|
||||
expect 0 chown ${n0}/${n1} 65533 65533
|
||||
expect 65533,65533 stat ${n0}/${n1} uid,gid
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
umount /dev/md${n}
|
||||
mdconfig -d -u ${n}
|
||||
expect 0 rmdir ${n0}
|
||||
;;
|
||||
*)
|
||||
quick_exit
|
||||
;;
|
||||
esac
|
||||
12
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chown/10.t
Executable file
12
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/chown/10.t
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/chown/10.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
desc="chown returns EFAULT if the path argument points outside the process's allocated address space"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..2"
|
||||
|
||||
expect EFAULT chown NULL 65534 65534
|
||||
expect EFAULT chown DEADCODE 65534 65534
|
||||
@@ -0,0 +1,8 @@
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/conf,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
# fstest configuration file
|
||||
|
||||
# Known operating systems: FreeBSD, SunOS, Linux
|
||||
os=`uname`
|
||||
|
||||
# Known file systems: UFS, ZFS, ext3, ntfs-3g, xfs
|
||||
fs="xtreemfs"
|
||||
151
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/00.t
Executable file
151
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/00.t
Executable file
@@ -0,0 +1,151 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/link/00.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="link creates hardlinks"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..82"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
n3=`namegen`
|
||||
|
||||
expect 0 mkdir ${n3} 0755
|
||||
cdir=`pwd`
|
||||
cd ${n3}
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect regular,0644,1 lstat ${n0} type,mode,nlink
|
||||
|
||||
expect 0 link ${n0} ${n1}
|
||||
expect regular,0644,2 lstat ${n0} type,mode,nlink
|
||||
expect regular,0644,2 lstat ${n1} type,mode,nlink
|
||||
|
||||
expect 0 link ${n1} ${n2}
|
||||
expect regular,0644,3 lstat ${n0} type,mode,nlink
|
||||
expect regular,0644,3 lstat ${n1} type,mode,nlink
|
||||
expect regular,0644,3 lstat ${n2} type,mode,nlink
|
||||
|
||||
expect 0 chmod ${n1} 0201
|
||||
expect 0 chown ${n1} 65534 65533
|
||||
|
||||
expect regular,0201,3,65534,65533 lstat ${n0} type,mode,nlink,uid,gid
|
||||
expect regular,0201,3,65534,65533 lstat ${n1} type,mode,nlink,uid,gid
|
||||
expect regular,0201,3,65534,65533 lstat ${n2} type,mode,nlink,uid,gid
|
||||
|
||||
expect 0 unlink ${n0}
|
||||
expect ENOENT lstat ${n0} type,mode,nlink,uid,gid
|
||||
expect regular,0201,2,65534,65533 lstat ${n1} type,mode,nlink,uid,gid
|
||||
expect regular,0201,2,65534,65533 lstat ${n2} type,mode,nlink,uid,gid
|
||||
|
||||
expect 0 unlink ${n2}
|
||||
expect ENOENT lstat ${n0} type,mode,nlink,uid,gid
|
||||
expect regular,0201,1,65534,65533 lstat ${n1} type,mode,nlink,uid,gid
|
||||
expect ENOENT lstat ${n2} type,mode,nlink,uid,gid
|
||||
|
||||
expect 0 unlink ${n1}
|
||||
expect ENOENT lstat ${n0} type,mode,nlink,uid,gid
|
||||
expect ENOENT lstat ${n1} type,mode,nlink,uid,gid
|
||||
expect ENOENT lstat ${n2} type,mode,nlink,uid,gid
|
||||
|
||||
expect_noop 0 mkfifo ${n0} 0644
|
||||
expect_noop fifo,0644,1 lstat ${n0} type,mode,nlink
|
||||
|
||||
expect_noop 0 link ${n0} ${n1}
|
||||
expect_noop fifo,0644,2 lstat ${n0} type,mode,nlink
|
||||
expect_noop fifo,0644,2 lstat ${n1} type,mode,nlink
|
||||
|
||||
expect_noop 0 link ${n1} ${n2}
|
||||
expect_noop fifo,0644,3 lstat ${n0} type,mode,nlink
|
||||
expect_noop fifo,0644,3 lstat ${n1} type,mode,nlink
|
||||
expect_noop fifo,0644,3 lstat ${n2} type,mode,nlink
|
||||
|
||||
expect_noop 0 chmod ${n1} 0201
|
||||
expect_noop 0 chown ${n1} 65534 65533
|
||||
|
||||
expect_noop fifo,0201,3,65534,65533 lstat ${n0} type,mode,nlink,uid,gid
|
||||
expect_noop fifo,0201,3,65534,65533 lstat ${n1} type,mode,nlink,uid,gid
|
||||
expect_noop fifo,0201,3,65534,65533 lstat ${n2} type,mode,nlink,uid,gid
|
||||
|
||||
expect_noop 0 unlink ${n0}
|
||||
expect_noop ENOENT lstat ${n0} type,mode,nlink,uid,gid
|
||||
expect_noop fifo,0201,2,65534,65533 lstat ${n1} type,mode,nlink,uid,gid
|
||||
expect_noop fifo,0201,2,65534,65533 lstat ${n2} type,mode,nlink,uid,gid
|
||||
|
||||
expect_noop 0 unlink ${n2}
|
||||
expect_noop ENOENT lstat ${n0} type,mode,nlink,uid,gid
|
||||
expect_noop fifo,0201,1,65534,65533 lstat ${n1} type,mode,nlink,uid,gid
|
||||
expect_noop ENOENT lstat ${n2} type,mode,nlink,uid,gid
|
||||
|
||||
expect_noop 0 unlink ${n1}
|
||||
expect_noop ENOENT lstat ${n0} type,mode,nlink,uid,gid
|
||||
expect_noop ENOENT lstat ${n1} type,mode,nlink,uid,gid
|
||||
expect_noop ENOENT lstat ${n2} type,mode,nlink,uid,gid
|
||||
|
||||
# successful link(2) updates ctime.
|
||||
expect 0 create ${n0} 0644
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
dctime1=`${fstest} stat . ctime`
|
||||
dmtime1=`${fstest} stat . mtime`
|
||||
sleep 1
|
||||
expect 0 link ${n0} ${n1}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
dctime2=`${fstest} stat . ctime`
|
||||
test_check $dctime1 -lt $dctime2
|
||||
dmtime2=`${fstest} stat . mtime`
|
||||
test_check $dctime1 -lt $dmtime2
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect_noop 0 mkfifo ${n0} 0644
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
dctime1=`${fstest} stat . ctime`
|
||||
dmtime1=`${fstest} stat . mtime`
|
||||
#sleep 1
|
||||
expect_noop 0 link ${n0} ${n1}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check_noop $ctime1 -lt $ctime2
|
||||
dctime2=`${fstest} stat . ctime`
|
||||
test_check_noop $dctime1 -lt $dctime2
|
||||
dmtime2=`${fstest} stat . mtime`
|
||||
test_check_noop $dctime1 -lt $dmtime2
|
||||
expect_noop 0 unlink ${n0}
|
||||
expect_noop 0 unlink ${n1}
|
||||
|
||||
# unsuccessful link(2) does not update ctime.
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 -- chown ${n0} 65534 -1
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
dctime1=`${fstest} stat . ctime`
|
||||
dmtime1=`${fstest} stat . mtime`
|
||||
sleep 1
|
||||
expect EACCES -u 65534 link ${n0} ${n1}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
dctime2=`${fstest} stat . ctime`
|
||||
test_check $dctime1 -eq $dctime2
|
||||
dmtime2=`${fstest} stat . mtime`
|
||||
test_check $dctime1 -eq $dmtime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect_noop 0 mkfifo ${n0} 0644
|
||||
expect_noop 0 -- chown ${n0} 65534 -1
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
dctime1=`${fstest} stat . ctime`
|
||||
dmtime1=`${fstest} stat . mtime`
|
||||
#sleep 1
|
||||
expect_noop EACCES -u 65534 link ${n0} ${n1}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check_noop $ctime1 -eq $ctime2
|
||||
dctime2=`${fstest} stat . ctime`
|
||||
test_check_noop $dctime1 -eq $dctime2
|
||||
dmtime2=`${fstest} stat . mtime`
|
||||
test_check_noop $dctime1 -eq $dmtime2
|
||||
expect_noop 0 unlink ${n0}
|
||||
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n3}
|
||||
22
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/01.t
Executable file
22
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/01.t
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/link/01.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="link returns ENOTDIR if a component of either path prefix is not a directory"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..8"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect 0 create ${n0}/${n1} 0644
|
||||
expect ENOTDIR link ${n0}/${n1}/test ${n0}/${n2}
|
||||
expect 0 create ${n0}/${n2} 0644
|
||||
expect ENOTDIR link ${n0}/${n2} ${n0}/${n1}/test
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
expect 0 rmdir ${n0}
|
||||
23
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/02.t.length
Executable file
23
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/02.t.length
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/link/02.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="link returns ENAMETOOLONG if a component of either pathname exceeded 255 characters"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..10"
|
||||
|
||||
n0=`namegen`
|
||||
|
||||
expect 0 create ${name255} 0644
|
||||
expect 0 link ${name255} ${n0}
|
||||
expect 0 unlink ${name255}
|
||||
expect 0 link ${n0} ${name255}
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 unlink ${name255}
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect ENAMETOOLONG link ${n0} ${name256}
|
||||
expect 0 unlink ${n0}
|
||||
expect ENAMETOOLONG link ${name256} ${n0}
|
||||
32
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/03.t
Executable file
32
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/03.t
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/link/03.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="link returns ENAMETOOLONG if an entire length of either path name exceeded 1023 characters"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..16"
|
||||
|
||||
n0=`namegen`
|
||||
|
||||
expect 0 mkdir ${name255} 0755
|
||||
expect 0 mkdir ${name255}/${name255} 0755
|
||||
expect 0 mkdir ${name255}/${name255}/${name255} 0755
|
||||
expect 0 mkdir ${path1021} 0755
|
||||
expect 0 create ${path1023} 0644
|
||||
expect 0 link ${path1023} ${n0}
|
||||
expect 0 unlink ${path1023}
|
||||
expect 0 link ${n0} ${path1023}
|
||||
expect 0 unlink ${path1023}
|
||||
create_too_long
|
||||
expect ENAMETOOLONG link ${n0} ${too_long}
|
||||
unlink_too_long
|
||||
expect 0 unlink ${n0}
|
||||
create_too_long
|
||||
expect ENAMETOOLONG link ${too_long} ${n0}
|
||||
unlink_too_long
|
||||
expect 0 rmdir ${path1021}
|
||||
expect 0 rmdir ${name255}/${name255}/${name255}
|
||||
expect 0 rmdir ${name255}/${name255}
|
||||
expect 0 rmdir ${name255}
|
||||
20
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/04.t
Executable file
20
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/04.t
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/link/04.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="link returns ENOENT if a component of either path prefix does not exist"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..6"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect ENOENT link ${n0}/${n1}/test ${n2}
|
||||
expect 0 create ${n2} 0644
|
||||
expect ENOENT link ${n2} ${n0}/${n1}/test
|
||||
expect 0 unlink ${n2}
|
||||
expect 0 rmdir ${n0}
|
||||
41
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/05.t
Executable file
41
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/05.t
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/link/05.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="link returns EMLINK if the link count of the file named by name1 would exceed 32767"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
case "${os}:${fs}" in
|
||||
FreeBSD:UFS)
|
||||
echo "1..5"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
n=`mdconfig -a -n -t malloc -s 1m`
|
||||
newfs -i 1 /dev/md${n} >/dev/null
|
||||
mount /dev/md${n} ${n0}
|
||||
expect 0 create ${n0}/${n1} 0644
|
||||
i=1
|
||||
while :; do
|
||||
link ${n0}/${n1} ${n0}/${i} >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
break
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
test_check $i -eq 32767
|
||||
|
||||
expect EMLINK link ${n0}/${n1} ${n0}/${n2}
|
||||
|
||||
umount /dev/md${n}
|
||||
mdconfig -d -u ${n}
|
||||
expect 0 rmdir ${n0}
|
||||
;;
|
||||
*)
|
||||
quick_exit
|
||||
;;
|
||||
esac
|
||||
43
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/06.t
Executable file
43
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/06.t
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/link/06.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="link returns EACCES when a component of either path prefix denies search permission"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..18"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
n3=`namegen`
|
||||
n4=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
cdir=`pwd`
|
||||
cd ${n0}
|
||||
|
||||
expect 0 mkdir ${n1} 0755
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 mkdir ${n2} 0755
|
||||
expect 0 chown ${n2} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 create ${n1}/${n3} 0644
|
||||
|
||||
expect 0 -u 65534 -g 65534 link ${n1}/${n3} ${n2}/${n4}
|
||||
expect 0 -u 65534 -g 65534 unlink ${n2}/${n4}
|
||||
|
||||
expect 0 chmod ${n1} 0644
|
||||
expect EACCES -u 65534 -g 65534 link ${n1}/${n3} ${n1}/${n4}
|
||||
expect EACCES -u 65534 -g 65534 link ${n1}/${n3} ${n2}/${n4}
|
||||
|
||||
expect 0 chmod ${n1} 0755
|
||||
expect 0 chmod ${n2} 0644
|
||||
expect EACCES -u 65534 -g 65534 link ${n1}/${n3} ${n2}/${n4}
|
||||
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
expect 0 rmdir ${n1}
|
||||
expect 0 rmdir ${n2}
|
||||
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n0}
|
||||
41
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/07.t
Executable file
41
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/07.t
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/link/07.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="link returns EACCES when the requested link requires writing in a directory with a mode that denies write permission"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..17"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
n3=`namegen`
|
||||
n4=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
cdir=`pwd`
|
||||
cd ${n0}
|
||||
|
||||
expect 0 mkdir ${n1} 0755
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 mkdir ${n2} 0755
|
||||
expect 0 chown ${n2} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 create ${n1}/${n3} 0644
|
||||
|
||||
expect 0 -u 65534 -g 65534 link ${n1}/${n3} ${n2}/${n4}
|
||||
expect 0 -u 65534 -g 65534 unlink ${n2}/${n4}
|
||||
|
||||
expect 0 chmod ${n2} 0555
|
||||
expect EACCES -u 65534 -g 65534 link ${n1}/${n3} ${n2}/${n4}
|
||||
expect 0 chmod ${n1} 0555
|
||||
expect EACCES -u 65534 -g 65534 link ${n1}/${n3} ${n1}/${n4}
|
||||
expect 0 chmod ${n1} 0755
|
||||
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
expect 0 rmdir ${n1}
|
||||
expect 0 rmdir ${n2}
|
||||
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n0}
|
||||
24
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/08.t
Executable file
24
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/08.t
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/link/08.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="link returns ELOOP if too many symbolic links were encountered in translating one of the pathnames"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..10"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
|
||||
expect 0 symlink ${n0} ${n1}
|
||||
expect 0 symlink ${n1} ${n0}
|
||||
expect ELOOP link ${n0}/test ${n2}
|
||||
expect ELOOP link ${n1}/test ${n2}
|
||||
expect 0 create ${n2} 0644
|
||||
expect ELOOP link ${n2} ${n0}/test
|
||||
expect ELOOP link ${n2} ${n1}/test
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 unlink ${n1}
|
||||
expect 0 unlink ${n2}
|
||||
18
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/09.t
Executable file
18
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/09.t
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/link/09.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="link returns ENOENT if the source file does not exist"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..5"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 link ${n0} ${n1}
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 unlink ${n1}
|
||||
expect ENOENT link ${n0} ${n1}
|
||||
32
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/10.t
Executable file
32
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/10.t
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/link/10.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="link returns EEXIST if the destination file does exist"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..14"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
|
||||
expect 0 create ${n1} 0644
|
||||
expect EEXIST link ${n0} ${n1}
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 mkdir ${n1} 0755
|
||||
expect EEXIST link ${n0} ${n1}
|
||||
expect 0 rmdir ${n1}
|
||||
|
||||
expect 0 symlink test ${n1}
|
||||
expect EEXIST link ${n0} ${n1}
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect_noop 0 mkfifo ${n1} 0644
|
||||
expect_noop EEXIST link ${n0} ${n1}
|
||||
expect_noop 0 unlink ${n1}
|
||||
|
||||
expect 0 unlink ${n0}
|
||||
41
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/11.t
Executable file
41
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/11.t
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/link/11.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="link returns EPERM if the source file is a directory"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
|
||||
case "${os}:${fs}" in
|
||||
SunOS:UFS)
|
||||
echo "1..10"
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect 0 link ${n0} ${n1}
|
||||
expect 0 unlink ${n1}
|
||||
expect 0 rmdir ${n0}
|
||||
;;
|
||||
*)
|
||||
echo "1..9"
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect EPERM link ${n0} ${n1}
|
||||
expect 0 rmdir ${n0}
|
||||
;;
|
||||
esac
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect 0 chown ${n0} 65534 65534
|
||||
cdir=`pwd`
|
||||
cd ${n0}
|
||||
|
||||
expect 0 -u 65534 -g 65534 mkdir ${n1} 0755
|
||||
expect EPERM -u 65534 -g 65534 link ${n1} ${n2}
|
||||
expect 0 -u 65534 -g 65534 rmdir ${n1}
|
||||
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n0}
|
||||
55
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/12.t
Executable file
55
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/12.t
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/link/12.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="link returns EPERM if the source file has its immutable or append-only flag set"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
require chflags
|
||||
|
||||
echo "1..32"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
|
||||
expect 0 link ${n0} ${n1}
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 chflags ${n0} SF_IMMUTABLE
|
||||
expect EPERM link ${n0} ${n1}
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 link ${n0} ${n1}
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 chflags ${n0} UF_IMMUTABLE
|
||||
expect EPERM link ${n0} ${n1}
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 link ${n0} ${n1}
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 chflags ${n0} SF_APPEND
|
||||
expect EPERM link ${n0} ${n1}
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 link ${n0} ${n1}
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 chflags ${n0} UF_APPEND
|
||||
expect EPERM link ${n0} ${n1}
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 link ${n0} ${n1}
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 chflags ${n0} SF_NOUNLINK
|
||||
expect 0 link ${n0} ${n1}
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 chflags ${n0} UF_NOUNLINK
|
||||
expect 0 link ${n0} ${n1}
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 unlink ${n0}
|
||||
56
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/13.t
Executable file
56
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/13.t
Executable file
@@ -0,0 +1,56 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/link/13.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="link returns EPERM if the parent directory of the destination file has its immutable flag set"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
require chflags
|
||||
|
||||
echo "1..32"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
|
||||
expect 0 create ${n0}/${n1} 0644
|
||||
expect 0 link ${n0}/${n1} ${n0}/${n2}
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
|
||||
expect 0 chflags ${n0} SF_IMMUTABLE
|
||||
expect EPERM link ${n0}/${n1} ${n0}/${n2}
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 link ${n0}/${n1} ${n0}/${n2}
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
|
||||
expect 0 chflags ${n0} UF_IMMUTABLE
|
||||
expect EPERM link ${n0}/${n1} ${n0}/${n2}
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 link ${n0}/${n1} ${n0}/${n2}
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
|
||||
expect 0 chflags ${n0} SF_APPEND
|
||||
expect 0 link ${n0}/${n1} ${n0}/${n2}
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
|
||||
expect 0 chflags ${n0} UF_APPEND
|
||||
expect 0 link ${n0}/${n1} ${n0}/${n2}
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
|
||||
expect 0 chflags ${n0} SF_NOUNLINK
|
||||
expect 0 link ${n0}/${n1} ${n0}/${n2}
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
|
||||
expect 0 chflags ${n0} UF_NOUNLINK
|
||||
expect 0 link ${n0}/${n1} ${n0}/${n2}
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
expect 0 rmdir ${n0}
|
||||
34
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/14.t
Executable file
34
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/14.t
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/link/14.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="link returns EXDEV if the source and the destination files are on different file systems"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
case "${os}" in
|
||||
FreeBSD)
|
||||
echo "1..8"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
n=`mdconfig -a -n -t malloc -s 1m`
|
||||
newfs /dev/md${n} >/dev/null
|
||||
mount /dev/md${n} ${n0}
|
||||
expect 0 create ${n0}/${n1} 0644
|
||||
expect EXDEV link ${n0}/${n1} ${n2}
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
expect 0 create ${n1} 0644
|
||||
expect EXDEV link ${n1} ${n0}/${n2}
|
||||
expect 0 unlink ${n1}
|
||||
umount /dev/md${n}
|
||||
mdconfig -d -u ${n}
|
||||
expect 0 rmdir ${n0}
|
||||
;;
|
||||
*)
|
||||
quick_exit
|
||||
;;
|
||||
esac
|
||||
38
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/15.t
Executable file
38
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/15.t
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/link/15.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="link returns ENOSPC if the directory in which the entry for the new link is being placed cannot be extended because there is no space left on the file system containing the directory"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
case "${os}:${fs}" in
|
||||
FreeBSD:UFS)
|
||||
echo "1..4"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
n=`mdconfig -a -n -t malloc -s 256k`
|
||||
newfs /dev/md${n} >/dev/null
|
||||
mount /dev/md${n} ${n0}
|
||||
expect 0 create ${n0}/${n1} 0644
|
||||
i=0
|
||||
while :; do
|
||||
link ${n0}/${n1} ${n0}/${i} >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
break
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
expect ENOSPC link ${n0}/${n1} ${n0}/${n2}
|
||||
umount /dev/md${n}
|
||||
mdconfig -d -u ${n}
|
||||
expect 0 rmdir ${n0}
|
||||
;;
|
||||
*)
|
||||
quick_exit
|
||||
;;
|
||||
esac
|
||||
39
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/16.t
Executable file
39
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/16.t
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/link/16.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="link returns EROFS if the requested link requires writing in a directory on a read-only file system"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
case "${os}" in
|
||||
FreeBSD)
|
||||
echo "1..9"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
n2=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
n=`mdconfig -a -n -t malloc -s 1m`
|
||||
newfs /dev/md${n} >/dev/null
|
||||
mount /dev/md${n} ${n0}
|
||||
expect 0 create ${n0}/${n1} 0644
|
||||
|
||||
expect 0 link ${n0}/${n1} ${n0}/${n2}
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
mount -ur /dev/md${n}
|
||||
expect EROFS link ${n0}/${n1} ${n0}/${n2}
|
||||
mount -uw /dev/md${n}
|
||||
expect 0 link ${n0}/${n1} ${n0}/${n2}
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
umount /dev/md${n}
|
||||
mdconfig -d -u ${n}
|
||||
expect 0 rmdir ${n0}
|
||||
;;
|
||||
*)
|
||||
quick_exit
|
||||
;;
|
||||
esac
|
||||
20
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/17.t
Executable file
20
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/link/17.t
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/link/17.t,v 1.1 2007/01/17 01:42:09 pjd Exp $
|
||||
|
||||
desc="link returns EFAULT if one of the pathnames specified is outside the process's allocated address space"
|
||||
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..8"
|
||||
|
||||
n0=`namegen`
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect EFAULT link ${n0} NULL
|
||||
expect EFAULT link ${n0} DEADCODE
|
||||
expect 0 unlink ${n0}
|
||||
expect EFAULT link NULL ${n0}
|
||||
expect EFAULT link DEADCODE ${n0}
|
||||
expect EFAULT link NULL DEADCODE
|
||||
expect EFAULT link DEADCODE NULL
|
||||
157
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/misc.sh
Normal file
157
tests/test_scripts/pjd-fstest-20090130-RC_XtreemFS/tests/misc.sh
Normal file
@@ -0,0 +1,157 @@
|
||||
# $FreeBSD: src/tools/regression/fstest/tests/misc.sh,v 1.1 2007/01/17 01:42:08 pjd Exp $
|
||||
|
||||
ntest=1
|
||||
|
||||
name253="_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_12"
|
||||
name255="${name253}34"
|
||||
name256="${name255}5"
|
||||
path1021="${name255}/${name255}/${name255}/${name253}"
|
||||
path1023="${path1021}/x"
|
||||
path1024="${path1023}x"
|
||||
|
||||
echo ${dir} | egrep '^/' >/dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
maindir="${dir}/../.."
|
||||
else
|
||||
maindir="`pwd`/${dir}/../.."
|
||||
fi
|
||||
fstest="${maindir}/fstest"
|
||||
. ${maindir}/tests/conf
|
||||
|
||||
run_getconf()
|
||||
{
|
||||
if val=$(getconf "${1}" .); then
|
||||
if [ "$value" = "undefined" ]; then
|
||||
echo "${1} is undefined"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Failed to get ${1}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo $val
|
||||
}
|
||||
|
||||
name_max_val=$(run_getconf NAME_MAX)
|
||||
path_max_val=$(run_getconf PATH_MAX)
|
||||
|
||||
name_max="_"
|
||||
i=1
|
||||
while test $i -lt $name_max_val ; do
|
||||
name_max="${name_max}x"
|
||||
i=$(($i+1))
|
||||
done
|
||||
|
||||
num_of_dirs=$(( ($path_max_val + $name_max_val) / ($name_max_val + 1) - 1 ))
|
||||
|
||||
long_dir="${name_max}"
|
||||
i=1
|
||||
while test $i -lt $num_of_dirs ; do
|
||||
long_dir="${long_dir}/${name_max}"
|
||||
i=$(($i+1))
|
||||
done
|
||||
long_dir="${long_dir}/x"
|
||||
|
||||
too_long="${long_dir}/${name_max}"
|
||||
|
||||
create_too_long()
|
||||
{
|
||||
mkdir -p ${long_dir}
|
||||
}
|
||||
|
||||
unlink_too_long()
|
||||
{
|
||||
rm -rf ${name_max}
|
||||
}
|
||||
|
||||
expect()
|
||||
{
|
||||
e="${1}"
|
||||
shift
|
||||
r=`${fstest} $* 2>/dev/null | tail -1`
|
||||
echo "${r}" | egrep '^'${e}'$' >/dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "ok ${ntest}"
|
||||
else
|
||||
echo "not ok ${ntest}"
|
||||
fi
|
||||
ntest=`expr $ntest + 1`
|
||||
}
|
||||
|
||||
expect_noop()
|
||||
{
|
||||
e="${1}"
|
||||
shift
|
||||
echo "ok ${ntest}"
|
||||
ntest=`expr $ntest + 1`
|
||||
}
|
||||
|
||||
jexpect()
|
||||
{
|
||||
s="${1}"
|
||||
d="${2}"
|
||||
e="${3}"
|
||||
shift 3
|
||||
r=`jail -s ${s} / fstest 127.0.0.1 /bin/sh -c "cd ${d} && ${fstest} $* 2>/dev/null" | tail -1`
|
||||
echo "${r}" | egrep '^'${e}'$' >/dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "ok ${ntest}"
|
||||
else
|
||||
echo "not ok ${ntest}"
|
||||
fi
|
||||
ntest=`expr $ntest + 1`
|
||||
}
|
||||
|
||||
test_check()
|
||||
{
|
||||
if [ $* ]; then
|
||||
echo "ok ${ntest}"
|
||||
else
|
||||
echo "not ok ${ntest}"
|
||||
fi
|
||||
ntest=`expr $ntest + 1`
|
||||
}
|
||||
|
||||
test_check_noop()
|
||||
{
|
||||
echo "ok ${ntest}"
|
||||
ntest=`expr $ntest + 1`
|
||||
}
|
||||
|
||||
namegen()
|
||||
{
|
||||
echo "fstest_`dd if=/dev/urandom bs=1k count=1 2>/dev/null | md5sum | cut -f1 -d' '`"
|
||||
}
|
||||
|
||||
quick_exit()
|
||||
{
|
||||
echo "1..1"
|
||||
echo "ok 1"
|
||||
exit 0
|
||||
}
|
||||
|
||||
supported()
|
||||
{
|
||||
case "${1}" in
|
||||
chflags)
|
||||
if [ ${os} != "FreeBSD" -o ${fs} != "UFS" ]; then
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
lchmod)
|
||||
if [ ${os} != "FreeBSD" ]; then
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
|
||||
require()
|
||||
{
|
||||
if supported ${1}; then
|
||||
return
|
||||
fi
|
||||
quick_exit
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user