AFP_SPECTEST(1)

๐ŸŽ€ NAME ๐ŸŽ€

Hey bestie! ๐Ÿ’– This is the AFP_SPECTEST(1) page from the Netatalk AFP Fileserver Manual, and it's all about afp_spectest, the AFP specification compliance test suite โœจ

๐Ÿ’… SYNOPSIS ๐Ÿ’…

Okay, here's how you call it:

afp_spectest [-1234567aCEimVv] [-h host] [-H host2] [-p port] [-s
volume] [-c path to volume] [-S volume2] [-u user] [-d user2] [-w
password] [-f test]

afp_spectest -l

๐ŸŒธ DESCRIPTION ๐ŸŒธ

afp_spectest is a comprehensive AFP specification test suite with several hundreds of test cases ๐Ÿคฏ The tests are sorted into testsets, grouped either by the AFP command being tested or by the preconditions needed to test it ๐Ÿงš

You can see every available testset with -l. Want to run a single test or a whole testset? Use -f ๐Ÿฆ‹

โœจ OPTIONS โœจ

Okay, the options are where it gets spicy ๐ŸŒถ๏ธ Here's the whole menu:

  • -1 โ€” Uses the AFP 2.1 protocol version ๐Ÿ’ซ
  • -2 โ€” Uses the AFP 2.2 protocol version ๐Ÿ’ซ
  • -3 โ€” Uses the AFP 3.0 protocol version ๐Ÿ’ซ
  • -4 โ€” Uses the AFP 3.1 protocol version ๐Ÿ’ซ
  • -5 โ€” Uses the AFP 3.2 protocol version ๐Ÿ’ซ
  • -6 โ€” Uses the AFP 3.3 protocol version ๐Ÿ’ซ
  • -7 โ€” Uses the AFP 3.4 protocol version. This one's the default ๐Ÿ‘‘
  • -a โ€” Tells the test runner that the server under test stores AppleDouble v2 metadata, not filesystem EA ๐Ÿ—‚๏ธ
  • -c path โ€” The local filesystem path to the test volume. You need this for tier 2 tests ๐Ÿ› ๏ธ
  • -C โ€” Turns off ANSI colors in the terminal output. No rainbows for you ๐ŸŒˆ
  • -d user โ€” A second username for logging in to the AFP server ๐Ÿ‘ฏ
  • -E โ€” Empties the test volume before the tests run ๐Ÿงน
WARNING: This will delete all files and directories in the test volume! Do NOT point this at a volume you actually care about ๐Ÿ’€
  • -f test โ€” Picks the test or testset you want to run ๐ŸŽฏ
  • -h host โ€” The server hostname or IP address. It defaults to localhost ๐Ÿ 
  • -H host โ€” The server hostname or IP address for the second host ๐Ÿ–ฅ๏ธ
  • -i โ€” Interactive mode! It asks you before each test. Mostly for debugging ๐Ÿ”
  • -l โ€” Lists every available testset, then exits ๐Ÿ“œ
  • -m โ€” Runs the tests in AppleShare (Mac) AFP server compatibility mode ๐ŸŽ
  • -p port โ€” The server port number. The default is 548 ๐Ÿ”Œ
  • -s volume โ€” The volume name to mount for testing ๐Ÿ“‚
  • -S volume โ€” The volume name for a second volume to mount for testing ๐Ÿ“
  • -u user โ€” The username for logging in to the AFP server. It defaults to the current uid ๐Ÿ™‹
  • -v โ€” Verbose output ๐Ÿ“ฃ
  • -V โ€” Very verbose output. Extra chatty, extra iconic ๐Ÿ“ข
  • -w password โ€” The password for logging in to the AFP server ๐Ÿ”

๐Ÿง  USAGE ๐Ÿง 

Every test in the spectest suite follows the same general pattern and parameters. Some tests need extra required parameters or preconditions, though ๐Ÿค“ First you set the AFP protocol version (-1 through -7), then you give the address and credentials of the host you're testing. That host can be localhost. Some tests also need a second user and a second volume defined ๐Ÿ‘ฏโ€โ™€๏ธ

The so-called tier 2 (T2) tests have to run from localhost, and you have to give the local path to the volume under test with -c. Why? They modify the file system directly with system calls, both to set up preconditions and to check results ๐Ÿ› ๏ธ

There are also read-only and sleep tests, and those have to be run separately ๐Ÿซถ

๐Ÿ”ฎ Extension mapping tests

A handful of tests in the FPGetFileDirParms testset expect the filename extension to Classic Mac OS Type/Creator mapping to be turned on. In version 3 and later of netatalk, you have to enable this yourself by editing extmap.conf(5). Uncomment the lines for the mappings you want in that configuration file ๐ŸŽ€

๐Ÿ˜ด Sleep tests

