Commit graph

55 commits

Author SHA1 Message Date
Jose Luis Duran
93b15dbc1f
makefs: tests: Fix timestamp-related tests
Use a variable for mtree that includes the DEFAULT_MTREE_KEYWORDS, in
order to avoid missing the important "time" keyword or passing an
unimplemented "nlink" keyword.

Unskip the "failing" tests, and comment out the specific failing checks,
these will be addressed (or at least discussed) in a different revision.

For MS-DOS tests, use an even value timestamp, as precision is 2s.

For ZFS tests, use import_image instead of mount_image consistently.

Reviewed by:	bnovkov, markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D54429
2026-01-05 20:34:03 +00:00
Jose Luis Duran
96efda9cd5
makefs: tests: Fix -D flag test
As stated in the manual page:

-F is almost certainly not the option you are looking for.  To
create an image from a list of files in an mtree format manifest,
specify it as the last argument on the command line, not as the
argument to -F.

This change does exactly that.  Also bug #192839 has already been fixed.

Reviewed by:	ngie
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D54428
2026-01-05 20:33:27 +00:00
Jose Luis Duran
0a6deb87c2
makefs: tests: Cleanup and remove default flags
Cleanup and remove default atf_check flags for clarity.  The following
two lines are equivalent:

    atf_check $cmd
    atf_check -s exit:0 -e empty -o empty $cmd

Update the links to the reference documents.

Remove the D_flag_cleanup function, as common_cleanup() for these
particular set of tests does two things:

1. Unmount the md(4) device.
2. Destroy the md(4) device.

Essentially, one should only call common_cleanup() if the test body
invokes mount_image().  This is not the case for D_flag_body().

No functional changes intended.

Reviewed by:	ngie
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D54427
2026-01-05 20:32:46 +00:00
Jose Luis Duran
065f02174f
makefs: tests: Double the timeout of ZFS file_extend test
The test makefs_zfs_tests:file_extend is timing out on ci.freebsd.org.
Double the default timeout to allow it to finish.

Reported by:	Jenkins
Reviewed by:	asomers
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D54425
2026-01-05 20:32:24 +00:00
Jose Luis Duran
9f28e92637
makefs: tests: Double the timeout of ZFS compression test
The test makefs_zfs_tests:compression is timing out on ci.freebsd.org.
Double the default timeout to allow it to finish.

While here, check if the file exists before cleaning up, otherwise, cat
may fail.

Reported by:	Jenkins
Reviewed by:	asomers
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D54424
2026-01-05 20:31:40 +00:00
Siva Mahadevan
2cd31bd8fa
makefs/tests: Use require.kmods property instead of ad-hoc checks
Signed-off-by: Siva Mahadevan <me@svmhdvn.name>
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1870
2025-12-17 01:13:47 +08:00
Mark Johnston
68dc9c6b8e makefs/zfs tests: Run in parallel
Use the script PID as a pool GUID.  This way, tests running in parallel
will have pool GUIDs that won't collide, and the tests no longer need to
be serialized.

MFC after:	1 month
2025-07-21 14:57:58 +00:00
Mark Johnston
d8f3e8781b makefs/zfs: Make it possible to set a compression property
makefs currently does not implement compression for ZFS datasets, as
doing so seems somewhat fraught with compatibility issues.  As a result,
the root dataset has compression disabled, and all others inherit from
that.

However, it may be useful to enable compression for new files once the
generated pool is actually imported.  Thus, implement a per-data
compression option.  By default, compression is inherited from the
parent dataset and disabled on the root dataset.

Add a regression test.

PR:		288241
MFC after:	1 month
2025-07-21 14:57:58 +00:00
Bojan Novković
636823cfd2 makefs: Correct license text in 'makefs_msdos_tests.sh'
Sponsored by:   Klara, Inc.
Sponsored by:   The FreeBSD Foundation
2025-07-16 17:07:15 +02:00
Bojan Novković
964b0ece79 makefs: Add tests for the -T flag
Add tests for the -T flag to each makefs backend. This includes tests
for both mtree and directory scan options.

