diff --git a/src/generate.c b/src/generate.c index caba446..ea937d7 100644 --- a/src/generate.c +++ b/src/generate.c @@ -739,6 +739,12 @@ int generate_box(sentry_t *thebox) int rc; int i; + if (is_debug_logging(MAIN)) { + for (i = 0; i < NUM_SHAPES; i++) { + debug_print_shape(opt.design->shape + i); + } + } + rc = horiz_generate(&(thebox[0]), &(thebox[2])); if (rc) { goto err; diff --git a/src/shape.c b/src/shape.c index d10225c..817819c 100644 --- a/src/shape.c +++ b/src/shape.c @@ -468,8 +468,9 @@ void debug_print_shape(sentry_t *shape) log_debug(__FILE__, MAIN, "NULL\n"); return; } - log_debug(__FILE__, MAIN, "Shape %3s (%dx%d): elastic=%s, bl=", - shape_name[shape->name], (int) shape->width, (int) shape->height, shape->elastic ? "true" : "false"); + log_debug(__FILE__, MAIN, "Shape %3s (%dx%d): elastic=%s,%s bl=", + shape_name[shape->name], (int) shape->width, (int) shape->height, + shape->elastic ? "true" : "false", shape->elastic ? " " : ""); if (shape->blank_leftward == NULL) { log_debug_cont(MAIN, "NULL"); } diff --git a/test/192_logging1.txt b/test/192_logging1.txt new file mode 100644 index 0000000..691db4f --- /dev/null +++ b/test/192_logging1.txt @@ -0,0 +1,22 @@ +:DESC +Test case which checks some logging features. + +:ARGS +-d dog -x debug:all +:INPUT +foo +:OUTPUT-FILTER +:EXPECTED discard-stderr + __ _,--="=--,_ __ + / \." .-. "./ \ + / ,/ _ : : _ \/` \ + \ `| /o\ :_: /o\ |\__/ + `-'| :="~` _ `~"=: | + \` (_) `/ jgs + .-"-. \ | / .-"-. +.---{ }--| /,.-'-.,\ |--{ }---. + ) (_)_)_) \_/`~-===-~`\_/ (_(_(_) ( +( foo ) + ) ( +'---------------------------------------' +:EOF diff --git a/test/193_logging2.txt b/test/193_logging2.txt new file mode 100644 index 0000000..350e4a6 --- /dev/null +++ b/test/193_logging2.txt @@ -0,0 +1,13 @@ +:DESC +Test case which checks some logging features. + +:ARGS +-d headline -x debug:main,regexp,parser,lexer,DISCOVERY +:INPUT +Hello World! +:OUTPUT-FILTER +:EXPECTED discard-stderr +/*****************************/ +/* H e l l o W o r l d ! */ +/*****************************/ +:EOF diff --git a/test/194_logging_with_parent_configs.txt b/test/194_logging_with_parent_configs.txt new file mode 100644 index 0000000..efd1b81 --- /dev/null +++ b/test/194_logging_with_parent_configs.txt @@ -0,0 +1,13 @@ +:DESC +Test case 130 with logging turned on. + +:ARGS +-f 130_data/B.cfg -d designA -p l1 -a vc -x debug:all +:INPUT +foo +:OUTPUT-FILTER +:EXPECTED discard-stderr +AAA +AAA foo +AAA +:EOF diff --git a/test/testrunner.sh b/test/testrunner.sh index b2750ef..ea6dc6b 100755 --- a/test/testrunner.sh +++ b/test/testrunner.sh @@ -232,6 +232,9 @@ function arrange_test_fixtures() if [ $(grep -c "^:EXPECTED-ERROR " ${opt_testCase}) -eq 1 ]; then expectedReturnCode=$(grep "^:EXPECTED-ERROR " "${opt_testCase}" | sed -e 's/:EXPECTED-ERROR //') fi + if [ $(grep -c "^:EXPECTED discard-stderr" ${opt_testCase}) -eq 1 ]; then + discardStderr=true + fi cat "${opt_testCase}" | sed -n '/^:INPUT/,/^:OUTPUT-FILTER/p;' | sed '1d;$d' | tr -d '\r' > "${testInputFile}" cat "${opt_testCase}" | sed -n '/^:OUTPUT-FILTER/,/^:EXPECTED\b.*$/p;' | sed '1d;$d' | tr -d '\r' > "${testFilterFile}" @@ -248,9 +251,17 @@ function run_boxes() echo " Invoking: $(basename $boxesBinary) $boxesArgs" if [ -z "${BOXES_TEST_XXD:-}" ]; then - eval "$boxesBinary $boxesArgs" < "$testInputFile" > "$testOutputFile" 2>&1 + if [ ${discardStderr} == true ]; then + eval "$boxesBinary $boxesArgs" < "$testInputFile" > "$testOutputFile" 2> "$testErrorFile" + else + eval "$boxesBinary $boxesArgs" < "$testInputFile" > "$testOutputFile" 2>&1 + fi else - eval "$boxesBinary $boxesArgs" < "$testInputFile" | xxd > "$testOutputFile" 2>&1 + if [ ${discardStderr} == true ]; then + eval "$boxesBinary $boxesArgs" < "$testInputFile" | xxd > "$testOutputFile" 2> "$testErrorFile" + else + eval "$boxesBinary $boxesArgs" < "$testInputFile" | xxd > "$testOutputFile" 2>&1 + fi fi actualReturnCode=$? } @@ -311,7 +322,9 @@ declare -r testInputFile=${opt_testCase/%.txt/.input.tmp} declare -r testExpectationFile=${opt_testCase/%.txt/.expected.tmp} declare -r testFilterFile=${opt_testCase/%.txt/.sed.tmp} declare -r testOutputFile=${opt_testCase/%.txt/.out.tmp} +declare -r testErrorFile=${opt_testCase/%.txt/.err.tmp} declare -r boxesArgs=$(sed -n '/^:ARGS/,+1p' < "${opt_testCase}" | grep -v ^:INPUT | sed '1d' | tr -d '\r') +declare discardStderr=false arrange_environment arrange_test_fixtures @@ -328,6 +341,7 @@ rm "${testInputFile}" rm "${testFilterFile}" rm "${testExpectationFile}" rm "${testOutputFile}" +rm -f "${testErrorFile}" echo " OK" exit 0