mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-27 20:25:55 -04:00
Replace stat with PERL stat in kasp system test
7249bad7introduced the -c option to stat(1) command, but BSD systems do not know about it. Replace the stat(1) command with a PERL script that achieves the same. Why PERL? For consistency purposes, there are more places in the system test where we use the same method. (cherry picked from commitfe601c5915)
This commit is contained in:
parent
b777649fda
commit
646e00fbb2
2 changed files with 13 additions and 9 deletions
|
|
@ -80,6 +80,10 @@ key_set() {
|
|||
eval "$(key_key "$1" "$2")='$3'"
|
||||
}
|
||||
|
||||
key_stat() {
|
||||
$PERL -e 'print((stat @ARGV[0])[9] . "\n");' "$1"
|
||||
}
|
||||
|
||||
# Save certain values in the KEY array.
|
||||
key_save()
|
||||
{
|
||||
|
|
@ -90,9 +94,9 @@ key_save()
|
|||
# Save creation date.
|
||||
key_set "$1" CREATED "${KEY_CREATED}"
|
||||
# Save key change time.
|
||||
key_set "$1" PRIVKEY_STAT $(stat -c '%Z' "${BASE_FILE}.private")
|
||||
key_set "$1" PUBKEY_STAT $(stat -c '%Z' "${BASE_FILE}.key")
|
||||
key_set "$1" STATE_STAT $(stat -c '%Z' "${BASE_FILE}.state")
|
||||
key_set "$1" PRIVKEY_STAT $(key_stat "${BASE_FILE}.private")
|
||||
key_set "$1" PUBKEY_STAT $(key_stat "${BASE_FILE}.key")
|
||||
key_set "$1" STATE_STAT $(key_stat "${BASE_FILE}.state")
|
||||
}
|
||||
|
||||
# Clear key state.
|
||||
|
|
|
|||
|
|
@ -306,9 +306,9 @@ state_stat=$(key_get KEY1 STATE_STAT)
|
|||
nextpart $DIR/named.run > /dev/null
|
||||
rndccmd 10.53.0.3 loadkeys "$ZONE" > /dev/null || log_error "rndc loadkeys zone ${ZONE} failed"
|
||||
wait_for_log 3 "keymgr: $ZONE done" $DIR/named.run
|
||||
privkey_stat2=$(stat -c '%Z' "${basefile}.private")
|
||||
pubkey_stat2=$(stat -c '%Z' "${basefile}.key")
|
||||
state_stat2=$(stat -c '%Z' "${basefile}.state")
|
||||
privkey_stat2=$(key_stat "${basefile}.private")
|
||||
pubkey_stat2=$(key_stat "${basefile}.key")
|
||||
state_stat2=$(key_stat "${basefile}.state")
|
||||
test "$privkey_stat" = "$privkey_stat2" || log_error "wrong private key file stat (expected $privkey_stat got $privkey_stat2)"
|
||||
test "$pubkey_stat" = "$pubkey_stat2" || log_error "wrong public key file stat (expected $pubkey_stat got $pubkey_stat2)"
|
||||
test "$state_stat" = "$state_stat2" || log_error "wrong state file stat (expected $state_stat got $state_stat2)"
|
||||
|
|
@ -322,9 +322,9 @@ ret=0
|
|||
nextpart $DIR/named.run > /dev/null
|
||||
rndccmd 10.53.0.3 loadkeys "$ZONE" > /dev/null || log_error "rndc loadkeys zone ${ZONE} failed"
|
||||
wait_for_log 3 "keymgr: done" $DIR/named.run
|
||||
privkey_stat2=$(stat -c '%Z' "${basefile}.private")
|
||||
pubkey_stat2=$(stat -c '%Z' "${basefile}.key")
|
||||
state_stat2=$(stat -c '%Z' "${basefile}.state")
|
||||
privkey_stat2=$(key_stat "${basefile}.private")
|
||||
pubkey_stat2=$(key_stat "${basefile}.key")
|
||||
state_stat2=$(key_stat "${basefile}.state")
|
||||
test "$privkey_stat" = "$privkey_stat2" || log_error "wrong private key file stat (expected $privkey_stat got $privkey_stat2)"
|
||||
test "$pubkey_stat" = "$pubkey_stat2" || log_error "wrong public key file stat (expected $pubkey_stat got $pubkey_stat2)"
|
||||
test "$state_stat" = "$state_stat2" || log_error "wrong state file stat (expected $state_stat got $state_stat2)"
|
||||
|
|
|
|||
Loading…
Reference in a new issue