#!/bin/bash mkdir -p a rm -f a/.file-timestamps echo file1 > a/file1 # Create the initial timestamp file. This is not really what we're trying to scrutinize with this test. if ! output=$(../../../file-timestamps --generate a) then echo "$0: file-timestamps failed" 1>&2 echo "$output" 1>&2 exit 1 fi case "$output" in equal) # Good; there was no preexisting timestamps file, so this should be equal ;; unequal) echo "Bad: there was no preexisting timestamps file, so this should have been equal" 1>&2 exit 1 ;; *) echo "Bad: strange output found:" 1>&2 echo "$output" 1>&2 exit 1 ;; esac # Create a new file, and regenerate the timestamps file. It should come up "unequal". echo file2 > a/file2 if ! output=$(../../../file-timestamps --generate a) then echo "$0: file-timestamps failed" 1>&2 echo "$output" 1>&2 exit 1 fi case "$output" in unequal) # Good; the change was detected. exit 0 ;; equal) echo "Bad: change not detected" 1>&2 exit 1 ;; *) echo "Bad: strange output found:" 1>&2 echo "$output" 1>&2 exit 1 ;; esac