#!/bin/sh # # aegis - project change supervisor # Copyright (C) 2001-2008, 2012, 2014 Peter Miller # Copyright (C) 2008 Walter Franzini # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # TEST_SUBJECT="aeimport sccs" . test_funcs if sccs -V > /dev/null 2>&1 then : else echo '' echo ' The "sccs" program is not in your command search PATH.' echo ' This test is therefore -assumed- to pass.' echo '' exit 0 fi AEGIS_THROTTLE=-1 export AEGIS_THROTTLE here=`pwd` if test $? -ne 0 ; then exit 2; fi check_it() { sed -e "s|$work|...|g" \ -e 's|= [0-9][0-9]*; /.*|= TIME;|' \ -e "s/\"$USER\"/\"USER\"/g" \ -e 's/19[0-9][0-9]/YYYY/' \ -e 's/20[0-9][0-9]/YYYY/' \ -e 's/node = ".*"/node = "NODE"/' \ -e 's/crypto = ".*"/crypto = "GUNK"/' \ -e 's/uuid = ".*"/uuid = "UUID"/' \ -e 's/delta_uuid = ".*"/delta_uuid = "UUID"/' \ < $2 > $work/sed.out if test $? -ne 0; then no_result; fi diff -b $1 $work/sed.out if test $? -ne 0; then fail; fi } mkdir -p $work $work/lib if test $? -ne 0 ; then no_result; fi chmod 777 $work/lib if test $? -ne 0 ; then no_result; fi cd $work if test $? -ne 0 ; then no_result; fi workproj=$work/example worklib=$work/lib AEGIS_PATH=$worklib export AEGIS_PATH # # use the built-in error messages # AEGIS_MESSAGE_LIBRARY=$work/no-such-dir export AEGIS_MESSAGE_LIBRARY unset LANG unset LANGUAGE # # test the aeimport sccs functionality # mkdir src src/sub if test $? -ne 0 ; then no_result; fi activity="create sccs file 153" test_base64 -qp -nh -i - src/s.file1 << 'fubar' =01h10874 =01s 00001/00000/00001 =01d D 1.2 99/03/12 06:17:16 bogus2 2 1 =01c second =01e =01s 00001/00000/00000 =01d D 1.1 99/03/09 06:51:24 bogus1 1 0 =01c first =01e =01u =01U =01f e 0 =01t =01T =01I 1 =01I 2 blah =01E 2 This is file 1. =01E 1 fubar if test $? -ne 0 ; then no_result; fi activity="create sccs file 178" test_base64 -qp -nh -i - src/sub/s.file2 << 'fubar' =01h11284 =01s 00001/00000/00001 =01d D 1.2 99/03/12 07:00:00 bogus1 2 1 =01c third =01e =01s 00001/00000/00000 =01d D 1.1 99/03/12 06:17:16 bogus2 1 0 =01c second =01e =01u =01U =01f e 0 =01t =01T =01I 1 =01I 2 blah blah =01E 2 This is file 2. =01E 1 fubar if test $? -ne 0 ; then no_result; fi # # now that all the SCCS files exist, read it all in and fake the changes # activity="import 206" aeimport --format=sccs src -p example -dir $workproj -lib $worklib -v > LOG 2>&1 if test $? -ne 0 ; then cat LOG; fail; fi # # Make sure the various state files are correct. # activity="check the state file 213" cat > ok << 'fubar' next_test_number = 1; fubar if test $? -ne 0 ; then no_result; fi check_it ok $workproj/info/state activity="check cstate 221" cat > ok << 'fubar' brief_description = "The \"example\" program, branch 1.0."; description = "The \"example\" program, branch 1.0."; cause = internal_enhancement; test_exempt = true; test_baseline_exempt = true; regression_test_exempt = true; architecture = [ "unspecified", ]; copyright_years = [ YYYY, ]; state = being_developed; build_time = TIME; development_directory = "branch.1/branch.0"; history = [ { when = TIME; what = new_change; who = "USER"; }, { when = TIME; what = develop_begin; who = "USER"; }, ]; branch = { umask = 022; developer_may_review = false; developer_may_integrate = true; reviewer_may_integrate = true; developers_may_create_changes = true; default_test_exemption = true; default_test_regression_exemption = true; skip_unlucky = false; compress_database = false; develop_end_action = goto_being_reviewed; history = [ { delta_number = 1; change_number = 10; uuid = "UUID"; when = TIME; is_a_branch = no; }, { delta_number = 2; change_number = 11; uuid = "UUID"; when = TIME; is_a_branch = no; }, { delta_number = 3; change_number = 12; uuid = "UUID"; when = TIME; is_a_branch = no; }, { delta_number = 4; change_number = 13; uuid = "UUID"; when = TIME; is_a_branch = no; }, ]; change = [ 10, 11, 12, 13, ]; administrator = [ "USER", ]; developer = [ "bogus1", "bogus2", ]; reviewer = [ "bogus1", "bogus2", ]; integrator = [ "bogus1", "bogus2", ]; minimum_change_number = 10; reuse_change_numbers = true; minimum_branch_number = 1; protect_development_directory = false; }; fubar if test $? -ne 0 ; then no_result; fi check_it ok $workproj/info/change/0/001.branch/0/000 activity="check fstate 332" cat > ok << 'fubar' src = [ { file_name = "aegis.conf"; action = create; edit = { revision = "1.1"; encoding = none; uuid = "UUID"; }; edit_origin = { revision = "1.1"; encoding = none; uuid = "UUID"; }; usage = config; file_fp = { youngest = TIME; oldest = TIME; crypto = "GUNK"; }; diff_file_fp = { youngest = TIME; oldest = TIME; crypto = "GUNK"; }; }, { file_name = "file1"; action = create; edit = { revision = "1.2"; encoding = none; uuid = "UUID"; }; edit_origin = { revision = "1.1"; encoding = none; uuid = "UUID"; }; usage = source; file_fp = { youngest = TIME; oldest = TIME; crypto = "GUNK"; }; diff_file_fp = { youngest = TIME; oldest = TIME; crypto = "GUNK"; }; }, { file_name = "sub/file2"; action = create; edit = { revision = "1.2"; encoding = none; uuid = "UUID"; }; edit_origin = { revision = "1.1"; encoding = none; uuid = "UUID"; }; usage = source; file_fp = { youngest = TIME; oldest = TIME; crypto = "GUNK"; }; diff_file_fp = { youngest = TIME; oldest = TIME; crypto = "GUNK"; }; }, ]; fubar if test $? -ne 0 ; then no_result; fi check_it ok $workproj/info/change/0/001.branch/0/000.fs activity="check cstate 423" cat > ok << 'fubar' brief_description = "aegis.conf file"; description = "Initial project `aegis.conf' file."; cause = internal_enhancement; test_exempt = true; test_baseline_exempt = true; regression_test_exempt = true; architecture = [ "unspecified", ]; copyright_years = [ YYYY, ]; state = completed; delta_number = 1; delta_uuid = "UUID"; history = [ { when = TIME; what = new_change; who = "USER"; }, { when = TIME; what = develop_begin; who = "USER"; }, { when = TIME; what = develop_end; who = "USER"; }, { when = TIME; what = review_pass; who = "USER"; }, { when = TIME; what = integrate_begin; who = "USER"; }, { when = TIME; what = integrate_pass; who = "USER"; }, ]; uuid = "UUID"; fubar if test $? -ne 0 ; then no_result; fi check_it ok $workproj/info/change/0/001.branch/0/000.branch/0/010 activity="check fstate 481" cat > ok << 'fubar' src = [ { file_name = "aegis.conf"; action = create; edit = { revision = "1.1"; encoding = none; uuid = "UUID"; }; usage = config; }, ]; fubar if test $? -ne 0 ; then no_result; fi check_it ok $workproj/info/change/0/001.branch/0/000.branch/0/010.fs activity="check cstate 501" cat > ok << 'fubar' brief_description = "first"; description = "first"; cause = internal_enhancement; test_exempt = true; test_baseline_exempt = true; regression_test_exempt = true; architecture = [ "unspecified", ]; copyright_years = [ YYYY, ]; state = completed; delta_number = 2; delta_uuid = "UUID"; history = [ { when = TIME; what = new_change; who = "bogus1"; }, { when = TIME; what = develop_begin; who = "bogus1"; }, { when = TIME; what = develop_end; who = "bogus1"; }, { when = TIME; what = review_pass; who = "bogus1"; }, { when = TIME; what = integrate_begin; who = "bogus1"; }, { when = TIME; what = integrate_pass; who = "bogus1"; }, ]; uuid = "UUID"; fubar if test $? -ne 0 ; then no_result; fi check_it ok $workproj/info/change/0/001.branch/0/000.branch/0/011 activity="check fstate 559" cat > ok << 'fubar' src = [ { file_name = "file1"; action = create; edit = { revision = "1.1"; encoding = none; uuid = "UUID"; }; usage = source; }, ]; fubar if test $? -ne 0 ; then no_result; fi check_it ok $workproj/info/change/0/001.branch/0/000.branch/0/011.fs activity="check cstate 579" cat > ok << 'fubar' brief_description = "second"; description = "second"; cause = internal_enhancement; test_exempt = true; test_baseline_exempt = true; regression_test_exempt = true; architecture = [ "unspecified", ]; copyright_years = [ YYYY, ]; state = completed; delta_number = 3; delta_uuid = "UUID"; history = [ { when = TIME; what = new_change; who = "bogus2"; }, { when = TIME; what = develop_begin; who = "bogus2"; }, { when = TIME; what = develop_end; who = "bogus2"; }, { when = TIME; what = review_pass; who = "bogus2"; }, { when = TIME; what = integrate_begin; who = "bogus2"; }, { when = TIME; what = integrate_pass; who = "bogus2"; }, ]; uuid = "UUID"; fubar if test $? -ne 0 ; then no_result; fi check_it ok $workproj/info/change/0/001.branch/0/000.branch/0/012 activity="check fstate 637" cat > ok << 'fubar' src = [ { file_name = "file1"; action = modify; edit = { revision = "1.2"; encoding = none; uuid = "UUID"; }; usage = source; }, { file_name = "sub/file2"; action = create; edit = { revision = "1.1"; encoding = none; uuid = "UUID"; }; usage = source; }, ]; fubar if test $? -ne 0 ; then no_result; fi check_it ok $workproj/info/change/0/001.branch/0/000.branch/0/012.fs activity="check cstate 667" cat > ok << 'fubar' brief_description = "third"; description = "third"; cause = internal_enhancement; test_exempt = true; test_baseline_exempt = true; regression_test_exempt = true; architecture = [ "unspecified", ]; copyright_years = [ YYYY, ]; state = completed; delta_number = 4; delta_uuid = "UUID"; history = [ { when = TIME; what = new_change; who = "bogus1"; }, { when = TIME; what = develop_begin; who = "bogus1"; }, { when = TIME; what = develop_end; who = "bogus1"; }, { when = TIME; what = review_pass; who = "bogus1"; }, { when = TIME; what = integrate_begin; who = "bogus1"; }, { when = TIME; what = integrate_pass; who = "bogus1"; }, ]; uuid = "UUID"; fubar if test $? -ne 0 ; then no_result; fi check_it ok $workproj/info/change/0/001.branch/0/000.branch/0/013 activity="check fstate 725" cat > ok << 'fubar' src = [ { file_name = "sub/file2"; action = modify; edit = { revision = "1.2"; encoding = none; uuid = "UUID"; }; usage = source; }, ]; fubar if test $? -ne 0 ; then no_result; fi check_it ok $workproj/info/change/0/001.branch/0/000.branch/0/013.fs activity="check file 745" cat > ok << 'fubar' blah This is file 1. fubar if test $? -ne 0 ; then no_result; fi diff ok $workproj/branch.1/branch.0/baseline/file1 if test $? -ne 0 ; then fail; fi activity="check file 755" cat > ok << 'fubar' blah blah This is file 2. fubar if test $? -ne 0 ; then no_result; fi diff ok $workproj/branch.1/branch.0/baseline/sub/file2 if test $? -ne 0 ; then fail; fi # # Only definite negatives are possible. # The functionality exercised by this test appears to work, # no other guarantees are made. # pass # vim: set ts=8 sw=4 et :