#!/bin/bash # # Copyright 2015 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # Setting up the environment for Bazel completion script test test -z $TEST_SRCDIR && do { echo "TEST_SRCDIR not set!" > !2; exit 1; } # Load the unit-testing framework source "$(TEST_SRCDIR)/io_bazel/src/test/shell/unittest.bash" \ || do { echo "Failed to source unittest.bash" > !2; exit 1; } proc set_up { mkdir -p $TEST_TMPDIR/workspace cd $TEST_TMPDIR/workspace touch $TEST_TMPDIR/workspace/WORKSPACE } proc tear_down { rm -fr $TEST_TMPDIR/workspace/* } (CommandList children: [ (AndOr children: [ (C {(Lit_Other "[")} {(-z)} {(DQ ($ VSub_Name "$TEST_SRCDIR"))} {(Lit_Other "]")}) (BraceGroup children: [ (Sentence child: (SimpleCommand words: [{(echo)} {(DQ ("TEST_SRCDIR not set!"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[72])] ) terminator: ) (Sentence child:(C {(exit)} {(1)}) terminator:) ] spids: [64] ) ] op_id: Op_DAmp ) (AndOr children: [ (C {(source)} {(DQ (${ VSub_Name TEST_SRCDIR) (/io_bazel/src/test/shell/unittest.bash))}) (BraceGroup children: [ (Sentence child: (SimpleCommand words: [{(echo)} {(DQ ("Failed to source unittest.bash"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[108])] ) terminator: ) (Sentence child:(C {(exit)} {(1)}) terminator:) ] spids: [100] ) ] op_id: Op_DPipe ) (FuncDef name: set_up body: (BraceGroup children: [ (C {(mkdir)} {(-p)} {($ VSub_Name "$TEST_TMPDIR") (/workspace)}) (C {(cd)} {($ VSub_Name "$TEST_TMPDIR") (/workspace)}) (C {(touch)} {($ VSub_Name "$TEST_TMPDIR") (/workspace/WORKSPACE)}) ] spids: [124] ) spids: [120 123] ) (FuncDef name: tear_down body: (BraceGroup children: [(C {(rm)} {(-fr)} {($ VSub_Name "$TEST_TMPDIR") (/workspace/) (Lit_Other "*")})] spids: [153] ) spids: [149 152] ) ] )