1#!/bin/sh 2# 3# aegis - project change supervisor 4# Copyright (C) 1999, 2000, 2005-2008, 2012 Peter Miller 5# Copyright (C) 2008, 2010 Walter Franzini 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 10# (at 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 15# GNU General Public License for more details. 16# 17# You should have received a copy of the GNU General Public License 18# along with this program. If not, see 19# <http://www.gnu.org/licenses/>. 20# 21 22TEST_SUBJECT="aedist functionality" 23 24# load up standard prelude and test functions 25. test_funcs 26 27check_it() 28{ 29 sed -e "s|$work|...|g" \ 30 -e 's|= [0-9][0-9]*; /.*|= TIME;|' \ 31 -e "s/\"$USER\"/\"USER\"/g" \ 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|"text/plain"|"text/plain; charset=us-ascii"|' \ 37 < $2 > $work/sed.out 38 if test $? -ne 0; then no_result; fi 39 diff -b $1 $work/sed.out 40 if test $? -ne 0; then fail; fi 41} 42 43worklib=$work/lib 44workproj=$work/foo.proj 45workchan=$work/foo.chan 46tmp=$work/tmp 47AEGIS_PATH=$worklib ; export AEGIS_PATH 48AEGIS_PROJECT=foo ; export AEGIS_PROJECT 49 50# 51# make a new project 52# 53activity="new project 53" 54aegis -npr foo -vers "" -dir $workproj > log 2>&1 55if test $? -ne 0 ; then cat log; no_result; fi 56 57# 58# change project attributes 59# 60activity="project attributes 60" 61cat > $tmp << 'end' 62description = "A bogus project created to test the aedist functionality."; 63developer_may_review = true; 64developer_may_integrate = true; 65reviewer_may_integrate = true; 66default_test_exemption = true; 67end 68if test $? -ne 0 ; then no_result; fi 69aegis -pa -f $tmp > log 2>&1 70if test $? -ne 0 ; then cat log; no_result; fi 71 72# 73# add the staff 74# 75activity="staff 75" 76aegis -nd $USER > log 2>&1 77if test $? -ne 0 ; then cat log; no_result; fi 78aegis -nrv $USER > log 2>&1 79if test $? -ne 0 ; then cat log; no_result; fi 80aegis -ni $USER > log 2>&1 81if test $? -ne 0 ; then cat log; no_result; fi 82 83aegis -nbr -p foo 4 > log 2>&1 84if test $? -ne 0 ; then cat log; no_result; fi 85 86aegis -nbr -p foo.4 2 > log 2>&1 87if test $? -ne 0 ; then cat log; no_result; fi 88 89AEGIS_PROJECT=foo.4.2 ; export AEGIS_PROJECT 90 91# 92# create a new change 93# 94activity="new change 94" 95cat > $tmp << 'end' 96brief_description = "The first change"; 97cause = internal_bug; 98end 99if test $? -ne 0 ; then no_result; fi 100aegis -nc 1 -f $tmp -p foo.4.2 > log 2>&1 101if test $? -ne 0 ; then cat log; no_result; fi 102 103# 104# begin development of a change 105# 106aegis -db 1 -dir $workchan > log 2>&1 107if test $? -ne 0 ; then cat log; no_result; fi 108 109# 110# add a new files to the change 111# 112activity="new file 112" 113aegis -nf $workchan/main.c -nl > log 2>&1 114if test $? -ne 0 ; then cat log; no_result; fi 115cat > $workchan/main.c << 'end' 116/* $Id$ */ 117int main() { test(); exit(0); return 0; } 118end 119if test $? -ne 0 ; then no_result; fi 120 121aegis -nf -no-uuid -config $workchan/aegis.conf -nl > log 2>&1 122if test $? -ne 0 ; then cat log; no_result; fi 123 124cat > $workchan/aegis.conf << 'end' 125build_command = "exit 0"; 126link_integration_directory = true; 127create_symlinks_before_build = true; 128 129history_get_command = "aesvt -check-out -edit ${quote $edit} " 130 "-history ${quote $history} -f ${quote $output}"; 131history_put_command = "aesvt -check-in -history ${quote $history} " 132 "-f ${quote $input}"; 133history_query_command = "aesvt -query -history ${quote $history}"; 134history_content_limitation = binary_capable; 135 136diff_command = "set +e; diff $orig $i > $out; test $$? -le 1"; 137diff3_command = "(diff3 -e $mr $orig $i | sed -e '/^w$$/d' -e '/^q$$/d'; \ 138 echo '1,$$p' ) | ed - $mr > $out"; 139history_put_trashes_file = warn; 140end 141if test $? -ne 0 ; then no_result; fi 142 143# 144# build the change 145# 146activity="build 146" 147aegis -build -nl -v > log 2>&1 148if test $? -ne 0 ; then cat log; fail; fi 149 150# 151# difference the change 152# 153activity="diff 153" 154aegis -diff > log 2>&1 155if test $? -ne 0 ; then cat log; no_result; fi 156 157# 158# now make a distribution set 159# 160activity="aedist -send 160" 161aedist -send -o test.out -ndh > log 2>&1 162if test $? -ne 0 ; then cat log; no_result; fi 163 164# 165# set the path, so that the aegis command that aedist invokes 166# is fromthe same test set as the aedist command itself. 167# 168PATH=${bin}:$PATH 169export PATH 170 171# 172# now receive it 173# 174activity="aedist -receive 174" 175aedist -receive -f test.out -dir $workchan.2 > log 2>&1 176if test $? -ne 0 ; then cat log; fail; fi 177 178cat > ok <<EOF 179attribute = 180[ 181 { 182 name = "aeipass-option:assign-file-uuid"; 183 value = "false"; 184 }, 185 { 186 name = "usage"; 187 value = "config"; 188 }, 189 { 190 name = "content-type"; 191 value = "text/plain; charset=us-ascii"; 192 }, 193]; 194EOF 195if test $? -ne 0; then no_result; fi 196 197aegis -file-attr -list -c 10 -base-rel aegis.conf > aegis.conf.fa 198if test $? -ne 0; then no_result; fi 199 200check_it ok aegis.conf.fa 201if test $? -ne 0; then fail; fi 202 203# 204# the things tested in this test, worked 205# 206pass 207 208 209# vim: set ts=8 sw=4 et : 210