Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Nov 2015 09:20:01 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r290594 - stable/10/usr.sbin/makefs/tests
Message-ID:  <201511090920.tA99K17Y014452@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Mon Nov  9 09:20:01 2015
New Revision: 290594
URL: https://svnweb.freebsd.org/changeset/base/290594

Log:
  MFC r290265,r290267,r290270:
  
  r290265:
  
  Add testcases for -t cd9660 -o isolevel=[1-3]
  
  -- -o isolevel=1 currently fails because of path comparison issues,
     so mark it as an expected failure.
  -- -o isolevel=3 is not implemented, so expect it to fail as an out
     of bounds value [*].
  
  PR: 203645
  Sponsored by: EMC / Isilon Storage Division
  
  r290267:
  
  Clean up mtree keyword support a slight bit and add a few more default keywords
  
  - Parameterize the mtree keywords as $DEFAULT_MTREE_KEYWORDS
  - Test with the extra mtree keywords, `mode,gid,uid`.
  - Add a note about mtrees with time support not working with makefs right now
  
  Sponsored by: EMC / Isilon Storage Division
  
  r290270:
  
  Add testcases for -t ffs -o version=[12]
  
  Verify the filesystem type using dumpfs. Add preliminary support
  for NetBSD (needs to be validated)
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  stable/10/usr.sbin/makefs/tests/makefs_cd9660_tests.sh
  stable/10/usr.sbin/makefs/tests/makefs_ffs_tests.sh
  stable/10/usr.sbin/makefs/tests/makefs_tests_common.sh
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/makefs/tests/makefs_cd9660_tests.sh
==============================================================================
--- stable/10/usr.sbin/makefs/tests/makefs_cd9660_tests.sh	Mon Nov  9 09:05:09 2015	(r290593)
+++ stable/10/usr.sbin/makefs/tests/makefs_cd9660_tests.sh	Mon Nov  9 09:20:01 2015	(r290594)
@@ -113,7 +113,7 @@ from_mtree_spec_file_body()
 	create_test_inputs
 
 	atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \
-	    mtree -c -k type,link,size -p $TEST_INPUTS_DIR
+	    mtree -c -k "$DEFAULT_MTREE_KEYWORDS" -p $TEST_INPUTS_DIR
 	cd $TEST_INPUTS_DIR
 	atf_check -e empty -o empty -s exit:0 \
 	    $MAKEFS $TEST_IMAGE $TEST_SPEC_FILE
@@ -208,6 +208,61 @@ o_flag_allow_max_name_cleanup()
 	common_cleanup
 }
 
+atf_test_case o_flag_isolevel_1 cleanup
+o_flag_isolevel_1_body()
+{
+	atf_expect_fail "this testcase needs work; the filenames generated seem incorrect/corrupt"
+
+	create_test_inputs
+
+	atf_check -e empty -o empty -s exit:0 \
+	    $MAKEFS -o isolevel=1 $TEST_IMAGE $TEST_INPUTS_DIR
+
+	mount_image
+	check_base_iso9660_image_contents
+}
+o_flag_isolevel_1_cleanup()
+{
+	common_cleanup
+}
+
+atf_test_case o_flag_isolevel_2 cleanup
+o_flag_isolevel_2_body()
+{
+	create_test_inputs
+
+	atf_check -e empty -o empty -s exit:0 \
+	    $MAKEFS -o isolevel=2 $TEST_IMAGE $TEST_INPUTS_DIR
+
+	mount_image
+	check_base_iso9660_image_contents
+}
+o_flag_isolevel_2_cleanup()
+{
+	common_cleanup
+}
+
+atf_test_case o_flag_isolevel_3 cleanup
+o_flag_isolevel_3_body()
+{
+	create_test_inputs
+
+	# XXX: isolevel=3 isn't implemented yet. See FreeBSD bug # 203645
+	if true; then
+	atf_check -e match:'makefs: ISO Level 3 is greater than 2\.' -o empty -s not-exit:0 \
+	    $MAKEFS -o isolevel=3 $TEST_IMAGE $TEST_INPUTS_DIR
+	else
+	atf_check -e empty -o empty -s exit:0 \
+	    $MAKEFS -o isolevel=3 $TEST_IMAGE $TEST_INPUTS_DIR
+	mount_image
+	check_base_iso9660_image_contents
+	fi
+}
+o_flag_isolevel_3_cleanup()
+{
+	common_cleanup
+}
+
 atf_test_case o_flag_preparer
 o_flag_preparer_body()
 {
@@ -308,6 +363,9 @@ atf_init_test_cases()
 
 	atf_add_test_case o_flag_allow_deep_trees
 	atf_add_test_case o_flag_allow_max_name
+	atf_add_test_case o_flag_isolevel_1
+	atf_add_test_case o_flag_isolevel_2
+	atf_add_test_case o_flag_isolevel_3
 	atf_add_test_case o_flag_preparer
 	atf_add_test_case o_flag_publisher
 	atf_add_test_case o_flag_rockridge

Modified: stable/10/usr.sbin/makefs/tests/makefs_ffs_tests.sh
==============================================================================
--- stable/10/usr.sbin/makefs/tests/makefs_ffs_tests.sh	Mon Nov  9 09:05:09 2015	(r290593)
+++ stable/10/usr.sbin/makefs/tests/makefs_ffs_tests.sh	Mon Nov  9 09:20:01 2015	(r290594)
@@ -105,7 +105,7 @@ from_mtree_spec_file_body()
 	create_test_inputs
 
 	atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \
-	    mtree -c -k type,link,size -p $TEST_INPUTS_DIR
+	    mtree -c -k "$DEFAULT_MTREE_KEYWORDS" -p $TEST_INPUTS_DIR
 
 	cd $TEST_INPUTS_DIR
 	atf_check -e empty -o not-empty -s exit:0 \
@@ -158,6 +158,70 @@ from_single_dir_cleanup()
 	common_cleanup
 }
 