The FPzzz testset holds tests for AFP sleep mode and timeouts. These take way longer than everything else, so they're not included when you run the full spectest suite ๐Ÿข You have to run that testset on its own with -f:

afp_spectest -f FPzzz

๐Ÿ‘€ Readonly tests

As the name suggests, the Readonly testset checks how netatalk behaves when the shared volume is in read-only mode ๐Ÿ“–

Obviously, the volume you test has to be configured as read-only. You can do that by setting read only = yes in afp.conf, for example:

[test volume]
path = /my/path
volume name = test_volume
read only = yes

The tests expect at least two files and one directory in the read-only shared volume. Set that up like this:

echo "testfile uno" > /my/path/first.txt
echo "testfile dos" > /my/path/second.txt
mkdir /my/path/third

Then run the Readonly testset:

afp_spectest -s test_volume -f Readonly

๐Ÿšฆ Return codes

Each test in a testsuite returns one of these return codes:

  • 0 โ€” PASSED ๐ŸŽ‰
  • 1 โ€” FAILED ๐Ÿ˜ญ
  • 2 โ€” NOT TESTED ๐Ÿซ 
  • 3 โ€” SKIPPED ๐Ÿ™ˆ

NOT TESTED means a test setup step or precondition check failed. This return code flags the whole test run as failed, so it's a big deal ๐Ÿ’€

SKIPPED means the test doesn't apply to the AFP server you're testing, or a parameter the test needs is missing. Check the test report for the specific reason it got skipped. This one won't count against your test run โœจ

๐ŸŽ Testing an AppleShare AFP server

This suite was designed mainly for Netatalk AFP servers, but it can also test an AppleShare AFP server hosted by an older Mac OS X or Classic Mac OS system ๐Ÿ’œ

To test an AppleShare server, launch the test runner with the -m (Mac) option. In this mode, the runner reports tests with known current or historical differences between AppleShare and Netatalk ๐Ÿ“

If AppleShare and Netatalk differ, or if AppleShare results differ between versions, you'll see something like this:

header.dsi_code       -5000     AFPERR_ACCESS
MAC RESULT: -5019 AFPERR_PARAM    -5010 AFPERR_BUSY
Netatalk returns AFPERR_ACCESS when a Mac return AFPERR_PARAM or AFPERR_BUSY

When AppleShare and Netatalk used to return different results but now behave the same way, you'll get this:

Warning MAC and Netatalk now same RESULT!

Apart from these cases, the spectest should return the same results whether you run it against a native AppleShare AFP server or against Netatalk ๐Ÿซถ

๐Ÿ“š EXAMPLES ๐Ÿ“š

โš™๏ธ Configure environment

Here's a sample setup for running the AFP spec tests. Right now, the test runner only supports ClearTxt and Guest authentication ๐Ÿ”‘

  • 2 users: user1 and user2, with the same password
  • 1 group: afpusers
  • user1 and user2 are both in the afpusers group

Arrange two empty directories. Some tests will fail if there are leftover files in the test directories ๐Ÿงน

drwxrwsr-x    5 user1   afpusers       176 avr 27 23:56 /tmp/afptest1
drwxrwsr-x    5 user1   afpusers       176 avr 27 23:56 /tmp/afptest2

Then set up afp.conf like this:

[Global]
uam list = uams_clrtxt.so uams_guest.so

[testvol1]
ea = sys
path = /tmp/afptest1
valid users = @afpusers
volume name = testvol1

[testvol2]
ea = sys
path = /tmp/afptest2
valid users = @afpusers
volume name = testvol2

๐Ÿƒโ€โ™€๏ธ Running tests

Let's run afp_spectest against the AFP server on 10.0.0.10, using the FPSetForkParms_test testset with AFP 3.4 ๐Ÿ’…

% afp_spectest -h 10.0.0.10 -u user1 -d user2 -w passwd -s testvol1 -S testvol2 -c /srv/afptest1 -7 -f FPSetForkParms_test
===================
FPSetForkParms_test
-------------------
FPSetForkParms:test62: SetForkParams errors - PASSED
FPSetForkParms:test141: Setforkmode error - PASSED
FPSetForkParms:test217: Setfork size 64 bits - PASSED
FPSetForkParms:test306: set fork size, new size > old size - PASSED

๐Ÿ”— SEE ALSO ๐Ÿ”—

Check out these friends too ๐Ÿงš


That's the whole tea, bestie! ๐Ÿซถ This page came from Netatalk 4.5.1, and it's AFP_SPECTEST(1) all the way through. Stay iconic and keep testing ๐Ÿ’–โœจ

๐Ÿ“ฆ where this page comes from
  • fedora 44: netatalk-afptest 5:4.5.1-1.fc44 ยท GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND LicenseRef-Callaway-LGPLv2+ AND LicenseRef-Callaway-BSD AND FSFUL AND LicenseRef-Callaway-MIT
  • ๐Ÿ’– girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms