[Cvsshell-devel] CVS: cvsshell/testing refstderr,NONE,1.1 refstdout,NONE,1.1 run-test.py,NONE,1.1 te
Status: Beta
Brought to you by:
stefanheimann
From: Stefan H. <ste...@us...> - 2002-03-10 23:13:04
|
Update of /cvsroot/cvsshell/cvsshell/testing In directory usw-pr-cvs1:/tmp/cvs-serv25208/testing Added Files: refstderr refstdout run-test.py testinput Log Message: testcases --- NEW FILE: refstderr --- cvs import: Importing /tmp/cvsroot/testdata/testdir cvs checkout: Updating testdata cvs checkout: Updating testdata/testdir cvs checkout: Updating testdata cvs checkout: Updating testdata/testdir cvs checkout: Updating testdata cvs checkout: Updating testdata/testdir cvs checkout: Updating testdata cvs checkout: Updating testdata/testdir cvs add: scheduling file `addtest1' for addition cvs add: use 'cvs commit' to add this file permanently cvs add: scheduling file `addtest2' for addition cvs add: use 'cvs commit' to add this file permanently cvs add: use 'cvs commit' to add these files permanently cvs remove: scheduling `test2' for removal cvs remove: use 'cvs commit' to remove this file permanently cvs remove: scheduling `addtest2' for removal cvs remove: use 'cvs commit' to remove this file permanently --- NEW FILE: refstdout --- ====== Creating testdata ======== ====== initializing the repository ====== ====== importing the testdata ====== N testdata/test1 N testdata/test2 N testdata/testdir/test3 No conflicts created by this import ====== testing checkout, set-root and clear-root ====== === checkout 1 === === checkout 2 === === checkout 3 === === checkout 4 === ====== Testing commit ====== === commit 1 === Checking in test1; /tmp/cvsroot/testdata/test1,v <-- test1 new revision: 1.2; previous revision: 1.1 done === commit 2 === Checking in test1; /tmp/cvsroot/testdata/test1,v <-- test1 new revision: 1.3; previous revision: 1.2 done ====== Testing add ====== === add 1 === === add 2 === === add 3 === RCS file: /tmp/cvsroot/testdata/addtest1,v done Checking in addtest1; /tmp/cvsroot/testdata/addtest1,v <-- addtest1 initial revision: 1.1 done RCS file: /tmp/cvsroot/testdata/addtest2,v done Checking in addtest2; /tmp/cvsroot/testdata/addtest2,v <-- addtest2 initial revision: 1.1 done RCS file: /tmp/cvsroot/testdata/dirX/addtest3,v done Checking in dirX/addtest3; /tmp/cvsroot/testdata/dirX/addtest3,v <-- addtest3 initial revision: 1.1 done RCS file: /tmp/cvsroot/testdata/dirX/addtest4,v done Checking in dirX/addtest4; /tmp/cvsroot/testdata/dirX/addtest4,v <-- addtest4 initial revision: 1.1 done CVS addtest1 addtest2 dirX test1 test2 testdir ====== Testing remove ====== CVS addtest1 dirX test1 testdir Default global options: {'upd': '-q', 'up': '-q', 'update': '-q'} Default options: {'upd': '-P', 'up': '-P', 'update': '-P'} Default global options for all cmds: '' Default options for all cmds: '-z 3' CvsShell 0.1 Copyright 2002 Stefan Heimann (ma...@st...). This software is released under the GPL. CvsShell started. {a} ~/cvsshell/testing [--] $ cd /tmp {a} /private/tmp [--] $ echo ====== Creating testdata ======== {a} /private/tmp [--] $ mkdir testdata {a} /private/tmp [--] $ cd testdata {a} /private/tmp/testdata [--] $ echo "You are file test1" > test1 {a} /private/tmp/testdata [--] $ echo "You are file test2" > test2 {a} /private/tmp/testdata [--] $ mkdir testdir {a} /private/tmp/testdata [--] $ echo "You are file test3" > testdir/test3 {a} /private/tmp/testdata [--] $ cd .. {a} /private/tmp [--] $ {a} /private/tmp [--] $ echo ====== initializing the repository ====== {a} /private/tmp [--] $ cvs -d /tmp/cvsroot init {a} /private/tmp [--] $ {a} /private/tmp [--] $ echo ====== importing the testdata ====== {a} /private/tmp [--] $ cd testdata {a} /private/tmp/testdata [--] $ cvs -d /tmp/cvsroot import -m "testdata" testdata stefan start {a} /private/tmp/testdata [--] $ cd .. {a} /private/tmp [--] $ rm -r testdata {a} /private/tmp [--] $ {a} /private/tmp [--] $ echo ====== testing checkout, set-root and clear-root ====== {a} /private/tmp [--] $ {a} /private/tmp [--] $ echo === checkout 1 === {a} /private/tmp [--] $ {a} /private/tmp [--] $ Aliases: enter new cvsroot: You can specify an alias for the cvsroot: enter name of module: cvs -z 3 -d /tmp/cvsroot checkout testdata {a} /private/tmp [/tmp/cvsroot] $ {a} /private/tmp [/tmp/cvsroot] $ cd testdata {a} /private/tmp/testdata [/tmp/cvsroot] $ cd .. {a} /private/tmp [/tmp/cvsroot] $ rm -r testdata {a} /private/tmp [/tmp/cvsroot] $ {a} /private/tmp [/tmp/cvsroot] $ echo === checkout 2 === {a} /private/tmp [/tmp/cvsroot] $ enter name of module: cvs -z 3 -d /tmp/cvsroot checkout testdata {a} /private/tmp [/tmp/cvsroot] $ cd testdata {a} /private/tmp/testdata [/tmp/cvsroot] $ cd .. {a} /private/tmp [/tmp/cvsroot] $ rm -r testdata {a} /private/tmp [/tmp/cvsroot] $ echo === checkout 3 === {a} /private/tmp [/tmp/cvsroot] $ cvs -z 3 -d /tmp/cvsroot checkout testdata {a} /private/tmp [/tmp/cvsroot] $ cd testdata {a} /private/tmp/testdata [/tmp/cvsroot] $ cd .. {a} /private/tmp [/tmp/cvsroot] $ rm -r testdata {a} /private/tmp [/tmp/cvsroot] $ {a} /private/tmp [--] $ echo === checkout 4 === {a} /private/tmp [--] $ cvs -z 3 -d /tmp/cvsroot checkout testdata {a} /private/tmp [--] $ cd testdata {a} /private/tmp/testdata [/tmp/cvsroot] $ echo ====== Testing commit ====== {a} /private/tmp/testdata [/tmp/cvsroot] $ echo === commit 1 === {a} /private/tmp/testdata [/tmp/cvsroot] $ echo " changed" >> test1 {a} /private/tmp/testdata [/tmp/cvsroot] $ cvs -z 3 -q -d /tmp/cvsroot -n update -P : 0 M test1 {a} /private/tmp/testdata [/tmp/cvsroot] $ cd /private/tmp/testdata cvs -z 3 -d /tmp/cvsroot commit -m 'this file was changed for testing' test1 cd /private/tmp/testdata {a} /private/tmp/testdata [/tmp/cvsroot] $ echo === commit 2 === {a} /private/tmp/testdata [/tmp/cvsroot] $ echo " changed" >> test1 {a} /private/tmp/testdata [/tmp/cvsroot] $ cvs -z 3 -d /tmp/cvsroot commit -m 'this file was changed for testing' test1 {a} /private/tmp/testdata [/tmp/cvsroot] $ echo ====== Testing add ====== {a} /private/tmp/testdata [/tmp/cvsroot] $ echo === add 1 === {a} /private/tmp/testdata [/tmp/cvsroot] $ echo "I am addtest1" > addtest1 {a} /private/tmp/testdata [/tmp/cvsroot] $ cvs -z 3 -d /tmp/cvsroot add addtest1 {a} /private/tmp/testdata [/tmp/cvsroot] $ echo === add 2 === {a} /private/tmp/testdata [/tmp/cvsroot] $ echo "I am addtest2" > addtest2 {a} /private/tmp/testdata [/tmp/cvsroot] $ cvs -z 3 -q -d /tmp/cvsroot -n update -P : 0 A addtest1 1 ? addtest2 {a} /private/tmp/testdata [/tmp/cvsroot] $ cd /private/tmp/testdata cvs -z 3 -d /tmp/cvsroot add -m 'sdfasdf' addtest2 {a} /private/tmp/testdata [/tmp/cvsroot] $ echo === add 3 === {a} /private/tmp/testdata [/tmp/cvsroot] $ mkdir dirX {a} /private/tmp/testdata [/tmp/cvsroot] $ echo "I am addtest3" > dirX/addtest3 {a} /private/tmp/testdata [/tmp/cvsroot] $ echo "I am addtest4" > dirX/addtest4 {a} /private/tmp/testdata [/tmp/cvsroot] $ cvs -z 3 -d /tmp/cvsroot -Q add -m 'sdfa' dirX {a} /private/tmp/testdata [/tmp/cvsroot] $ cvs -z 3 -q -d /tmp/cvsroot update -P : 0 A addtest1 1 A addtest2 dirX: 2 ? addtest3 3 ? addtest4 {a} /private/tmp/testdata [/tmp/cvsroot] $ cd /private/tmp/testdata cvs -z 3 -d /tmp/cvsroot -Q add -m 'sdfas' dirX/addtest3 dirX/addtest4 {a} /private/tmp/testdata [/tmp/cvsroot] $ cd /private/tmp/testdata cvs -z 3 -d /tmp/cvsroot -Q commit -m 'dummy' cd /private/tmp/testdata {a} /private/tmp/testdata [/tmp/cvsroot] $ ls {a} /private/tmp/testdata [/tmp/cvsroot] $ echo ====== Testing remove ====== {a} /private/tmp/testdata [/tmp/cvsroot] $ cvs -z 3 -d /tmp/cvsroot status 2>&1 : 0 Up-to-date addtest1 1 Up-to-date addtest2 2 Up-to-date test1 3 Up-to-date test2 dirX: 4 Up-to-date addtest3 5 Up-to-date addtest4 testdir: 6 Up-to-date test3 {a} /private/tmp/testdata [/tmp/cvsroot] $ /private/tmp/testdata/test2 cd /private/tmp/testdata cvs -z 3 -d /tmp/cvsroot remove test2 : 0 R test2 The files have been scheduled for removal. Should I run `commit' to remove the files permanently (yes|no)? {a} /private/tmp/testdata [/tmp/cvsroot] $ cvs -z 3 -d /tmp/cvsroot remove addtest2 The files have been scheduled for removal. Should I run `commit' to remove the files permanently (yes|no)? {a} /private/tmp/testdata [/tmp/cvsroot] $ {a} /private/tmp/testdata [/tmp/cvsroot] $ Refusing the delete a directory: dirX {a} /private/tmp/testdata [/tmp/cvsroot] $ ls {a} /private/tmp/testdata [/tmp/cvsroot] $ cd /Users/stefan {a} ~ [/tmp/cvsroot] $ rm -rf /tmp/testdata /tmp/cvsroot {a} ~ [/tmp/cvsroot] $ CvsShell done. --- NEW FILE: run-test.py --- #!/usr/bin/env python ############################################################################### # This file is part of CvsShell # # CvsShell 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 2 of the License, or # (at your option) any later version. # # CvsShell 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 CvsShell; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Copyright 2002 by Stefan Heimann # Website: http://cvsshell.sourceforge.net/ ############################################################################### import sys, os, tempfile thisDir = os.path.join(os.getcwd(), sys.path[0]) def runTest(): global thisDir refstdout = thisDir + '/refstdout' refstderr = thisDir + '/refstderr' testcode = open(thisDir + '/testinput').read() os.system('rm -rf /tmp/testdata /tmp/cvsroot') # little clean-up os.unlink(os.path.join(os.environ['HOME'], '.cvsshellrc')) stdin, stdout, stderr = os.popen3('python %s/../src/cvs_shell.py -v' % thisDir) stdin.write(testcode) stdin.close() logstdout = tempfile.mktemp() logstderr = tempfile.mktemp() open(logstdout,'w').write(stdout.read()) stdout.close() open(logstderr,'w').write(stderr.read()) stderr.close() if os.path.exists(refstdout): print print '======== diff of stdout ========' print '< is the reference, > is the current result:' os.system('diff %s %s' % (refstdout, logstdout)) if os.path.exists(refstderr): print print '======== diff of stderr ========' print '< is the reference, > is the current result:' os.system('diff %s %s' % (refstderr, logstderr)) a = raw_input('Should the result be saved as the new reference (yes|no)? ') if a == 'yes': os.rename(logstdout, refstdout) os.rename(logstderr, refstderr) if __name__ == '__main__': runTest() --- NEW FILE: testinput --- cd /tmp echo ====== Creating testdata ======== mkdir testdata cd testdata echo "You are file test1" > test1 echo "You are file test2" > test2 mkdir testdir echo "You are file test3" > testdir/test3 cd .. echo ====== initializing the repository ====== cvs -d /tmp/cvsroot init echo ====== importing the testdata ====== cd testdata cvs -d /tmp/cvsroot import -m "testdata" testdata stefan start cd .. rm -r testdata echo ====== testing checkout, set-root and clear-root ====== # !! checkout prompts for alias !! echo === checkout 1 === clear-root checkout /tmp/cvsroot testalias testdata cd testdata cd .. rm -r testdata set-root testalias echo === checkout 2 === checkout testdata cd testdata cd .. rm -r testdata echo === checkout 3 === checkout testdata cd testdata cd .. rm -r testdata clear-root echo === checkout 4 === checkout testalias testdata cd testdata echo ====== Testing commit ====== echo === commit 1 === echo " changed" >> test1 refresh commit -m 'this file was changed for testing' 0 echo === commit 2 === echo " changed" >> test1 commit -m 'this file was changed for testing' test1 echo ====== Testing add ====== echo === add 1 === echo "I am addtest1" > addtest1 add addtest1 echo === add 2 === echo "I am addtest2" > addtest2 refresh add -m 'sdfasdf' 1 echo === add 3 === mkdir dirX echo "I am addtest3" > dirX/addtest3 echo "I am addtest4" > dirX/addtest4 add -m 'sdfa' -Q dirX update add -m 'sdfas' -Q 2,3 commit -Q -m 'dummy' ls echo ====== Testing remove ====== status remove 3 y remove addtest2 y # cvsshell refuses to delete dirs! remove dirX ls cd rm -rf /tmp/testdata /tmp/cvsroot exit |