%__rex_examples %{_docdir}/apache-rex/ %__rex_run_dir ./apache-rex %__rex_logfile %{__rex_run_dir}/run_log %__rex_verbosity 0 # # macro: run supplied apache runnable example # # usage: %apache_rex_check [parameters] example_dir # # parameters: -r run_base_dir where to write examples output, logs, etc. # default: see %{__rex_run_dir} # -v verbosity verbosity of the output [0, 1, 2] # default: see %{__rex_verbosity} # %apache_rex_check(r:) \ EXAMPLE_DIR="%1" \ if [ -z "%1" ]; then \ echo "ERROR: no example dir provided" \ exit 1 \ fi \ if [ ! -d "$EXAMPLE_DIR" ]; then \ EXAMPLE_DIR="%{__rex_examples}%1" \ if [ ! -d "$EXAMPLE_DIR" ]; then \ echo "ERROR: example %1 not found" \ exit 1 \ fi \ fi \ REX_RUN_DIR="%{-r:%{-r*}}" \ if [ -z "$REX_RUN_DIR" ]; then \ REX_RUN_DIR='%{__rex_run_dir}' \ fi \ REX_VERBOSITY="%{-v:%{-v*}}" \ if [ -z "$REX_VERBOSITY" ]; then \ REX_VERBOSITY='%{__rex_verbosity}' \ fi \ echo "HERE $PWD, creating $REX_RUN_DIR" \ mkdir -p $REX_RUN_DIR \ ls -ld $PWD/$REX_RUN_DIR \ VERBOSITY=%{__rex_verbosity} RUN_DIR_BASE=$PWD/$REX_RUN_DIR run-rex $EXAMPLE_DIR | tee %{__rex_logfile} \ if grep -q 'FAILED RUNS:' %{__rex_logfile}; then \ echo "ERROR: example %1 failed, see %{__rex_logfile}" \ exit 1 \ fi \ %nil