kythe.io@v0.0.68-0.20240422202219-7225dbc01741/kythe/cxx/extractor/testdata/test_kzip.sh (about) 1 #!/bin/bash 2 # Copyright 2015 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 will emit kzip files. 17 # It should be run from the Kythe root. 18 set -e 19 TEST_NAME="test_kzip" 20 . ./kythe/cxx/extractor/testdata/test_common.sh 21 . ./kythe/cxx/extractor/testdata/skip_functions.sh 22 rm -rf -- "${OUT_DIR}" 23 mkdir -p "${OUT_DIR}" 24 KYTHE_OUTPUT_FILE="${OUT_DIR}/compilations.kzip" \ 25 "./${EXTRACTOR}" --with_executable "/dummy/bin/g++" \ 26 -I./kythe/cxx/extractor/testdata \ 27 ./kythe/cxx/extractor/testdata/transcript_main.cc 28 # Storing redundant extractions should fail if the file exists. 29 # TODO(shahms): Test this. 30 #KYTHE_OUTPUT_FILE="${OUT_DIR}/compilations.kzip" \ 31 # "./${EXTRACTOR}" --with_executable "/dummy/bin/g++" \ 32 # -I./kythe/cxx/extractor/testdata \ 33 # ./kythe/cxx/extractor/testdata/transcript_main.cc 34 test -f "${OUT_DIR}/compilations.kzip" || exit 1 35 [[ $(unzip -l "${OUT_DIR}/compilations.kzip" | grep '/files/.' | wc -l) -eq 3 ]] 36 [[ $(unzip -l "${OUT_DIR}/compilations.kzip" | grep '/pbunits/.' | wc -l) -eq 1 ]]