|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The Lsof Test Suite
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Contents
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
A. Introduction
|
|
Packit Service |
603f59 |
1. Test Suite Goals
|
|
Packit Service |
603f59 |
2. Not a FAQ
|
|
Packit Service |
603f59 |
3. Where have the tests been tested?
|
|
Packit Service |
603f59 |
B. Test Methodology
|
|
Packit Service |
603f59 |
1. Test Limitations
|
|
Packit Service |
603f59 |
2. Test Data Base and Scripts
|
|
Packit Service |
603f59 |
3. The Makefile
|
|
Packit Service |
603f59 |
3.1 The CkTestDB Script
|
|
Packit Service |
603f59 |
4. The Lsof Executable and LT_LSOF_PATH
|
|
Packit Service |
603f59 |
5. Automated Testing
|
|
Packit Service |
603f59 |
C. Configure Script Participation
|
|
Packit Service |
603f59 |
1. config.cc
|
|
Packit Service |
603f59 |
2. config.cflags
|
|
Packit Service |
603f59 |
2.1 config.cflags Contents
|
|
Packit Service |
603f59 |
3. config.ldflags
|
|
Packit Service |
603f59 |
4. config.xobj
|
|
Packit Service |
603f59 |
D. Cleaning -- Quick or Spotless
|
|
Packit Service |
603f59 |
E. Test Libraries
|
|
Packit Service |
603f59 |
1. LTlib.c
|
|
Packit Service |
603f59 |
F. The Individual Tests
|
|
Packit Service |
603f59 |
1. LTbasic, a Basic Lsof Test
|
|
Packit Service |
603f59 |
2. LTbigf, Test Sizes and Offsets for Large
|
|
Packit Service |
603f59 |
(> 32 bit) Files
|
|
Packit Service |
603f59 |
3. LTdnlc, Test the Kernel's Dynamic Name Lookup
|
|
Packit Service |
603f59 |
Cache
|
|
Packit Service |
603f59 |
4. LTlock, Lock Tests
|
|
Packit Service |
603f59 |
5. LTnfs, NFS Test
|
|
Packit Service |
603f59 |
6. LTnlink, Link Count Test
|
|
Packit Service |
603f59 |
7. LTsock, Test IPv4 Sockets
|
|
Packit Service |
603f59 |
8. LTszoff, Test Sizes and Offsets for Small
|
|
Packit Service |
603f59 |
(< 32 bit) Files
|
|
Packit Service |
603f59 |
9. LTunix, Test UNIX Domain Sockets
|
|
Packit Service |
603f59 |
Appendix A, Test Files
|
|
Packit Service |
603f59 |
Appendix B, Test Validations
|
|
Packit Service |
603f59 |
Appendix C, Test Failures
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
A. Introduction
|
|
Packit Service |
603f59 |
===============
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Lsof has an automated test suite whose components are located in
|
|
Packit Service |
603f59 |
the tests/ sub-directory of the lsof top-level directory. Configuring,
|
|
Packit Service |
603f59 |
building and testing lsof can be done with these shell commands:
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
$ Configure -n <dialect-abbreviation>
|
|
Packit Service |
603f59 |
$ make
|
|
Packit Service |
603f59 |
$ cd tests
|
|
Packit Service |
603f59 |
$ make
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
That's all there is to it!
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
But read on for more dirty details.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
A.1. Test Suite Goals
|
|
Packit Service |
603f59 |
=====================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The lsof test suite attempts to test basic lsof features. It does
|
|
Packit Service |
603f59 |
not promise to test every lsof feature for every supported dialect.
|
|
Packit Service |
603f59 |
(That's a nearly impossible goal.)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
As a result, the test suite cannot promise that every lsof feature
|
|
Packit Service |
603f59 |
works as documented. At best the test suite gives some assurance
|
|
Packit Service |
603f59 |
that basic, standard and some optional lsof features work.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
A.2. Not a FAQ
|
|
Packit Service |
603f59 |
==============
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
One caution: this is not a frequently asked questions (FAQ) file
|
|
Packit Service |
603f59 |
for the lsof test suite. FAQs on the lsof test suite will be found
|
|
Packit Service |
603f59 |
in the one and only lsof FAQ in file 00FAQ of the lsof distribution,
|
|
Packit Service |
603f59 |
or on-line at:
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
A.3. Where have the tests been tested?
|
|
Packit Service |
603f59 |
======================================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
OK, I just said this isn't an FAQ and here comes a question and
|
|
Packit Service |
603f59 |
answer that looks like an FAQ. Consider it a very frequently asked
|
|
Packit Service |
603f59 |
question and indulge me -- let me answer it here.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The lsof test suite hasn't been tested everywhere it might be
|
|
Packit Service |
603f59 |
possible to build lsof successfully. That "everywhere" includes
|
|
Packit Service |
603f59 |
dialect versions -- e.g., Solaris < 2.6 -- to which I no longer
|
|
Packit Service |
603f59 |
have access. On some dialect versions to which I have access, some
|
|
Packit Service |
603f59 |
tests won't run because the test system lacks support.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
In "Appendix B, Test Validations" I've tried to list where I compiled
|
|
Packit Service |
603f59 |
and tested the test suite and information on any tests I was unable
|
|
Packit Service |
603f59 |
to run. In "Appendix C, Test Failures" I list where the test suite
|
|
Packit Service |
603f59 |
fails and why it failed.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
A.4 Where are the tests?
|
|
Packit Service |
603f59 |
========================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This is another FAQ whose answer is that the tests are in the tests/
|
|
Packit Service |
603f59 |
sub-directory of the main lsof source directory.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
B. Test Methodology
|
|
Packit Service |
603f59 |
===================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The test suite is made up of individual C programs. Test setup is
|
|
Packit Service |
603f59 |
performed by the lsof Configure script itself, which writes a set
|
|
Packit Service |
603f59 |
of dialect configuration files in the tests/ subdirectory. (See
|
|
Packit Service |
603f59 |
"C. Configure Script Participation.")
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Each program or script performs a specialized tests. Those tests
|
|
Packit Service |
603f59 |
are described below in "F. The Individual Tests".
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Each test measures lsof functionality by putting a specific lsof
|
|
Packit Service |
603f59 |
command execution at the end of an in-bound (to the test) pipe.
|
|
Packit Service |
603f59 |
The caller asks lsof to write its results to the pipe in field
|
|
Packit Service |
603f59 |
output form. (See the -F option in the lsof man page.)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Using an in-bound lsof pipe allows the tests to measure a great
|
|
Packit Service |
603f59 |
deal of lsof functionality, including as an interesting side effect,
|
|
Packit Service |
603f59 |
the performance of field output. Consequently, there's no special
|
|
Packit Service |
603f59 |
field output test.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
B.1. Test Limitations
|
|
Packit Service |
603f59 |
=====================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
One limitation of the tests is that they don't measure lsof formatted
|
|
Packit Service |
603f59 |
output -- i.e., the output normally see when lsof is run. There
|
|
Packit Service |
603f59 |
are just too many variants of lsof output produced across the range
|
|
Packit Service |
603f59 |
of dialects where lsof runs, so field output is a more consistent
|
|
Packit Service |
603f59 |
way to process lsof output.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
But using field output does mean that the test suite doesn't check
|
|
Packit Service |
603f59 |
for lsof formatting problems, except in the field output itself.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
B.2. Test Data Base and Scripts
|
|
Packit Service |
603f59 |
===============================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The TestDB file contains a simple data base that describes where
|
|
Packit Service |
603f59 |
the tests have been validated. Entries are formed from a combination
|
|
Packit Service |
603f59 |
of the lines in the config.cflags file produced by the lsof Configure
|
|
Packit Service |
603f59 |
script. The entries can be considered "lsof dialect footprints,"
|
|
Packit Service |
603f59 |
hereafter simply called "dialect footprints" or just "footprints."
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Two shell scripts support TestDB. The first, Add2TestDB, will add
|
|
Packit Service |
603f59 |
a footprint to TestDB. I don't recommend you use this script.
|
|
Packit Service |
603f59 |
Mostly it's for my use when I find that the test suite has been
|
|
Packit Service |
603f59 |
validated on a new dialect.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
It's also possible to add a footprint to TestDB by simply editing
|
|
Packit Service |
603f59 |
TestDB and pasting into it a copy of the footprint reported by a
|
|
Packit Service |
603f59 |
failed Makefile rule. I don't generally recommend this be done,
|
|
Packit Service |
603f59 |
either.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
There are Makefile rules that use (and avoid) the CkTestDB script.
|
|
Packit Service |
603f59 |
(See "B.3 The Makefile".)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The default (i.e., "all") Makefile rule uses the CkTestDB script
|
|
Packit Service |
603f59 |
to look for the footprint in TestDB. If no footprint is found, the
|
|
Packit Service |
603f59 |
script issues a warning, displays the unfound footprint, and asks
|
|
Packit Service |
603f59 |
if running the test suite should continue.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The "auto" Makefile rule also uses CkTestDB, but with a special
|
|
Packit Service |
603f59 |
call that causes CkTestDB to look in TestDB for the footprint,
|
|
Packit Service |
603f59 |
report it when it can't be found, and then fail. That CkTestDB
|
|
Packit Service |
603f59 |
failure causes the "auto" rule to fail, too.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The "silent" Makefile rule doesn't use CkTestDB to look in TestDB
|
|
Packit Service |
603f59 |
for the footprint. It runs the standard and basic tests as silently
|
|
Packit Service |
603f59 |
as possible, then returns a failure or success exit code that
|
|
Packit Service |
603f59 |
signals the result of the running of the tests. (Use the "silent"
|
|
Packit Service |
603f59 |
rule carefully, because it will skip proving the tests have previously
|
|
Packit Service |
603f59 |
run on the dialect.)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
B.3. The Makefile
|
|
Packit Service |
603f59 |
=======================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The Makefile runs the tests in the test suite. It has these rules.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
all runs the basic test and the standard tests,
|
|
Packit Service |
603f59 |
interacting with the caller should the footprint
|
|
Packit Service |
603f59 |
not be found in TestDB.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
(This is the default rule.)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
auto runs the basic test and the standard tests on a
|
|
Packit Service |
603f59 |
previously validated system as silently as possible.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The footprint must be found in TestDB for this rule
|
|
Packit Service |
603f59 |
to succeed. (See the "silent" rule for one that
|
|
Packit Service |
603f59 |
avoids checking TestDB.)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This rule is designed for lsof build scripts that
|
|
Packit Service |
603f59 |
want a quick noiseless test to make sure what they
|
|
Packit Service |
603f59 |
built works as it previously did.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This rule calls CkTestDB in a way that inhibits
|
|
Packit Service |
603f59 |
its normal go-ahead request. (See "B.2.1 The CkTestDB
|
|
Packit Service |
603f59 |
Script".) If CkTestDB finds the footprint and all
|
|
Packit Service |
603f59 |
tests succeed, this rule returns a zero exit code
|
|
Packit Service |
603f59 |
(success). If the footprint isn't found or if any
|
|
Packit Service |
603f59 |
test fails, a non-zero exit code (failure) is
|
|
Packit Service |
603f59 |
returned.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
ckDB calls the CkTestDB script to look for a footprint.
|
|
Packit Service |
603f59 |
If none is found, the way CkTestDB was called (See
|
|
Packit Service |
603f59 |
"B.3.1 The CkTestDB Script".) causes it to return
|
|
Packit Service |
603f59 |
a non-zero exit code (failure) to this rule, and
|
|
Packit Service |
603f59 |
the rule then returns a non-zero exit code (failure)
|
|
Packit Service |
603f59 |
itself.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This rule is used by the "auto" rule. If this rule
|
|
Packit Service |
603f59 |
succeeds (zero exit code), the "auto" rule then
|
|
Packit Service |
603f59 |
uses the "silent" rule.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
clean removes test and compiler output. (See the "D.
|
|
Packit Service |
603f59 |
Cleaning -- Quick or Spotless" section.)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
opt runs the optional tests.
|
|
Packit Service |
603f59 |
optional
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
silent runs the lsof basic and standard tests as silently
|
|
Packit Service |
603f59 |
as possible (as the "auto" rule does), but without
|
|
Packit Service |
603f59 |
using CkTestDB to look for a footprint. If all
|
|
Packit Service |
603f59 |
tests succeed, the rule returns a zero exit code
|
|
Packit Service |
603f59 |
(success). If any test fails, the rule returns a
|
|
Packit Service |
603f59 |
non-zero exit code (failure).
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Use the "silent" rule carefully, because it will
|
|
Packit Service |
603f59 |
skip proving the tests have previously run on the
|
|
Packit Service |
603f59 |
dialect.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
spotless does what the clean rule does and also removes the
|
|
Packit Service |
603f59 |
config.* files created by ../Configure. (See the
|
|
Packit Service |
603f59 |
"D. Cleaning -- Quick or Spotless" section.)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
std runs the basic test and the standard tests.
|
|
Packit Service |
603f59 |
standard
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The Makefile cleaning rules are further described in "D. Cleaning
|
|
Packit Service |
603f59 |
-- Quick or Spotless."
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
B.3.1 The CkTestDB Script
|
|
Packit Service |
603f59 |
=========================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Some Makefile rules (e.g., "all" and "auto") use the CkTestDB script
|
|
Packit Service |
603f59 |
to make sure the tests have been run previously on the dialect.
|
|
Packit Service |
603f59 |
CkTestDB does that by looking for the dialect's footprint in TestDB.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
If no footprint is found, and if standard input is a TTY, CkTestDB
|
|
Packit Service |
603f59 |
asks for a go-ahead signal. If standard input isn't a TTY, CkTestDB
|
|
Packit Service |
603f59 |
aborts the test run. (See "B.2. Test Data Base and Scripts".)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The Makefile "silent" rule does not call CkTestDB. use the "silent"
|
|
Packit Service |
603f59 |
rule carefully, because it will skip proving the tests have previously
|
|
Packit Service |
603f59 |
run on the dialect.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
B.4. The Lsof Executable and LT_LSOF_PATH
|
|
Packit Service |
603f59 |
=========================================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Normally the programs in the test suite use the lsof executable in
|
|
Packit Service |
603f59 |
their parent directory, ../lsof. Usually that lsof has just been
|
|
Packit Service |
603f59 |
built and testing it is the next logical step.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Be careful that ../lsof has sufficient permission to access the
|
|
Packit Service |
603f59 |
necessary kernel resources -- e.g., /dev/kmem, /dev/mem, /proc,
|
|
Packit Service |
603f59 |
etc. If it doesn't the tests will fail. (The tests do check to
|
|
Packit Service |
603f59 |
see if they can open /dev/mem and /dev/kmem for read access if
|
|
Packit Service |
603f59 |
LT_KMEM is defined in config.cflags and if the path to the lsof
|
|
Packit Service |
603f59 |
executable is ../lsof.)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Here are two possible ways you can make sure the lsof being tested
|
|
Packit Service |
603f59 |
has sufficient permission: 1) use chmod and chgrp to enable its
|
|
Packit Service |
603f59 |
running and put its path in LT_LSOF_PATH, thus disabling the check
|
|
Packit Service |
603f59 |
in the tests for kernel memory access; or 2) run the tests (and
|
|
Packit Service |
603f59 |
hence the lsof being tested) under a login that has sufficient
|
|
Packit Service |
603f59 |
permission -- e.g., is in a group that can read /dev/kmem.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
You can direct the tests to use a different lsof executable by
|
|
Packit Service |
603f59 |
specifying its path in the LT_LSOF_PATH environment variable. To
|
|
Packit Service |
603f59 |
test an lsof executable already installed in /usr/local/etc --
|
|
Packit Service |
603f59 |
provided that lsof is at revision 4.63 or higher -- do this:
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
$ LT_LSOF_PATH=/usr/local/etc/lsof
|
|
Packit Service |
603f59 |
$ export LT_LSOF_PATH
|
|
Packit Service |
603f59 |
$ cd .../lsof_<version>/tests
|
|
Packit Service |
603f59 |
$ make
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
When you specify an alternate executable path via LT_LSOF_PATH,
|
|
Packit Service |
603f59 |
that also prevents the tests from checking to see if they have
|
|
Packit Service |
603f59 |
kernel memory access.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
B.5 Automated Testing
|
|
Packit Service |
603f59 |
=====================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Normally the lsof test suite is wordy and may require interaction.
|
|
Packit Service |
603f59 |
When you want to avoid those interferences, use the Makefile "auto"
|
|
Packit Service |
603f59 |
or "silent" rules. (See the description of the "auto" and "silent"
|
|
Packit Service |
603f59 |
rules in "B.3 The Makefile".)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The footprint must be present in TestDB in order to use the "auto"
|
|
Packit Service |
603f59 |
rule. If it is not, the "auto" rule will fail and report the
|
|
Packit Service |
603f59 |
missing footprint. Footprints in TestDB proclaim that the tests
|
|
Packit Service |
603f59 |
have previously succeeded on the dialect.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The footprint need not be present in TestDB in order to use the
|
|
Packit Service |
603f59 |
"silent" rule. Use the "silent" rule carefully, because it will
|
|
Packit Service |
603f59 |
skip proving the tests have previously run on the dialect.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
C. Configure Script Participation
|
|
Packit Service |
603f59 |
=================================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
An important step in setting up the test suite is performed by the
|
|
Packit Service |
603f59 |
Configure script in the lsof home directory (the parent to tests/.)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Configure writes four files in tests/ that describe how the tests
|
|
Packit Service |
603f59 |
are to be compiled, configured and loaded. The files also describe
|
|
Packit Service |
603f59 |
options that Configure selected that are important to the test
|
|
Packit Service |
603f59 |
suite.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
C.1. config.cc
|
|
Packit Service |
603f59 |
==============
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This file, config.cc, contains the name of or the path to the C
|
|
Packit Service |
603f59 |
compiler used to compile lsof. The Makefile uses this file in
|
|
Packit Service |
603f59 |
place of the standard make(1) CC string with a shell in-place
|
|
Packit Service |
603f59 |
execution statement -- i.e., `cat config.cc`.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
If the LSOF_CC environment variable is supplied to the lsof Configure
|
|
Packit Service |
603f59 |
script, its value will appear in the config.cc file.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
C.2. config.cflags
|
|
Packit Service |
603f59 |
==================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This file, config.cflags, contains C compiler flags that Makefile
|
|
Packit Service |
603f59 |
uses to compile the C programs in the test suite. As with the
|
|
Packit Service |
603f59 |
compiler file, config.cc, the make rules incorporate the contents
|
|
Packit Service |
603f59 |
of this file into C compiler options with `cat config.cflags`.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This file is also used by the Add2TestDB and CkTestDB shell scripts
|
|
Packit Service |
603f59 |
to build and match footprints. (See "B.2. Test Data Base and
|
|
Packit Service |
603f59 |
Scripts.")
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
C.2.1 config.cflags Contents
|
|
Packit Service |
603f59 |
============================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The config.cflags file may contain the following C compiler flags.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
-DLT_AIXA is present if lsof was built for AIX.
|
|
Packit Service |
603f59 |
It contains the AIX architecture flag.
|
|
Packit Service |
603f59 |
(See the lsof Configure script or
|
|
Packit Service |
603f59 |
dialects/aix/dlsof.h for more information
|
|
Packit Service |
603f59 |
on the AIX architecture flag.)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
-DLT_BIGF is present if lsof was built for a dialect
|
|
Packit Service |
603f59 |
that has large file (sizes and offsets >
|
|
Packit Service |
603f59 |
32 bits).
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
-DLT_CC is present if the lsof compiler is cc.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
-DLT_DEV64 is present if the FreeBSD dialect uses a 64
|
|
Packit Service |
603f59 |
devite type.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
-DLT_DIAL_ always ends in (the part) the
|
|
Packit Service |
603f59 |
"canonical" -- i.e., usually the most
|
|
Packit Service |
603f59 |
common abbreviation by which the dialect
|
|
Packit Service |
603f59 |
is known.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Example: -DLT_DIAL_solaris
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
-DLT_GCC is present if the lsof compiler is gcc.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
-DLT_K64 is present if lsof has been built for a
|
|
Packit Service |
603f59 |
64 bit kernel
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
-DLT_KMEM is present if lsof has been built to
|
|
Packit Service |
603f59 |
use /dev/kmem to obtain kernel values.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
-DLT_VERS=<vn> contains the version number for the
|
|
Packit Service |
603f59 |
dialect, as used in lsof pre-processor
|
|
Packit Service |
603f59 |
tests.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Example for Solaris 10: -DLT_VERS=100000
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
-DLT_VPATH is present if the dialect has the v_path
|
|
Packit Service |
603f59 |
member in the vnode structure (e.g., some
|
|
Packit Service |
603f59 |
versions of Solaris 10).
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The config.cflags file may also contain dialect-specific compiler
|
|
Packit Service |
603f59 |
flags needed to activate a specific feature on the dialect. For
|
|
Packit Service |
603f59 |
example, for HP-UX config.cflags might contain:
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
-D_LARGEFILE64_SOURCE This compiler flag enables the use of
|
|
Packit Service |
603f59 |
large-file system library functions
|
|
Packit Service |
603f59 |
--e.g., open64().
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The lsof Configure script stanzas for
|
|
Packit Service |
603f59 |
the dialects select these options.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
C.3. config.ldflags
|
|
Packit Service |
603f59 |
===================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This file, config.ldflags, contains the dialect loader flags --
|
|
Packit Service |
603f59 |
i.e., the equivalent to make(1) LFLAGS -- for loading the test
|
|
Packit Service |
603f59 |
programs.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Example for Solaris: -lsocket this adds the socket library
|
|
Packit Service |
603f59 |
to the loading of the lsof
|
|
Packit Service |
603f59 |
test programs.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Example for UnixWare: -lsocket -lnsl this adds the socket and
|
|
Packit Service |
603f59 |
name server libraries to
|
|
Packit Service |
603f59 |
the loading of the lsof
|
|
Packit Service |
603f59 |
test programs.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
C.4. config.xobj
|
|
Packit Service |
603f59 |
================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This file, config.xobj, contains the paths to any extra object
|
|
Packit Service |
603f59 |
files (.o's) that must be loaded when the test suite C programs
|
|
Packit Service |
603f59 |
are loaded. Like config.cc and config.cflags, it's incorporated
|
|
Packit Service |
603f59 |
into the loader statements of the Makefile's rules with `cat
|
|
Packit Service |
603f59 |
config.xobj`.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Examples for DEC OSF/1 and NEXTSTEP:
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
../lib/snpf.o this loads the private lsof object file
|
|
Packit Service |
603f59 |
that contains an snprintf() function. (The
|
|
Packit Service |
603f59 |
DEC OSF/1 4.0 and NEXTSTEP 3.1 C libraries
|
|
Packit Service |
603f59 |
don't have snprintf().)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
D. Cleaning -- Quick or Spotless
|
|
Packit Service |
603f59 |
================================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
There are two Makefile rules that clean the tests/ subdirectory --
|
|
Packit Service |
603f59 |
"clean" and "spotless". They cause different degrees of cleaning.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
clean a "quick" clean that removes compiled object files,
|
|
Packit Service |
603f59 |
executables and test files. It does NOT remove
|
|
Packit Service |
603f59 |
the configuration files that ../Configure and the
|
|
Packit Service |
603f59 |
config.perl rule wrote.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
spotless cleans out everything clean does -- plus the
|
|
Packit Service |
603f59 |
configuration files that ../Configure and the
|
|
Packit Service |
603f59 |
config.perl rule wrote.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This is the rule used when `./Configure -clean` is
|
|
Packit Service |
603f59 |
specified. If this rule is used, `../Configure -n
|
|
Packit Service |
603f59 |
` and `../make`) must be run again before
|
|
Packit Service |
603f59 |
the test suite can be used.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
E. Test Library
|
|
Packit Service |
603f59 |
===============
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The lsof test suite provides a C library.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
E.1. LTlib.c
|
|
Packit Service |
603f59 |
============
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This is a C library of common functions used by tests. Configured
|
|
Packit Service |
603f59 |
at compile time by the contents of config.cflags, it uses the single
|
|
Packit Service |
603f59 |
header file LsofTest.h. LsofTest.h tailors its definitions to the
|
|
Packit Service |
603f59 |
dialect at compile time, using the LT_DIAL_* definitions in
|
|
Packit Service |
603f59 |
config.cflags.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Two particularly useful functions in the library are: ExecLsof(),
|
|
Packit Service |
603f59 |
which will execute an lsof child process; and RdFromLsof(), which
|
|
Packit Service |
603f59 |
will read from the in-bound lsof pipe, and decode the fields into
|
|
Packit Service |
603f59 |
structures that are easy for C programs to process.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This library is a good model for processing field output in a C
|
|
Packit Service |
603f59 |
program from an in-bound lsof pipe.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The source for the library, LTlib.c, contains more documentation.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
F. The Individual Tests
|
|
Packit Service |
603f59 |
=======================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The individual tests are listed in this section. The listings
|
|
Packit Service |
603f59 |
explain what the tests do, a few errors they might report, and how
|
|
Packit Service |
603f59 |
to use options and environment variables to customize the tests.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The test descriptions are listed in this section in alphabetical
|
|
Packit Service |
603f59 |
order, not in the order they are run by Makefile.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The Makefile runs the tests in three groups, basic tests, standard
|
|
Packit Service |
603f59 |
tests, and optional tests. The default make "all" rule runs the
|
|
Packit Service |
603f59 |
basic and standard tests. (The "standard", "std", and "test"
|
|
Packit Service |
603f59 |
Makefile rules are synonyms to "all".) If the standard tests succeed,
|
|
Packit Service |
603f59 |
Makefile suggests running the optional tests with the "opt" (or
|
|
Packit Service |
603f59 |
"optional") rule.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The Makefile "auto" and "silent" rules run only the basic and
|
|
Packit Service |
603f59 |
standard tests. They do not run or suggest you run the optional
|
|
Packit Service |
603f59 |
tests.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The basic test:
|
|
Packit Service |
603f59 |
LTbasic
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Standard tests:
|
|
Packit Service |
603f59 |
LTnlink
|
|
Packit Service |
603f59 |
LTsock
|
|
Packit Service |
603f59 |
LTszoff
|
|
Packit Service |
603f59 |
LTunix
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Optional tests:
|
|
Packit Service |
603f59 |
LTbigf
|
|
Packit Service |
603f59 |
LTdnlc
|
|
Packit Service |
603f59 |
LTlock
|
|
Packit Service |
603f59 |
LTnfs
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The basic and standard tests should all succeed on all dialects,
|
|
Packit Service |
603f59 |
although LTnlink may warn that it can't perform its unlink test on
|
|
Packit Service |
603f59 |
an NFS file system.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The optional tests may run, they may be disabled for specific
|
|
Packit Service |
603f59 |
dialects, or they may fail because of special resource needs --
|
|
Packit Service |
603f59 |
e.g., LTbigf will run only on UNIX dialects where it knows how to
|
|
Packit Service |
603f59 |
handle files whose lengths exceed 32 bits, and LTnfs needs access
|
|
Packit Service |
603f59 |
to an NFS file system mounted from a remote NFS server.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Tests that need special resources usually provide a hint about the
|
|
Packit Service |
603f59 |
resources when they fail. Information about special resource needs
|
|
Packit Service |
603f59 |
may also be found in the following sections about the individual
|
|
Packit Service |
603f59 |
tests.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
G.1. LTbasic, a Basic Lsof Test
|
|
Packit Service |
603f59 |
===============================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This is the basic lsof test. If it doesn't run, it's not likely
|
|
Packit Service |
603f59 |
any other tests will run, either. Hence, if it fails, no Makefile
|
|
Packit Service |
603f59 |
rule runs any other tests.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This test uses lsof to locate files in the lsof process, including
|
|
Packit Service |
603f59 |
current working directory, the lsof executable, and the /dev/kmem
|
|
Packit Service |
603f59 |
open file.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Finding the lsof executable may not be possible on AIX if lsof was
|
|
Packit Service |
603f59 |
compiled without support for its -X option.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Finding /dev/kmem use by lsof is only possible on dialects where
|
|
Packit Service |
603f59 |
lsof uses /dev/kmem. The -DLT_KMEM define indicates that.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Run this test:
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
$ ./LTbasic
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Environment variables: LT_LSOF_PATH defines the path to the lsof
|
|
Packit Service |
603f59 |
executable. (The default is ../lsof.)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
G.2. LTbigf, Test Sizes and Offsets for Large (> 32 bit) Files
|
|
Packit Service |
603f59 |
==============================================================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This is a test in the optional test group.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This test is effective only when ../Configure has put -DLT_BIGF in
|
|
Packit Service |
603f59 |
config.cflags. Without that definition this test simply reports
|
|
Packit Service |
603f59 |
that the dialect doesn't support large files. That report is
|
|
Packit Service |
603f59 |
accompanied by a successful test exit code, so that the runner of
|
|
Packit Service |
603f59 |
the test (e.g., the Makefile) won't believe the test failed.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
When a dialect does support large files, the test attempts to create
|
|
Packit Service |
603f59 |
a file that looks very large -- e.g., has a length as reported by
|
|
Packit Service |
603f59 |
ls(1) of 0x140000000 bytes. However, the file really has only a
|
|
Packit Service |
603f59 |
small amount of data in it, the rest of the file consists of a
|
|
Packit Service |
603f59 |
large standard UNIX file system "hole."
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
By default the test file is named config.LTbigf<PID>, where PID is
|
|
Packit Service |
603f59 |
the Process ID of the LTbigf process.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
When that file is not on a file system enabled for large files, or
|
|
Packit Service |
603f59 |
when the process that runs LTbigf can't create a big file, LTbigf
|
|
Packit Service |
603f59 |
will report an error. The error will be accompanied by hints that
|
|
Packit Service |
603f59 |
the -p option may need to be used to define a path where the test
|
|
Packit Service |
603f59 |
can write a large file, or the process ulimit file block size may
|
|
Packit Service |
603f59 |
need to be raised -- e.g., to "unlimited."
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
LTbigf can't test file offset reporting on Linux kernels below
|
|
Packit Service |
603f59 |
2.6.22, because the /proc file systems of those kernels don't make
|
|
Packit Service |
603f59 |
file offsets available to lsof.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Run this test:
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
$ ./LTbigf [-p <path>]
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Environment variables: LT_LSOF_PATH defines the path to the lsof
|
|
Packit Service |
603f59 |
executable. (The default is ../lsof.)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
G.3. LTdnlc, Test the Kernel's Dynamic Name Lookup Cache
|
|
Packit Service |
603f59 |
========================================================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This is a test in the optional test group.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This test asks lsof to locate the current working directory of its
|
|
Packit Service |
603f59 |
own process and report the path it has assembled from the components
|
|
Packit Service |
603f59 |
it found in the kernel's Dynamic Name Lookup Cache (DNLC) or via
|
|
Packit Service |
603f59 |
other dialect-specific methods. (E.g., Linux, HP-UX 11.11, and
|
|
Packit Service |
603f59 |
some Tru64 UNIX versions have private name lookup methods.)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The test checks what lsof reports as the current working directory
|
|
Packit Service |
603f59 |
path for any missing components and counts the number of full paths
|
|
Packit Service |
603f59 |
returned. (Symbolic link complications prevent testing for exact
|
|
Packit Service |
603f59 |
path matches.) The test is repeated. If full paths are returned
|
|
Packit Service |
603f59 |
at least half the time, the test considers itself successful.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This test can't be run on AIX, because lsof can't access the DNLC
|
|
Packit Service |
603f59 |
there. It can't be run on Apple Darwin versions below 8.0, either,
|
|
Packit Service |
603f59 |
because insufficiently reliable DNLC information is available there.
|
|
Packit Service |
603f59 |
This test may fail on other dialects when the file system -- e.g., NFS.
|
|
Packit Service |
603f59 |
/tmp, loopback -- doesn't fully participate in the dialect's DNLC.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Run this test:
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
$ ./LTdnlc
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Environment variables: LT_LSOF_PATH defines the path to the lsof
|
|
Packit Service |
603f59 |
executable. (The default is ../lsof.)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
G.4. LTlock, Lock Tests
|
|
Packit Service |
603f59 |
=======================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This is a test in the optional test group.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This test uses flock() and fcntl() to set and clear file locks,
|
|
Packit Service |
603f59 |
and measures lsof's ability to report them. The choice of system
|
|
Packit Service |
603f59 |
lock call is based on the dialect. (There are LT_DIAL_* pre-processor
|
|
Packit Service |
603f59 |
tests in LTlock.c.)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This test can't be run on an NFS client file system, because NFS
|
|
Packit Service |
603f59 |
lock information is kept on the server. Lsof on the client can't
|
|
Packit Service |
603f59 |
see that server kernel data.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
By default the test attempts to create a file named config.LTlock<PID>,
|
|
Packit Service |
603f59 |
where PID is the Process ID of the locking test process. It uses
|
|
Packit Service |
603f59 |
lsof to determine if the file is on a client NFS file system. If
|
|
Packit Service |
603f59 |
it is, the test aborts, hinting that the -p option can be used to
|
|
Packit Service |
603f59 |
specify a non-client-NFS test file path.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This test can't be run on Darwin, because insufficient file system
|
|
Packit Service |
603f59 |
lock information is available to lsof there.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Run this test:
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
$ ./LTlock [-p <path>]
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Environment variables: LT_LSOF_PATH defines the path to the lsof
|
|
Packit Service |
603f59 |
executable. (The default is ../lsof.)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
G.6. LTnfs, NFS Test
|
|
Packit Service |
603f59 |
====================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This is a test in the optional test group.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This test verifies that lsof can locate files mounted on a client
|
|
Packit Service |
603f59 |
NFS system from an NFS server.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
By default it creates a test file, config.LTnfs<PID>, where PID is
|
|
Packit Service |
603f59 |
the Process ID of the test process. The test then uses lsof to
|
|
Packit Service |
603f59 |
find the file on an NFS file system.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
If lsof can't find the file the test warns that the test file might
|
|
Packit Service |
603f59 |
not be on an NFS file system and hints that the -p option may be
|
|
Packit Service |
603f59 |
used to specify the path of an NFS file, provided the test can have
|
|
Packit Service |
603f59 |
read access to it there. The test warning also states that the
|
|
Packit Service |
603f59 |
file at the path specified with -p must be a regular file, not a
|
|
Packit Service |
603f59 |
directory.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This test can't be run on Darwin versions below 8.0, because
|
|
Packit Service |
603f59 |
insufficient NFS file information is available to lsof there.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Run this test:
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
$ ./LTnfs [-p <path>]
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Environment variables: LT_LSOF_PATH defines the path to the lsof
|
|
Packit Service |
603f59 |
executable. (The default is ../lsof.)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
G.7. LTnlink, Link Count Test
|
|
Packit Service |
603f59 |
=============================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This is a test in the standard test group.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The test checks lsof's reporting of link count (nlink in UNIX
|
|
Packit Service |
603f59 |
argot.)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
It creates a test file in the current working directory named
|
|
Packit Service |
603f59 |
config.LTnlink<PID>, where PID is the Process ID of the test
|
|
Packit Service |
603f59 |
process. It then uses stat(2) and lsof to measure the link count
|
|
Packit Service |
603f59 |
of the file.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
If LTnlink creates the test file in the current working directory
|
|
Packit Service |
603f59 |
and it is on an NFS file system, LTnlink won't be able to perform
|
|
Packit Service |
603f59 |
one section of its test. In that section the test file is unlinked
|
|
Packit Service |
603f59 |
so its link count will be zero and lsof is asked to find it among
|
|
Packit Service |
603f59 |
the set of files whose link counts are zero.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
When an NFS file is unlinked its link count isn't reduced until
|
|
Packit Service |
603f59 |
the last open instance is closed on either the NFS clients or the
|
|
Packit Service |
603f59 |
NFS. That's a consequence of NFS statelessness and leads to the
|
|
Packit Service |
603f59 |
occasional presence of files with names of the form .nfsxxxx.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Should LTnlink find its test file on an NFS file system, it disables
|
|
Packit Service |
603f59 |
the unlink section of its tests and issues a warning. It also
|
|
Packit Service |
603f59 |
issues a hint that the test file path can be named via the -p option
|
|
Packit Service |
603f59 |
to give a test file location that isn't on an NFS file system.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This test can't be run on Darwin, because insufficient file system link
|
|
Packit Service |
603f59 |
count information is available to lsof there.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Because some UNIX dialects delay the reporting of a link count
|
|
Packit Service |
603f59 |
update after a file has been unlinked, LTnlink may not get its
|
|
Packit Service |
603f59 |
expected response from lsof for a while after the test file has
|
|
Packit Service |
603f59 |
been unlinked. In that cause LTnlink may delay for up to a minute,
|
|
Packit Service |
603f59 |
calling lsof once every two seconds and displaying a "waiting for
|
|
Packit Service |
603f59 |
link count update: ..." message.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Some file systems -- e.g., ZFS on Solaris 11 -- don't allow LTnlink to
|
|
Packit Service |
603f59 |
unlink its test file, because LTnlink has the file open. LTnlink
|
|
Packit Service |
603f59 |
explains that failure and suggests that it be run with path of the "-p
|
|
Packit Service |
603f59 |
path" option set to a file on /tmp. See 00FAQ for more information.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Run this test:
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
$ ./LTnlink [-p <path>]
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Environment variables: LT_LSOF_PATH defines the path to the lsof
|
|
Packit Service |
603f59 |
executable. (The default is ../lsof.)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
G.7. LTsock, Test IPv4 Sockets
|
|
Packit Service |
603f59 |
==============================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This is a test in the standard test group.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This test uses lsof to locate open IPv4 socket files that the test
|
|
Packit Service |
603f59 |
has created itself. The test opens a server socket, then forks a
|
|
Packit Service |
603f59 |
child process to connect to that socket. After both are running,
|
|
Packit Service |
603f59 |
the test uses lsof to find the open socket files at their known
|
|
Packit Service |
603f59 |
host and port addresses.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Run this test:
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
$ ./LTsock
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Environment variables: LT_LSOF_PATH defines the path to the lsof
|
|
Packit Service |
603f59 |
executable. (The default is ../lsof.)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
G.8. LTszoff, Test Sizes and Offsets for Small (< 32 bit) Files
|
|
Packit Service |
603f59 |
===============================================================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This is a test in the standard test group.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This test checks lsof's reporting of file size and offset for small
|
|
Packit Service |
603f59 |
(< 32 bits) files.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
It creates a test file in the current working directory named
|
|
Packit Service |
603f59 |
config.LTszoff<PID>. PID is the Process ID of the test process.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
LTszoff can't test file offset reporting on Linux kernels below
|
|
Packit Service |
603f59 |
2.6.22, because the /proc file systems of those kernels don't make
|
|
Packit Service |
603f59 |
file offsets available to lsof.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Run this test:
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
$ ./LTszoff [-p <path>]
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Environment variables: LT_LSOF_PATH defines the path to the lsof
|
|
Packit Service |
603f59 |
executable. (The default is ../lsof.)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
G.9. LTunix, Test UNIX Domain Sockets
|
|
Packit Service |
603f59 |
======================================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This is a test in the standard test group.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This test checks lsof's reporting of UNIX domain sockets.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The test creates a pair of UNIX domain sockets and uses bind(2) to
|
|
Packit Service |
603f59 |
associate the file system names config.LT0U<PID> (client) and
|
|
Packit Service |
603f59 |
config.LT1U<PID> (server) with them. (PID is the test process ID.)
|
|
Packit Service |
603f59 |
The test then uses lsof to find the two open UNIX domain socket
|
|
Packit Service |
603f59 |
files.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Run this test:
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
$ ./LTunix
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Environment variables: LT_LSOF_PATH defines the path to the lsof
|
|
Packit Service |
603f59 |
executable. (The default is ../lsof.)
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Appendix A, Test Files
|
|
Packit Service |
603f59 |
======================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
These files may be created by suite tests.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Created
|
|
Packit Service |
603f59 |
./tests Name by Test Use
|
|
Packit Service |
603f59 |
============ ======= ===
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
config.LTbifg** LTbigf to test lsof's large file size
|
|
Packit Service |
603f59 |
and offset reporting
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
config.LTlock* LTlock for locking tests
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
config.LTnfs* LTnfs for NFS tests
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
config.LTnlink* LTnlink for link count tests
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
config.LTszoff* LTszoff for small file size and and
|
|
Packit Service |
603f59 |
offset reporting
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
config.LT[01]U* LTunix two UNIX domain sockets, used
|
|
Packit Service |
603f59 |
to determine if lsof can report
|
|
Packit Service |
603f59 |
their open instances properly
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Appendix B, Test Validations
|
|
Packit Service |
603f59 |
============================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
This appendix lists the UNIX dialects and their versions where I
|
|
Packit Service |
603f59 |
have validated the test suite. The list indicates the particular
|
|
Packit Service |
603f59 |
tests I was unable to run, mostly LTnfs because the test systems
|
|
Packit Service |
603f59 |
I used had no NFS file systems mounted.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
The information in the following table is encoded in a test data
|
|
Packit Service |
603f59 |
base file, TestDB, as footprints, using the tests compiler options
|
|
Packit Service |
603f59 |
written to config.cflags by the lsof Configure script. See "B.2.
|
|
Packit Service |
603f59 |
Test Data Base and Scripts" for more information on the test data
|
|
Packit Service |
603f59 |
base, footprints, and the scripts that support them.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
UNIX
|
|
Packit Service |
603f59 |
Dialect Dialect Description Untested Tests
|
|
Packit Service |
603f59 |
======= =================== ==============
|
|
Packit Service |
603f59 |
AIX 4.3.3, Power, cc
|
|
Packit Service |
603f59 |
5.1, Power-32, cc
|
|
Packit Service |
603f59 |
5.1, Power-32, gcc
|
|
Packit Service |
603f59 |
5.1, Power-64, cc
|
|
Packit Service |
603f59 |
5.2, Power-32, cc
|
|
Packit Service |
603f59 |
5.2, Power-32, gcc
|
|
Packit Service |
603f59 |
5.2, Power-64, cc
|
|
Packit Service |
603f59 |
5.2, Power-64, gcc
|
|
Packit Service |
603f59 |
5.3, Power-64, cc
|
|
Packit Service |
603f59 |
Darwin 1.4, 5.5, 6.x, 7.x gcc Darwin lsof doesn't
|
|
Packit Service |
603f59 |
have adequate support
|
|
Packit Service |
603f59 |
to allow the LTbigf,
|
|
Packit Service |
603f59 |
Ltdnlc, LTlock, LTnfs,
|
|
Packit Service |
603f59 |
and LTnlink tests to
|
|
Packit Service |
603f59 |
run.
|
|
Packit Service |
603f59 |
8.0, gcc Darwin lsof doesn't
|
|
Packit Service |
603f59 |
have adequate support
|
|
Packit Service |
603f59 |
to allow the LTbigf,
|
|
Packit Service |
603f59 |
LTlock and LTnlink
|
|
Packit Service |
603f59 |
tests to run.
|
|
Packit Service |
603f59 |
9.0, gcc Darwin lsof doesn't
|
|
Packit Service |
603f59 |
have adequate support
|
|
Packit Service |
603f59 |
to allow the LTlock
|
|
Packit Service |
603f59 |
test to run.
|
|
Packit Service |
603f59 |
10.0, gcc Darwin lsof doesn't
|
|
Packit Service |
603f59 |
have adequate support
|
|
Packit Service |
603f59 |
to allow the LTlock test
|
|
Packit Service |
603f59 |
to run.
|
|
Packit Service |
603f59 |
11.0, gcc Darwin lsof doesn't
|
|
Packit Service |
603f59 |
have adequate support
|
|
Packit Service |
603f59 |
to allow the LTlock test
|
|
Packit Service |
603f59 |
to run.
|
|
Packit Service |
603f59 |
FreeBSD 4.5, i386, gcc
|
|
Packit Service |
603f59 |
4.6, i386, gcc
|
|
Packit Service |
603f59 |
4.7, i386, gcc
|
|
Packit Service |
603f59 |
4.8, i386, gcc
|
|
Packit Service |
603f59 |
4.9, i386, gcc
|
|
Packit Service |
603f59 |
4.10, i386 gcc
|
|
Packit Service |
603f59 |
5.0, Alpha, gcc
|
|
Packit Service |
603f59 |
5.0, Sparc, gcc
|
|
Packit Service |
603f59 |
5.0, i386, gcc
|
|
Packit Service |
603f59 |
5.1, Alpha, gcc
|
|
Packit Service |
603f59 |
5.1, Amd64, gcc
|
|
Packit Service |
603f59 |
5.1, Sparc, gcc
|
|
Packit Service |
603f59 |
5.1, i386, gcc
|
|
Packit Service |
603f59 |
5.2, i386, gcc
|
|
Packit Service |
603f59 |
5.2, Alpha, gcc
|
|
Packit Service |
603f59 |
5.2, Amd64, gcc
|
|
Packit Service |
603f59 |
5.2, Sparc, gcc
|
|
Packit Service |
603f59 |
5.3, Alpha, gcc
|
|
Packit Service |
603f59 |
5.4, Alpha, gcc
|
|
Packit Service |
603f59 |
5.5, Alpha, gcc
|
|
Packit Service |
603f59 |
6.0, Alpha, gcc
|
|
Packit Service |
603f59 |
6.0, Amd64, gcc
|
|
Packit Service |
603f59 |
6.0, Sparc, gcc
|
|
Packit Service |
603f59 |
6.1, i386, gcc
|
|
Packit Service |
603f59 |
6.4, i386, gcc
|
|
Packit Service |
603f59 |
7.0 Alpha, gcc
|
|
Packit Service |
603f59 |
7.0 Amd64, gcc
|
|
Packit Service |
603f59 |
7.1 Amd64, gcc
|
|
Packit Service |
603f59 |
7.2 Amd64, gcc
|
|
Packit Service |
603f59 |
7.3 Amd64, gcc
|
|
Packit Service |
603f59 |
7.4 Amd64, gcc
|
|
Packit Service |
603f59 |
8.0 Amd64, gcc
|
|
Packit Service |
603f59 |
8.2 Amd64, gcc
|
|
Packit Service |
603f59 |
8.3 Amd64, gcc
|
|
Packit Service |
603f59 |
8.4 Amd64, gcc
|
|
Packit Service |
603f59 |
9.0 Amd64, gcc
|
|
Packit Service |
603f59 |
10.0 Amd64, gcc
|
|
Packit Service |
603f59 |
10.0 Amd64, clang
|
|
Packit Service |
603f59 |
11.0 Amd64, clang
|
|
Packit Service |
603f59 |
12.0 Amd64, clang
|
|
Packit Service |
603f59 |
DEC OSF/1 4.0, cc
|
|
Packit Service |
603f59 |
HP-UX 10.20, cc LTbigf
|
|
Packit Service |
603f59 |
10.20, gcc (1) LTbigf
|
|
Packit Service |
603f59 |
11.00-32, ANSI-C LTbigf, LTnfs
|
|
Packit Service |
603f59 |
11.00-64, ANSI-C
|
|
Packit Service |
603f59 |
11.11, ANSI-C
|
|
Packit Service |
603f59 |
11.23, ANSI-C
|
|
Packit Service |
603f59 |
Linux 2.4.12-686 LTbigf, no offset tests
|
|
Packit Service |
603f59 |
LTszoff, no offset tests
|
|
Packit Service |
603f59 |
2.4.18-686 LTbigf, no offset tests
|
|
Packit Service |
603f59 |
LTszoff, no offset tests
|
|
Packit Service |
603f59 |
2.4.21-686 LTbigf, no offset tests
|
|
Packit Service |
603f59 |
LTszoff, no offset tests
|
|
Packit Service |
603f59 |
2.4.23-686 LTbigf, no offset tests
|
|
Packit Service |
603f59 |
LTszoff, no offset tests
|
|
Packit Service |
603f59 |
2.4.24-686 LTbigf, no offset tests
|
|
Packit Service |
603f59 |
LTszoff, no offset tests
|
|
Packit Service |
603f59 |
2.4.25-686 LTbigf, no offset tests
|
|
Packit Service |
603f59 |
LTszoff, no offset tests
|
|
Packit Service |
603f59 |
2.4.26-686 LTbigf, no offset tests
|
|
Packit Service |
603f59 |
LTszoff, no offset tests
|
|
Packit Service |
603f59 |
2.4.27-686 LTbigf, no offset tests
|
|
Packit Service |
603f59 |
LTszoff, no offset tests
|
|
Packit Service |
603f59 |
2.4.28-686 LTbigf, no offset tests
|
|
Packit Service |
603f59 |
LTszoff, no offset tests
|
|
Packit Service |
603f59 |
2.4.29-686 LTbigf, no offset tests
|
|
Packit Service |
603f59 |
LTszoff, no offset tests
|
|
Packit Service |
603f59 |
2.4.30-686 LTbigf, no offset tests
|
|
Packit Service |
603f59 |
LTszoff, no offset tests
|
|
Packit Service |
603f59 |
2.6.1-rc2 LTbigf, no offset tests
|
|
Packit Service |
603f59 |
LTszoff, no offset tests
|
|
Packit Service |
603f59 |
2.6.18-686 LTbigf, no offset tests
|
|
Packit Service |
603f59 |
LTszoff, no offset tests
|
|
Packit Service |
603f59 |
2.6.22-686 (Note: this Linux kernel
|
|
Packit Service |
603f59 |
supplies file offsets to
|
|
Packit Service |
603f59 |
lsof.)
|
|
Packit Service |
603f59 |
2.6.32-686 (Note: this Linux kernel
|
|
Packit Service |
603f59 |
supplies file offsets to
|
|
Packit Service |
603f59 |
lsof.)
|
|
Packit Service |
603f59 |
2.6.38-686
|
|
Packit Service |
603f59 |
3.10.004
|
|
Packit Service |
603f59 |
3.10.08
|
|
Packit Service |
603f59 |
4.14.14
|
|
Packit Service |
603f59 |
3.10.0-229.1.2.el7
|
|
Packit Service |
603f59 |
NEXTSTEP 3.1, gcc LTnfs
|
|
Packit Service |
603f59 |
NetBSD 1.4.1, Alpha, gcc LTnfs
|
|
Packit Service |
603f59 |
1.5x, x86, gcc LTnfs
|
|
Packit Service |
603f59 |
1.6x, Alpha, gcc LTnfs
|
|
Packit Service |
603f59 |
1.6x, x86, gcc LTnfs
|
|
Packit Service |
603f59 |
2.0x, alpha, gcc LTnfs
|
|
Packit Service |
603f59 |
2.0x, sparc64, gcc LTnfs
|
|
Packit Service |
603f59 |
2.0x, x86, gcc LTnfs
|
|
Packit Service |
603f59 |
2.99.9, x86, gcc LTnfs
|
|
Packit Service |
603f59 |
2.99.10, x86, gcc LTnfs
|
|
Packit Service |
603f59 |
2.99.11, x86, gcc LTnfs
|
|
Packit Service |
603f59 |
2.99.12, x86, gcc LTnfs
|
|
Packit Service |
603f59 |
3.99., x86, gcc LTnfs
|
|
Packit Service |
603f59 |
OpenBSD 3.0, gcc
|
|
Packit Service |
603f59 |
3.1, gcc
|
|
Packit Service |
603f59 |
3.2, gcc
|
|
Packit Service |
603f59 |
3.3, gcc
|
|
Packit Service |
603f59 |
3.4, gcc
|
|
Packit Service |
603f59 |
3.5, gcc
|
|
Packit Service |
603f59 |
3.6, gcc
|
|
Packit Service |
603f59 |
3.7, gcc
|
|
Packit Service |
603f59 |
3.9, gcc
|
|
Packit Service |
603f59 |
OPENSTEP 4.2, gcc LTnfs
|
|
Packit Service |
603f59 |
OSR 5.04, cc LTnfs
|
|
Packit Service |
603f59 |
5.06, cc LTnfs
|
|
Packit Service |
603f59 |
Solaris 2.6, cc LTnfs
|
|
Packit Service |
603f59 |
2.6, gcc LTnfs
|
|
Packit Service |
603f59 |
7-32, cc
|
|
Packit Service |
603f59 |
7-32, gcc LTnfs
|
|
Packit Service |
603f59 |
8-32, cc
|
|
Packit Service |
603f59 |
8-32, gcc
|
|
Packit Service |
603f59 |
8-64, cc
|
|
Packit Service |
603f59 |
8-64, gcc
|
|
Packit Service |
603f59 |
9-64, Beta-Refresh, cc
|
|
Packit Service |
603f59 |
9-64, Beta-Refresh, gcc
|
|
Packit Service |
603f59 |
9-64, FCS, cc
|
|
Packit Service |
603f59 |
9-64, FCS, gcc
|
|
Packit Service |
603f59 |
10-32, i86pc, gcc
|
|
Packit Service |
603f59 |
10-32, i86pc, cc
|
|
Packit Service |
603f59 |
10-64, Sparc, cc
|
|
Packit Service |
603f59 |
10-64, Sparc, gcc
|
|
Packit Service |
603f59 |
11-64, Amd64, cc
|
|
Packit Service |
603f59 |
Tru64 UNIX 5.0, cc
|
|
Packit Service |
603f59 |
Tru64 UNIX 5.0, cc
|
|
Packit Service |
603f59 |
5.1, cc
|
|
Packit Service |
603f59 |
UnixWare 7.1.1, NSC, cc LTnfs
|
|
Packit Service |
603f59 |
7.1.3, cc
|
|
Packit Service |
603f59 |
7.1.4, cc
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
If you are able to run the test suite on dialect versions other
|
|
Packit Service |
603f59 |
than the ones listed above, please send e-mail to <abe@purdue.edu>,
|
|
Packit Service |
603f59 |
indicating the dialect version where you were able to run the test
|
|
Packit Service |
603f59 |
suite. Please send me the footprint formed by CkTestDB, or run
|
|
Packit Service |
603f59 |
the Add2TestDB script and send me the footprint it reports.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
If you encounter problems compiling the tests or running them on
|
|
Packit Service |
603f59 |
a dialect version listed above, please send e-mail to <abe@purdue.edu>,
|
|
Packit Service |
603f59 |
naming the dialect version and providing the output from the lsof
|
|
Packit Service |
603f59 |
Configure script and make operation.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
1) John Dzubera did the HP-UX 10.20 gcc testing and provided its
|
|
Packit Service |
603f59 |
footprint.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Appendix C, Test Failures
|
|
Packit Service |
603f59 |
=========================
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
I was unable to make the test suite run on the following dialects.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
UNIX Dialect
|
|
Packit Service |
603f59 |
and Description Failure
|
|
Packit Service |
603f59 |
=============== =======
|
|
Packit Service |
603f59 |
HP-UX 11-64, gcc 64 bit gcc 3.0 didn't compile the LTsock
|
|
Packit Service |
603f59 |
test correctly on my 64 bit HP-UX 11 test
|
|
Packit Service |
603f59 |
system.
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
|
|
Packit Service |
603f59 |
Vic Abell <abe@purdue.edu>
|
|
Packit Service |
603f59 |
February 14, 2018
|