#!/bin/bash # With this script, we create a timestamps file for a single file, change it, and test whether the change is detected. # setup mkdir -p a rm -f a/.file-timestamps echo content1 > a/file # 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 # Change the file echo content2 > a/file 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