aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/makefs/tests/makefs_cd9660_tests.sh
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/makefs/tests/makefs_cd9660_tests.sh')
-rw-r--r--usr.sbin/makefs/tests/makefs_cd9660_tests.sh120
1 files changed, 115 insertions, 5 deletions
diff --git a/usr.sbin/makefs/tests/makefs_cd9660_tests.sh b/usr.sbin/makefs/tests/makefs_cd9660_tests.sh
index 8a3ac1684032..e058dfc57b7b 100644
--- a/usr.sbin/makefs/tests/makefs_cd9660_tests.sh
+++ b/usr.sbin/makefs/tests/makefs_cd9660_tests.sh
@@ -23,9 +23,6 @@
# 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.
-#
-# $FreeBSD$
-#
# A note on specs:
# - A copy of the ISO-9660 spec can be found here:
@@ -54,8 +51,8 @@ common_cleanup()
check_base_iso9660_image_contents()
{
# Symlinks are treated like files when rockridge support isn't
- # specified
- check_image_contents "$@" -X c
+ # specified, and directories cannot contain a '.'.
+ check_image_contents "$@" -X c -X .g -X _g
atf_check -e empty -o empty -s exit:0 test -L $TEST_INPUTS_DIR/c
atf_check -e empty -o empty -s exit:0 test -f $TEST_MOUNT_DIR/c
@@ -377,6 +374,114 @@ o_flag_rockridge_dev_nodes_cleanup()
common_cleanup
}
+atf_test_case T_flag_dir cleanup
+T_flag_dir_body()
+{
+ timestamp=1742574909
+ check_cd9660_support
+ create_test_dirs
+
+ mkdir -p $TEST_INPUTS_DIR/dir1
+ atf_check -e empty -o empty -s exit:0 \
+ $MAKEFS -T $timestamp -o rockridge $TEST_IMAGE $TEST_INPUTS_DIR
+
+ mount_image
+ eval $(stat -s $TEST_MOUNT_DIR/dir1)
+ atf_check_equal $st_atime $timestamp
+ atf_check_equal $st_mtime $timestamp
+ atf_check_equal $st_ctime $timestamp
+}
+
+T_flag_dir_cleanup()
+{
+ common_cleanup
+}
+
+atf_test_case T_flag_F_flag cleanup
+T_flag_F_flag_body()
+{
+ atf_expect_fail "-F doesn't take precedence over -T"
+ timestamp_F=1742574909
+ timestamp_T=1742574910
+ create_test_dirs
+ mkdir -p $TEST_INPUTS_DIR/dir1
+
+ atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \
+ mtree -c -k "type,time" -p $TEST_INPUTS_DIR
+ change_mtree_timestamp $TEST_SPEC_FILE $timestamp_F
+ atf_check -e empty -o not-empty -s exit:0 \
+ $MAKEFS -F $TEST_SPEC_FILE -T $timestamp_T -o rockridge $TEST_IMAGE $TEST_INPUTS_DIR
+
+ mount_image
+ eval $(stat -s $TEST_MOUNT_DIR/dir1)
+ atf_check_equal $st_atime $timestamp_F
+ atf_check_equal $st_mtime $timestamp_F
+ atf_check_equal $st_ctime $timestamp_F
+}
+
+T_flag_F_flag_cleanup()
+{
+ common_cleanup
+}
+
+atf_test_case T_flag_mtree cleanup
+T_flag_mtree_body()
+{
+ timestamp=1742574909
+ create_test_dirs
+ mkdir -p $TEST_INPUTS_DIR/dir1
+
+ atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \
+ mtree -c -k "type" -p $TEST_INPUTS_DIR
+ atf_check -e empty -o empty -s exit:0 \
+ $MAKEFS -T $timestamp -o rockridge $TEST_IMAGE $TEST_SPEC_FILE
+
+ check_cd9660_support
+ mount_image
+ eval $(stat -s $TEST_MOUNT_DIR/dir1)
+ atf_check_equal $st_atime $timestamp
+ atf_check_equal $st_mtime $timestamp
+ atf_check_equal $st_ctime $timestamp
+}
+
+T_flag_mtree_cleanup()
+{
+ common_cleanup
+}
+
+atf_test_case duplicate_names cleanup
+duplicate_names_head()
+{
+ atf_set "descr" "Ensure shortened directory names are unique (PR283238)"
+}
+duplicate_names_body()
+{
+ check_cd9660_support
+ create_test_dirs
+
+ # Create three directories which are identical in the first 31 characters.
+ dir_prefix="this_directory_name_is_31_chars"
+ mkdir -p $TEST_INPUTS_DIR/${dir_prefix}1
+ mkdir -p $TEST_INPUTS_DIR/${dir_prefix}2
+ mkdir -p $TEST_INPUTS_DIR/${dir_prefix}3
+
+ atf_check -e empty -o empty -s exit:0 \
+ $MAKEFS -o rockridge $TEST_IMAGE $TEST_INPUTS_DIR
+
+ # Disable Rock Ridge extensions to read the plain ISO Level 2 names.
+ mount_image -r
+
+ # The specific way the short names are made unique is not important.
+ # We verify only that there are three unique names and that the unique
+ # part is at the end of the name.
+ atf_check_equal $(ls -1 $TEST_MOUNT_DIR | sort | uniq | wc -l) 3
+ atf_check_equal $(ls -1 $TEST_MOUNT_DIR | cut -c -29 | sort | uniq | wc -l) 1
+}
+duplicate_names_cleanup()
+{
+ common_cleanup
+}
+
atf_init_test_cases()
{
atf_add_test_case D_flag
@@ -395,4 +500,9 @@ atf_init_test_cases()
atf_add_test_case o_flag_publisher
atf_add_test_case o_flag_rockridge
atf_add_test_case o_flag_rockridge_dev_nodes
+ atf_add_test_case T_flag_dir
+ atf_add_test_case T_flag_F_flag
+ atf_add_test_case T_flag_mtree
+
+ atf_add_test_case duplicate_names
}