+atf_test_case o_flag_version_1 cleanup
+o_flag_version_1_body()
+{
+	ffs_version=1
+
+	platform=$(uname)
+	case "$platform" in
+	FreeBSD)
+		ffs_label=UFS${ffs_version}
+		;;
+	NetBSD)
+		ffs_label=FFSv${ffs_version}
+		;;
+	*)
+		atf_skip "Unsupported platform"
+		;;
+	esac
+
+	create_test_inputs
+
+	atf_check -e empty -o not-empty -s exit:0 \
+	    $MAKEFS -M 1m -o version=$ffs_version $TEST_IMAGE $TEST_INPUTS_DIR
+
+	mount_image
+	atf_check -e empty -o match:"$ffs_label" dumpfs $TEST_MOUNT_DIR
+	check_ffs_image_contents
+}
+o_flag_version_1_cleanup()
+{
+	common_cleanup
+}
+
+atf_test_case o_flag_version_2 cleanup
+o_flag_version_2_body()
+{
+	ffs_version=2
+
+	platform=$(uname)
+	case "$platform" in
+	FreeBSD)
+		ffs_label=UFS${ffs_version}
+		;;
+	NetBSD)
+		ffs_label=FFSv${ffs_version}
+		;;
+	*)
+		atf_skip "Unsupported platform"
+		;;
+	esac
+
+	create_test_inputs
+
+	atf_check -e empty -o not-empty -s exit:0 \
+	    $MAKEFS -M 1m -o version=$ffs_version $TEST_IMAGE $TEST_INPUTS_DIR
+
+	mount_image
+	atf_check -e empty -o match:"$ffs_label" dumpfs $TEST_MOUNT_DIR
+	check_ffs_image_contents
+}
+o_flag_version_2_cleanup()
+{
+	common_cleanup
+}
+
 atf_init_test_cases()
 {
 
@@ -168,5 +232,6 @@ atf_init_test_cases()
 	atf_add_test_case from_multiple_dirs
 	atf_add_test_case from_single_dir
 
-
+	atf_add_test_case o_flag_version_1
+	atf_add_test_case o_flag_version_2
 }

Modified: stable/10/usr.sbin/makefs/tests/makefs_tests_common.sh
==============================================================================
--- stable/10/usr.sbin/makefs/tests/makefs_tests_common.sh	Mon Nov  9 09:05:09 2015	(r290593)
+++ stable/10/usr.sbin/makefs/tests/makefs_tests_common.sh	Mon Nov  9 09:20:01 2015	(r290594)
@@ -29,6 +29,13 @@
 
 KB=1024
 : ${TMPDIR=/tmp}
+# TODO: add mtree `time` support; get a lot of errors like this right now when
+# passing generating disk images with keyword mtree support, like:
+#
+# `[...]/mtree.spec:8: error: time: invalid value '1446458503'`
+#
+#DEFAULT_MTREE_KEYWORDS="type,mode,gid,uid,size,link,time"
+DEFAULT_MTREE_KEYWORDS="type,mode,gid,uid,size,link"
 TEST_IMAGE="$TMPDIR/test.img"
 TEST_INPUTS_DIR="$TMPDIR/inputs"
 TEST_MD_DEVICE_FILE="$TMPDIR/md.output"
@@ -39,7 +46,7 @@ check_image_contents()
 {
 	local directories=$TEST_INPUTS_DIR
 	local excludes mtree_excludes_arg mtree_file
-	local mtree_keywords="type,link,size"
+	local mtree_keywords="$DEFAULT_MTREE_KEYWORDS"
 
 	while getopts "d:f:m:X:" flag; do
 		case "$flag" in



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511090920.tA99K17Y014452>