Skip to content

tests/pkd: support -L, --temp-dir=<mkdtemp-template>

Here is a change which teaches the pkd tests a -L flag to enable
running them within dedicated temporary directories, in order to
avoid any file-based interference from multiple pkd instances
executing from the same directory at the same time.

The first three commits fix minor issues I encountered when building
and running the tests locally on macOS.

The last two commits contain the actual change; their descriptions
are copied below.

I have limited time I can spend on this but please let me know if
I can adjust anything for merging. (cc @jjelen @cryptomilk)

Resolves #143 (closed).


633036ec:

Teach `pkd` a new flag `-L, --temp-dir=<mkdtemp-template>` to enable.
behavior whereby `pkd` creates a new temporary directory and uses it
for a workspace while running.

The original design of `pkd` assumed that it could freely use the
current working directory from wherever it happened to be invoked.
But, this could pose a problem when multiple `pkd` instances are run
in parallel from the same working directory, due to the usage of
various temporary files within that directory.

To avoid the problem of multiple `pkd` instances interfering with
each other, expose a `-L` flag for optionally specifying a `mkdtemp`
template string such that a temporary scratch space is used instead.

d1172a72:

Use the new `-L` flag for the pkd tests so that they use a
unique temporary directory for scratch space while running.

Note the choice of `pkd_scratch_XXXXXX` in contrast to a
path living under `/tmp`: by using a relative path, one can
gather the full set of log artifacts from the GitLab CI jobs
in the event that there is a test failure.  The logs contain
lots of information to help pinpoint what went wrong.

Checklist

  • Commits have Signed-off-by: with name/author being identical to the commit author
  • Code modified for feature
  • Test suite updated with functionality tests
  • Test suite updated with negative tests
  • Documentation updated

Reviewer's checklist:

  • Any issues marked for closing are addressed
  • There is a test suite reasonably covering new functionality or modifications
  • Function naming, parameters, return values, types, etc., are consistent and according to CONTRIBUTING.md
  • This feature/change has adequate documentation added
  • No obvious mistakes in the code

Merge request reports

Loading