PR:             285630
Sponsored by:   Klara, Inc.
Sponsored by:   The FreeBSD Foundation
Reviewed by:    markj, emaste, kevans, jlduran
Differential Revision:  https://reviews.freebsd.org/D49492
2025-05-20 11:50:31 +02:00
Mark Johnston
ce87828431 makefs: Handle special file types when creating a zpool
Previously, anything other than a regular file, directory or symlink
would cause makefs to exit with an assertion failure.  Make it a bit
more resilient to user error: print a warning and skip the file.  Add a
regression test wherein we create an image from a devfs mount.

PR:		283583
MFC after:	2 weeks
2025-01-07 14:32:20 +00:00
Ed Maste
1f31d43742 makefs: Fix cd9660 duplicate directory names
Previously we could create cd9660 images with duplicate short (level 2)
names.

cd9660_level2_convert_filename used a 30-character limit (for files and
directories), not including the '.' separator.  cd9660_rename_filename
used a 31-character limit, including the '.'.  Directory names 31
characters or longer (without '.') were shortened to 30 characters, and
if a collision occurred cd9660_rename_filename uniquified them starting
with the 31st character.  Unfortunately the directory record's name_len
was already set, so the unique part of the name was stripped off.

Directories are up to 31 d-characters (i.e., A-Z 0-9 and _); there is no
provision for a '.' in a directory name.  Increase the name length limit
to 31 for directories, and exclude '.'s.

This name mapping and deduplication code is still fragile and convoluted
and would beenfit from a more holistic effort.

PR:		283238, 283112
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48251
2024-12-30 14:48:44 -05:00
Mark Johnston
4e15366c6a makefs: Record a larger TXG number in the uberblock
By default, OpenZFS will perform metadata verification of the most
recent TXGs, but this can be very slow since all data in a pool
generated by makefs was logically written in a single transaction.

Avoid triggering this verification by default, but add an option to
restore the previous behaviour and enable it in regression test cases.

Reported by:	cperciva
Tested by:	cperciva (previous version)
MFC after:	2 weeks
2024-10-14 13:14:37 +00:00
Mark Johnston
d9fe718287 makefs: Remove the warning printed when makefs -t zfs is used
We haven't seen bug reports relating to this feature for a while, so
stop printing a warning.

Reviewed by:	cperciva
MFC after:	2 weeks
2024-10-04 15:56:34 +00:00
Warner Losh
e9ac41698b Remove residual blank line at start of Makefile
This is a residual of the $FreeBSD$ removal.

MFC After: 3 days (though I'll just run the command on the branches)
Sponsored by: Netflix
2024-07-15 16:43:39 -06:00
Mark Johnston
7e5002e3d6 makefs/zfs: Add a regression test which checks file access permissions
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2023-11-08 07:18:58 -05:00
Mark Johnston
9f9d18d61e makefs/zfs: Add a regression test which checks the 'used*' properties
PR:		274613
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2023-10-23 11:15:00 -04:00
Mark Johnston
b6da7f2fd1 makefs/zfs tests: Add a test case which appends to a file after import
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2023-09-28 16:36:12 -04:00
Mark Johnston
87534f95dd makefs/zfs tests: Run zdb prior to importing makefs-created pools
zdb contains quite a few assertions that can help catch bugs.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2023-09-27 12:00:00 -04:00
Ed Maste
90aad5d3e4 makefs: clean up some leftovers after $FreeBSD$ tag removal
Fixes: 2a63c3be15
2023-08-16 16:24:37 -04:00
Warner Losh
d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Warner Losh
4d846d260e spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with:		pfg
MFC After:		3 days
Sponsored by:		Netflix
2023-05-12 10:44:03 -06:00
Mark Johnston
09a2fce092 makefs tests: Do not run ZFS tests in parallel
makefs-created pools always have the same GUID and thus cannot be
imported simultaneously.

Reported by:	olivier
2022-08-29 12:54:25 -04:00
Mark Johnston
a3b6b3ac4d makefs tests: Do not install ZFS tests if WITHOUT_ZFS is defined 2022-08-29 12:50:51 -04:00
Mark Johnston
8502144d7a makefs tests: Add test cases for handling of multiple staging dirs
Sponsored by:	The FreeBSD Foundation
2022-08-17 17:28:01 -04:00
Mark Johnston
582ce32ff8 makefs tests: Whitespace fixes
Sponsored by:	The FreeBSD Foundation
2022-08-17 17:28:00 -04:00
Mark Johnston
0726cde8ea makefs tests: Re-enable the ZFS snapshot test
This reverts commit 35b587464a.

PR:		265849
Sponsored by:	The FreeBSD Foundation
2022-08-16 11:02:52 -04:00
Mark Johnston
35b587464a makefs tests: Skip a ZFS regression test in CI
It triggers panics after the latest OpenZFS import.

PR:		265849
2022-08-14 21:37:41 -04:00
Mark Johnston
240afd8c1f makefs: Add ZFS support
This allows one to take a staged directory tree and create a file
consisting of a ZFS pool with one or more datasets that contain the
contents of the directory tree.  This is useful for creating virtual
machine images without using the kernel to create a pool; "zpool create"
requires root privileges and currently is not permitted in jails.
makefs -t zfs also provides reproducible images by using a fixed seed
for pseudo-random number generation, used for generating GUIDs and hash
salts.  makefs -t zfs requires relatively little by way of machine
resources.

The "zpool_reguid" rc.conf setting can be used to ask a FreeBSD guest to
generate a unique pool GUID upon first boot.

A small number of pool and dataset properties are supported.  The pool
is backed by a single disk vdev.  Data is always checksummed using
Fletcher-4, no redundant copies are made, and no compression is used.
The manual page documents supported pool and filesystem properties.

The implementation uses a few pieces of ZFS support from with the boot
loader, especially definitions for various on-disk structures, but is
otherwise standalone and in particular doesn't depend on OpenZFS.

This feature should be treated as experimental for now, i.e., important
data shouldn't be trusted to a makefs-created pool, and the command-line
interface is subject to change.

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35248
2022-08-05 13:42:29 -04:00
Mark Johnston
21add93b58 makefs: Remove execute permission from in-tree test scripts
Let the build system set it as needed.  No functional change intended.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-05-19 11:46:02 -04:00
Alan Somers
ecdc04d006 makefs: fix calculation of file sizes
When a new FS image is created we need to calculate how much space each
file is going to consume.
Fix two bugs in that logic:

1) Count the space needed for indirect blocks for large files.
1) Normally the trailing data of a file is written to a block of frag
   size, 4 kB by default.

