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

     1  #!/bin/bash
     2  # Copyright 2019 The Kythe Authors. All rights reserved.
     3  #
     4  # Licensed under the Apache License, Version 2.0 (the "License");
     5  # you may not use this file except in compliance with the License.
     6  # You may obtain a copy of the License at
     7  #
     8  #   http://www.apache.org/licenses/LICENSE-2.0
     9  #
    10  # Unless required by applicable law or agreed to in writing, software
    11  # distributed under the License is distributed on an "AS IS" BASIS,
    12  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  # See the License for the specific language governing permissions and
    14  # limitations under the License.
    15  #
    16  # This test checks that the extractor handles transcripts.
    17  # It should be run from the Kythe root.
    18  set -e
    19  TEST_NAME="test_installed_dir"
    20  . ./kythe/cxx/extractor/testdata/test_common.sh
    21  . ./kythe/cxx/extractor/testdata/skip_functions.sh
    22  export KYTHE_OUTPUT_DIRECTORY="${OUT_DIR}"
    23  export KYTHE_BUILD_CONFIG="test-installed-dir"
    24  "./${EXTRACTOR}" --with_executable "kythe/cxx/extractor/testdata/bin/clang++" \
    25      -stdlib=libc++ -E -v \
    26      ./kythe/cxx/extractor/testdata/installed_dir.cc
    27  [[ $(ls -1 "${OUT_DIR}"/*.kzip | wc -l) -eq 1 ]]
    28  INDEX_PATH=$(ls -1 "${OUT_DIR}"/*.kzip)
    29  "${KINDEX_TOOL}" -canonicalize_hashes \
    30    -suppress_details \
    31    -keep_details_matching "kythe.io/proto/kythe.proto.BuildDetails" \
    32    -explode "${INDEX_PATH}"
    33  
    34  # Remove lines that will change depending on the machine the test is run on.
    35  skip_inplace "-target" 1 "${INDEX_PATH}_UNIT"
    36  skip_inplace "signature" 0 "${INDEX_PATH}_UNIT"
    37  
    38  sed "s|TEST_CWD|${PWD}/|" "${BASE_DIR}/installed_dir.UNIT${PF_SUFFIX}" | \
    39      skip "-target" 1 |
    40      skip "signature" 0 |
    41      diff -u - "${INDEX_PATH}_UNIT"