kythe.io@v0.0.68-0.20240422202219-7225dbc01741/kythe/cxx/verifier/testdata/test_outputs.sh (about)

     1  #!/bin/bash
     2  # This script checks that the verifier produces the correct debug
     3  # output given pre-baked indexer output. Each test case should have
     4  # a .bin (the result of redirecting the indexer's output to a file) and
     5  # a .dot (the correct result from running the verifier using that
     6  # output with the --graphviz flag). If the output matches exactly for
     7  # each test case, this script returns zero.
     8  HAD_ERRORS=0
     9  BASE_DIR="$PWD/kythe/cxx/verifier/testdata"
    10  VERIFIER="kythe/cxx/verifier/verifier"
    11  function one_case {
    12    cat $1.bin | ${VERIFIER} --graphviz | diff $1.dot -
    13    DOT_RESULTS=( ${PIPESTATUS[1]} ${PIPESTATUS[2]} )
    14    if [ ${DOT_RESULTS[0]} -ne 0 ]; then
    15      echo "[ FAILED VERIFY --GRAPHVIZ: $1 ]"
    16      HAD_ERRORS=1
    17    elif [ ${DOT_RESULTS[1]} -ne 0 ]; then
    18      echo "[ WRONG VERIFY --GRAPHVIZ: $1 ]"
    19      HAD_ERRORS=1
    20    else
    21      echo "[ OK: $1 ]"
    22    fi
    23  }
    24  
    25  one_case "${BASE_DIR}/just_file_node"
    26  
    27  exit ${HAD_ERRORS}