However for files that use indirect blocks a full block is allocated,
32kB by default.  Take that into account.

Adjust size calculations to match what is done in ffs_mkfs routine:

* Depending on the UFS version the superblock is stored at a different
  offset. Take that into account.
* Add the cylinder group block size.
* All of the above has to be aligned to the block size.

Finally, Remove "ncg" variable. It's always 1 and it was used to
multiply stuff.

PR:		229929
Reviewed by:	mckusick
MFC after:	2 weeks
Sponsored by:	Semihalf
Submitted by:	Kornel Dulęba <mindal@semihalf.com>
Differential Revision:	https://reviews.freebsd.org/D35131
Differential Revision:	https://reviews.freebsd.org/D35132
2022-05-16 16:32:10 -06:00
Li-Wen Hsu
bfd735d96e Revert r362390, those tests are fixed by r362418
PR:		247425
Sponsored by:	The FreeBSD Foundation
2020-06-23 19:14:38 +00:00
Li-Wen Hsu
865c7b713c Skip ufs related tests in fstyp(8) and makefs(8) temporarily
They are failing after r362358 and r362359.

PR:		247425
Sponsored by:	The FreeBSD Foundation
2020-06-19 17:32:30 +00:00
Ed Maste
286258a9a0 makefs: Fix "time" mtree attribute handling
When processing mtree(5) MANIFEST files, makefs(8) previously threw an
error if it encountered an entry whose "time" attribute contained a
non-zero subsecond component (e.g. time=1551620152.987220000).

Update the handling logic to properly assign the subsecond component if
built with nanosecond support, or silently discard it otherwise.

Also, re-enable the time attribute for the kyua tests.

PR:		194703
Submitted by:	Mitchell Horne <mhorne063@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D19627
2019-03-18 19:26:36 +00:00
Alan Somers
d3f229a463 makefs(8): add test case for PR 229929
Fix two failing makefs test cases by adding "-M 1m", which was already used
for every other FFS test case.  Add a new test case for the underlying
issue: with no -M, -m, or -s options, makefs can underestimate image size.

PR:		229929
Reported by:	Jenkins
MFC after:	2 weeks
2018-07-21 17:24:14 +00:00
Brooks Davis
46b59ac82b Check for cd9660 support before attempting to mount created images
This extends the set in r316028 to allow all tests to pass or be skipped
on a system without cd9660 support.

