1#!/bin/sh 2# 3# aegis - The "aegis" program. 4# Copyright (C) 2008, 2010 Walter Franzini 5# Copyright (C) 2008 Peter Miller 6# 7# This program is free software; you can redistribute it and/or modify 8# it under the terms of the GNU General Public License as published by 9# the Free Software Foundation; either version 3 of the License, or (at 10# your option) any later version. 11# 12# This program is distributed in the hope that it will be useful, 13# but WITHOUT ANY WARRANTY; without even the implied warranty of 14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15# General Public License for more details. 16# 17# You should have received a copy of the GNU General Public License along 18# with this program. If not, see <http://www.gnu.org/licenses/>. 19# 20 21TEST_SUBJECT="aeipass vs. aeipass-option:assign-file-uuid" 22 23# load up standard prelude and test functions 24. test_funcs 25 26check_it() 27{ 28 sed -e "s|$work|...|g" \ 29 -e 's|= [0-9][0-9]*; /.*|= TIME;|' \ 30 -e "s/\"$USER\"/\"USER\"/g" \ 31 -e 's/uuid = ".*"/uuid = "UUID"/' \ 32 -e 's/19[0-9][0-9]/YYYY/' \ 33 -e 's/20[0-9][0-9]/YYYY/' \ 34 -e 's/node = ".*"/node = "NODE"/' \ 35 -e 's/crypto = ".*"/crypto = "GUNK"/' \ 36 -e 's|; charset=us-ascii||' \ 37 < $2 > $work/sed.out 38 if test $? -ne 0; then no_result; fi 39 diff $1 $work/sed.out 40 if test $? -ne 0; then fail; fi 41} 42 43# 44# test the aeipass functionality 45# 46workproj=$work/proj 47workchan=$work/chan 48 49AEGIS_PROJECT=example ; export AEGIS_PROJECT 50 51# 52# make a new project 53# 54activity="new project 54" 55aegis -npr $AEGIS_PROJECT -vers "" -dir $workproj > log 2>&1 56if test $? -ne 0 ; then cat log; no_result; fi 57 58# 59# change project attributes 60# 61activity="project attributes 61" 62cat > tmp << 'end' 63description = "A bogus project created to test the aeipass functionality."; 64developer_may_review = true; 65developer_may_integrate = true; 66reviewer_may_integrate = true; 67default_test_exemption = true; 68develop_end_action = goto_awaiting_integration; 69end 70if test $? -ne 0 ; then no_result; fi 71aegis -pa -f tmp > log 2>&1 72if test $? -ne 0 ; then cat log; no_result; fi 73 74# 75# add the staff 76# 77activity="staff 77" 78aegis -nd $USER > log 2>&1 79if test $? -ne 0 ; then cat log; no_result; fi 80aegis -nrv $USER > log 2>&1 81if test $? -ne 0 ; then cat log; no_result; fi 82aegis -ni $USER > log 2>&1 83if test $? -ne 0 ; then cat log; no_result; fi 84 85# 86# create a new change 87# 88activity="new change 88" 89cat > tmp << 'end' 90brief_description = "The first change"; 91cause = internal_bug; 92end 93if test $? -ne 0 ; then no_result; fi 94aegis -nc 1 -f tmp -p $AEGIS_PROJECT > log 2>&1 95if test $? -ne 0 ; then cat log; no_result; fi 96 97# 98# begin development of a change 99# 100aegis -db 1 -dir $workchan > log 2>&1 101if test $? -ne 0 ; then cat log; no_result; fi 102 103# 104# add a new files to the change 105# 106activity="new files 106" 107aegis -nf -no-uuid $workchan/bogus1 -nl > log 2>&1 108if test $? -ne 0 ; then cat log; no_result; fi 109aegis -nf $workchan/aegis.conf -nl > log 2>&1 110if test $? -ne 0 ; then cat log; no_result; fi 111 112cat > $workchan/bogus1 << 'end' 113OLD CONTENT 114bogus1, line 1 115bogus1, line 2 116end 117if test $? -ne 0 ; then no_result; fi 118 119activity="check file-attributes 119" 120cat > ok <<EOF 121attribute = 122[ 123 { 124 name = "aeipass-option:assign-file-uuid"; 125 value = "false"; 126 }, 127 { 128 name = "usage"; 129 value = "source"; 130 }, 131 { 132 name = "content-type"; 133 value = "text/plain"; 134 }, 135]; 136EOF 137if test $? -ne 0 ; then no_result; fi 138 139aegis -file-attribute -list $workchan/bogus1 > bogus1.fileattr 140if test $? -ne 0 ; then no_result; fi 141 142check_it ok bogus1.fileattr 143if test $? -ne 0 ; then fail; fi 144 145 146cat > $workchan/aegis.conf << 'end' 147build_command = "exit 0"; 148link_integration_directory = true; 149 150history_get_command = "aesvt -check-out -edit ${quote $edit} " 151 "-history ${quote $history} -f ${quote $output}"; 152history_put_command = "aesvt -check-in -history ${quote $history} " 153 "-f ${quote $input}"; 154history_query_command = "aesvt -query -history ${quote $history}"; 155history_content_limitation = binary_capable; 156 157diff_command = "set +e; $diff $orig $i > $out; test $$? -le 1"; 158merge_command = "(diff3 -e $i $orig $mr | sed -e '/^w$$/d' -e '/^q$$/d'; \ 159 echo '1,$$p' ) | ed - $i > $out"; 160patch_diff_command = "set +e; $diff -C0 -L $index -L $index $orig $i > $out; \ 161test $$? -le 1"; 162end 163if test $? -ne 0 ; then no_result; fi 164 165# 166# build the change 167# 168activity="finish the change 168" 169aefinish -v > log 2>&1 170if test $? -ne 0 ; then cat log; no_result; fi 171 172# 173# start integrating 174# 175activity="integrate begin 175" 176aegis -ib 1 > log 2>&1 177if test $? -ne 0 ; then cat log; no_result; fi 178 179# 180# finish integration 181# 182activity="integrate the change 182" 183aefinish -c 1 > log 2>&1 184if test $? -ne 0 ; then cat log; no_result; fi 185 186cat > ok <<EOF 187src = 188[ 189 { 190 file_name = "aegis.conf"; 191 uuid = "UUID"; 192 action = create; 193 edit = 194 { 195 revision = "1"; 196 encoding = none; 197 uuid = "UUID"; 198 }; 199 usage = config; 200 }, 201 { 202 file_name = "bogus1"; 203 action = create; 204 edit = 205 { 206 revision = "1"; 207 encoding = none; 208 uuid = "UUID"; 209 }; 210 usage = source; 211 }, 212]; 213EOF 214if test $? -ne 0 ; then no_result; fi 215 216check_it ok $workproj/info/change/0/001.fs 217 218# 219# Only definite negatives are possible. 220# The functionality exercised by this test appears to work, 221# no other guarantees are made. 222# 223pass 224