1#! /bin/sh 2# errorcases.sh: Testing for various error cases 3# 4 5# Import common functions & definitions. 6. ../../common/test-common 7 8 9ret_invalid_option=1 10 11remove 12 13 14g=foo 15s=s.$g 16p=p.$g 17z=z.$g 18q=q.$g 19d=d.$g 20x=x.$g 21files="$g $s $p $z ${g}_1 ${g}_2 $g $q $d $x command.log log log.stdout log.stderr" 22remove $files 23 24 25# Create the input files. 26echo foo > $g 27 28docommand de1 "${admin} -n -i$g $s" 0 IGNORE IGNORE 29remove $g 30docommand de2 "${vg_get} -s -p $s" 0 "foo\n" IGNORE 31docommand de3 "${vg_get} -s -p -r1.1 $s" 0 "foo\n" IGNORE 32 33# Attempt to get a nonexistent SID should fail. 34docommand de4 "${vg_get} -r1.2 $s" 1 "" IGNORE 35 36# Attempt to get an invalid SID should fail (we try several) 37docommand de5 "${vg_get} -r2a $s" ${ret_invalid_option} "" IGNORE 38docommand de6 "${vg_get} -r2_3 $s" ${ret_invalid_option} "" IGNORE 39 40# Make a branch for later use 41docommand de7 "${vg_get} -e $s" 0 "1.1\nnew delta 1.2\n1 lines\n" IGNORE 42docommand de8 "${delta} -yNoComment $s" 0 IGNORE IGNORE 43docommand de9 "${vg_get} -e -r1.1 $s" 0 "1.1\nnew delta 1.1.1.1\n1 lines\n" IGNORE 44docommand de10 "${delta} -yNoComment $s" 0 IGNORE IGNORE 45 46# Now get 1.1.1.1 but including the change for 1.2. 47docommand de11 "${vg_get} -r1.1.1.1 -i1.2 $s" 0 "Included: 481.2 491.1.1.1\n1 lines 50" IGNORE 51 52# The next is trhe case we really want to test - trying to include an invalid 53# SID. We try several ways. 54docommand de12 "${vg_get} -r1.1.1.1 -ia1.2a $s" ${ret_invalid_option} IGNORE IGNORE 55docommand de13 "${vg_get} -r1.1.1.1 -i.1 $s" ${ret_invalid_option} IGNORE IGNORE 56docommand de14 "${vg_get} -r1.1.1.1 -i1.1.1.1.1 $s" ${ret_invalid_option} IGNORE IGNORE 57 58# Now trying to exclude an invalid SID. We try several ways. 59docommand de15 "${vg_get} -r1.1.1.1 -x1.2a $s" ${ret_invalid_option} IGNORE IGNORE 60docommand de16 "${vg_get} -r1.1.1.1 -x.1 $s" ${ret_invalid_option} IGNORE IGNORE 61docommand de17 "${vg_get} -r1.1.1.1 -x1.1.1.1.1 $s" ${ret_invalid_option} IGNORE IGNORE 62 63 64remove ${files} 65success 66