A better approach using tar is possible, but this works today.

Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D10516
2018-02-02 23:34:33 +00:00
Eitan Adler
a2aef24aa3 Update several more URLs
- Primarily http -> https
- Primarily FreeBSD project URLs
2017-10-29 08:17:03 +00:00
Enji Cooper
d2435d7c28 Require strings(1) with :o_flag_preparer and :o_flag_publisher
strings(1) might not be installed on the system, e.g., if MK_TOOLCHAIN == no

MFC after:	1 week
2017-08-02 20:42:39 +00:00
Alan Somers
6bd94a4679 Fix usr.sbin/makefs/makefs_ffs_tests when /etc/fstab does not exist
dumpfs prints a harmless warning message (via ufs_disk_fillout(3) and
getfsfile(3)), when /etc/fstab does not exist.  We can ignore it.

PR:		220165
Reported by:	gjb
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
2017-06-20 19:00:55 +00:00
Brad Davis
f43b687262 Check to see if the kernel has cd9660 before running tests that require it
Approved by:	ngie
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D10096
2017-03-27 15:20:31 +00:00
Enji Cooper
430f7286a5 Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed
after r298107

Summary of changes:

- Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that
  namespacing is kept with FILES appropriately, and that this shouldn't need
  to be repeated if the namespace changes -- only the definition of PACKAGE
  needs to be changed
- Allow PACKAGE to be overridden by callers instead of forcing it to always be
  `tests`. In the event we get to the point where things can be split up
  enough in the base system, it would make more sense to group the tests
  with the blocks they're a part of, e.g. byacc with byacc-tests, etc
- Remove PACKAGE definitions where possible, i.e. where FILES wasn't used
  previously.
- Remove unnecessary TESTSPACKAGE definitions; this has been elided into
  bsd.tests.mk
- Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES;
  ${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk.
- Fix installation of files under data/ subdirectories in lib/libc/tests/hash
  and lib/libc/tests/net/getaddrinfo
- Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup)

Document the proposed changes in share/examples/tests/tests/... via examples
so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of
replacing FILES. share/mk/bsd.README didn't seem like the appropriate method
of communicating that info.

MFC after: never probably
X-MFC with: r298107
PR: 209114
Relnotes: yes
Tested with: buildworld, installworld, checkworld; buildworld, packageworld
Sponsored by: EMC / Isilon Storage Division
2016-05-04 23:20:53 +00:00
Glen Barber
7d536dc855 MFH
Sponsored by:	The FreeBSD Foundation
2016-03-10 21:16:01 +00:00
Bryan Drewery
15c433351f DIRDEPS_BUILD: Connect MK_TESTS.
Sponsored by:	EMC / Isilon Storage Division
2016-03-09 22:46:01 +00:00
Glen Barber
43faedc133 First pass to fix the 'tests' packages.
Sponsored by:	The FreeBSD Foundation
2016-02-02 22:26:49 +00:00
Enji Cooper
0bd9b70036 Require /sbin/mount_cd9660 when running the cd9660 tests
In some cases the test system might not have mount_cd9660(8). Don't
implicitly rely on it while testing cd9660 support; explicitly rely
on it

MFC after: 1 week
Reported by: mjohnston
Sponsored by: EMC / Isilon Storage Division
2016-01-27 06:14:20 +00:00
Enji Cooper
126b73dd8b Add testcases for -t ffs -o version=[12]
Verify the filesystem type using dumpfs. Add preliminary support
for NetBSD (needs to be validated)

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-11-02 11:06:51 +00:00
Enji Cooper
c213f0dbec 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

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-11-02 10:08:00 +00:00
Enji Cooper
10bd272504 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
MFC after: 1 week
X-MFC with: r290264
Sponsored by: EMC / Isilon Storage Division
2015-11-02 09:16:51 +00:00
Enji Cooper
dc50fb3673 Add a regression test for r289899 to validate rockridge encoding
of device types

X-MFC with: r289899
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
2015-10-24 23:21:08 +00:00
Enji Cooper
fb9ab5ec6b Remove an ls -l I was using for debugging
MFC after: 2 weeks
X-MFC with: r289897
Sponsored by: EMC / Isilon Storage Division
2015-10-24 23:19:24 +00:00