lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] valyuta/007 e2f2679c 09/18: Clean up beforehand, not


From: Greg Chicares
Subject: [lmi-commits] [lmi] valyuta/007 e2f2679c 09/18: Clean up beforehand, not afterward
Date: Sun, 24 Apr 2022 18:46:14 -0400 (EDT)

branch: valyuta/007
commit e2f2679c8fbc192355505e769902ffe3c91cc4a7
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Clean up beforehand, not afterward
    
    Formerly, files created as testing artifacts in a temporary directory
    were obliterated at the end of the run. This made it less easy to
    discern the reason for any failure. And anything left over from an
    earlier run became a demonstration of Murphy's Law. And the cleanup
    command was in effect
      rm "$throwaway_dir"/*
    which could have a surprising effect under various circumstances.
    
    Now, the temporary directory is obliterated before its first use, by
      rm -rf "$throwaway_dir"
    which is less unsafe to copy and paste to the command line--so no old
    artifacts can cause trouble, and the files remain for analysis after
    the run completes (or fails to complete). This does waste two megabytes
    of storage, but anyone who cares can clean up manually.
---
 nychthemeral_test.sh | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/nychthemeral_test.sh b/nychthemeral_test.sh
index 737c3d35..3338c343 100755
--- a/nychthemeral_test.sh
+++ b/nychthemeral_test.sh
@@ -363,8 +363,11 @@ java -jar /opt/lmi/third_party/rng/jing.jar -c xrc.rnc 
./*.xrc 2>&1 \
   | tee "$log_dir"/xrc
 
 # Run the following tests in a throwaway directory so that the files
-# they create can be cleaned up easily.
+# they create can be cleaned up easily. To guard against interference
+# from any files left over from previous runs, destroy that directory
+# first, then recreate it.
 throwaway_dir="$log_dir"/tmp
+rm -rf "$throwaway_dir"
 mkdir --parents "$throwaway_dir"
 cd "$throwaway_dir"
 
@@ -458,11 +461,6 @@ printf '%b' "\
 srcdir=. datadir=. /opt/lmi/src/lmi/mst_to_xst.sh
 cmp eraseme.xst eraseme.touchstone
 
-# Clean up stray output. (The zsh '(N)' glob qualifier turns on
-# null_glob for a single expansion.)
-# shellcheck disable=SC2039,SC3002
-for z in "$throwaway_dir"/*(N); do rm "$z"; done
-
 printf '\n# test PETE rebuild\n\n'
 
 # Automatically-generated PETE files are in the repository.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]