#!/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. # # # Arguments: # unittest.bash script # singlejar path # jar tool path (($# >= 2)) || \ do { echo "Usage: $0 " > !2; exit 1; } # Load test environment source $1/unittest.bash \ || do { echo "unittest.bash not found!" > !2; exit 1; } set -eTODO declare -r singlejar = $2 # Test that the entries single jar creates can be extracted (that is, they do # not have some funny Unix access more settings making them unreadable). proc test_new_entries { var -r out_jar = ""$(TEST_TMPDIR)/out.jar"" $singlejar --output $out_jar cd $(TEST_TMPDIR) unzip $out_jar build-data.properties [[ -r build-data.properties ]] || \ do { echo "build-data.properties is not readable" > !2; exit 1; } } run_suite "Misc shell tests" #!/bin/bash (CommandList children: [ (AndOr children: [ (DParen child: (ArithBinary op_id: Arith_GreatEqual left: (ArithWord w:{($ VSub_Pound "$#")}) right: (ArithWord w:{(Lit_Digits 2)}) ) ) (BraceGroup children: [ (Sentence child: (SimpleCommand words: [ {(echo)} {(DQ ("Usage: ") ($ VSub_Number "$0") (" "))} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[87])] ) terminator: ) (Sentence child:(C {(exit)} {(1)}) terminator:) ] spids: [77] ) ] op_id: Op_DPipe ) (AndOr children: [ (C {(source)} {($ VSub_Number "$1") (/unittest.bash)}) (BraceGroup children: [ (Sentence child: (SimpleCommand words: [{(echo)} {(DQ ("unittest.bash not found!"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[119])] ) terminator: ) (Sentence child:(C {(exit)} {(1)}) terminator:) ] spids: [111] ) ] op_id: Op_DPipe ) (C {(set)} {(-e)}) (Assignment keyword: Assign_Declare flags: ["'-r'"] pairs: [ (assign_pair lhs: (LhsName name:singlejar) op: Equal rhs: {(DQ ($ VSub_Number "$2"))} spids: [139] ) ] spids: [135] ) (FuncDef name: test_new_entries body: (BraceGroup children: [ (Assignment keyword: Assign_Local flags: ["'-r'"] pairs: [ (assign_pair lhs: (LhsName name:out_jar) op: Equal rhs: {(DQ (${ VSub_Name TEST_TMPDIR) (/out.jar))} spids: [165] ) ] spids: [161] ) (C {(DQ ($ VSub_Name "$singlejar"))} {(--output)} {(DQ ($ VSub_Name "$out_jar"))}) (C {(cd)} {(DQ (${ VSub_Name TEST_TMPDIR))}) (C {(unzip)} {(DQ ($ VSub_Name "$out_jar"))} {(build-data.properties)}) (AndOr children: [ (DBracket expr: (BoolUnary op_id:BoolUnary_r child:{(build-data.properties)}) ) (BraceGroup children: [ (Sentence child: (SimpleCommand words: [{(echo)} {(DQ ("build-data.properties is not readable"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[223])] ) terminator: ) (Sentence child:(C {(exit)} {(1)}) terminator:) ] spids: [215] ) ] op_id: Op_DPipe ) ] spids: [158] ) spids: [152 157] ) (C {(run_suite)} {(DQ ("Misc shell tests"))}) ] )