Unittest - Enhanced support for testing hooks (wip)
* It is now possible to test: * Hook Input/Output on STDIN/STDOUT channels * Exit code of hook script * Execution count (how many times the hook was executed) * Timestamp execution (when was the hook executed - milisec resolution)
This commit is contained in:
16
test/test_hooks/wrapper.sh
Normal file
16
test/test_hooks/wrapper.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
SELF=$(basename $0)
|
||||
ORIGINALHOOK="$(dirname $0)/original_${SELF}"
|
||||
IN="${NEWFILE}.log.in"
|
||||
OUT="${NEWFILE}.log.out"
|
||||
|
||||
# Let it know that we were executed
|
||||
echo "% Called at $(date +%s%N)" >> ${OUT}
|
||||
|
||||
$ORIGINALHOOK < <(tee -a ${IN}) > >(tee -a ${OUT})
|
||||
|
||||
EXITCODE=$?
|
||||
echo "! Exit code: ${EXITCODE}" >> ${OUT}
|
||||
|
||||
exit $EXITCODE
|
||||
Reference in New Issue
Block a user