# %Z% %M% %I% %E% # Copyright (c) 1995 by Wayne C. Gramlich. # All rights reserved. # Permission to use, copy, modify, distribute, and sell this software # for any purpose is hereby granted without fee provided that the above # copyright notice and this permission are retained. The author makes # no representations about the suitability of this software for any purpose. # It is provided "as is" without express or implied warranty. ROOT= ../.. include $(ROOT)/Makefile_common.mk include $(ROOT)/Makefile_private.mk # Some common macros: TMP= /tmp SVMS= $(TMP)/svms PDIR= $(TMP)/$@ CD= cd $(PDIR) FRESH= rm -rf $(PDIR) # Suffix rules: %.pass: %.ok @echo -n Test `basename $< .ok` "... " @-$(MAKE) init 2>&1 | sed \ -e "/Nothing to be done for/D" \ -e "/Entering directory/D" \ -e "/Leaving directory/D" @-$(MAKE) `basename $< .ok` 2>&1 | sed \ -e "/Current working directory/D" \ -e "/make: Fatal error:/D" \ -e "s/... Error code [0-9]*.*$$/{command failed}/g" \ -e "s/make.*Error [0-9]*.*$$/{command failed}/g" \ -e "/Entering directory/D" \ -e "/Leaving directory/D" \ -e "s,$(TMP)/,,g" \ -e "s,\#0\.,{zero_hash},g" \ -e "s,\#[0-9]*\.,{hash},g" \ -e "s,1970/01/01@00:00:00GMT,{zero_timestamp},g" \ -e "s,..../../..@..:..:..GMT,{timestamp},g" > \ `basename $< .ok`.fail @-if cmp `basename $< .ok`.fail $< > /dev/null 2>&1 ; then \ rm `basename $< .ok`.fail ; \ touch $@ ; \ echo Passed ; \ else \ echo Failed "<====================" ; \ fi OKS= \ ${BRINGOVER_OKS} \ ${CLOSE_OKS} \ ${CREATE_OKS} \ ${DIFFS_OKS} \ ${FILE_OKS} \ ${GET_OKS} \ ${HISTORY_OKS} \ ${MKDIR_OKS} \ ${NEW_OKS} \ ${OPEN_OKS} \ ${PARENT_OKS} \ ${PUTBACK_OKS} \ ${REFRESH_OKS} \ ${SLICE_OKS} \ ${TELL_OKS} \ ${UNEDIT_OKS} TESTS= \ ${BRINGOVER_PASSES} \ ${CLOSE_PASSES} \ ${CREATE_PASSES} \ ${DIFFS_PASSES} \ ${FILE_PASSES} \ ${GET_PASSES} \ ${HISTORY_PASSES} \ ${MKDIR_PASSES} \ ${NEW_PASSES} \ ${OPEN_PASSES} \ ${PARENT_PASSES} \ ${PUTBACK_PASSES} \ ${REFRESH_PASSES} \ ${SLICE_PASSES} \ ${TELL_PASSES} \ ${UNEDIT_PASSES} FAILS = ${OKS:%.ok=%.fail} # `svms bringover' command tests: BRINGOVER_OKS= \ bringover_help.ok \ bringover_empty.ok \ bringover_basic.ok BRINGOVER_PASSES= \ bringover_help.pass \ bringover_empty.pass \ bringover_basic.pass # `svms close' command tests: CLOSE_OKS= \ close_help.ok \ close_empty.ok \ close_basic.ok \ close_no_change.ok \ close_n_and_p.ok \ close_multiple.ok \ close_subdir.ok \ close_timestamp.ok CLOSE_PASSES= \ close_help.pass \ close_empty.pass \ close_basic.pass \ close_no_change.pass \ close_n_and_p.pass \ close_multiple.pass \ close_subdir.pass \ close_timestamp.pass # `svms create' command tests: CREATE_OKS= \ create_help.ok \ create_empty.ok \ create_basic.ok \ create_subdir.ok \ create_no_subdir.ok \ create_subdir2.ok \ create_duplicate.ok \ create_timestamp.ok \ create_no_tree.ok \ create_no_file.ok \ create_no_dir.ok CREATE_PASSES= \ create_help.pass \ create_empty.pass \ create_basic.pass \ create_subdir.pass \ create_no_subdir.pass \ create_subdir2.pass \ create_duplicate.pass \ create_timestamp.pass \ create_no_tree.pass \ create_no_file.pass \ create_no_dir.pass # `svms diffs' command tests: DIFFS_OKS= \ diffs_help.ok \ diffs_empty.ok \ diffs_basic.ok DIFFS_PASSES= \ diffs_help.pass \ diffs_empty.pass \ diffs_basic.pass # File tests: FILE_OKS= \ file_basic.ok \ file_large.ok FILE_PASSES= \ file_basic.pass \ file_large.pass # `svms get' tests: GET_OKS= \ get_help.ok \ get_basic.ok \ get_no_arguments.ok \ get_no_overwrite.ok \ get_no_open.ok GET_PASSES= \ get_help.pass \ get_basic.pass \ get_no_arguments.pass \ get_no_overwrite.pass \ get_no_open.pass # `svms history' command tests: HISTORY_OKS= \ history_help.ok \ history_empty.ok \ history_basic.ok \ history_multiple.ok HISTORY_PASSES= \ history_help.pass \ history_empty.pass \ history_basic.pass \ history_multiple.pass # `svms mkdir' command tests: MKDIR_OKS= \ mkdir_help.ok \ mkdir_empty.ok \ mkdir_basic.ok \ mkdir_multiple.ok \ mkdir_repeat.ok \ mkdir_duplicate.ok \ mkdir_d_option.ok \ mkdir_c_option.ok \ mkdir_nested.ok \ mkdir_c_option_error.ok \ mkdir_subdir.ok \ mkdir_bad_option.ok \ mkdir_bogus_file.ok MKDIR_PASSES= \ mkdir_help.pass \ mkdir_empty.pass \ mkdir_basic.pass \ mkdir_multiple.pass \ mkdir_repeat.pass \ mkdir_duplicate.pass \ mkdir_d_option.pass \ mkdir_c_option.pass \ mkdir_nested.pass \ mkdir_c_option_error.pass \ mkdir_subdir.pass \ mkdir_bad_option.pass \ mkdir_bogus_file.pass # `svms new' command tests: NEW_OKS= \ new_help.ok \ new_empty.ok \ new_basic.ok \ new_mkdir.ok \ new_recursive.ok \ new_no_dir.ok \ new_on_top.ok \ new_no_nest_child.ok \ new_no_nest_parent.ok \ new_no_access.ok \ new_no_on_file.ok \ new_missing_dir.ok \ new_missing_nickname.ok \ new_bad_option.ok NEW_PASSES= \ new_help.pass \ new_empty.pass \ new_basic.pass \ new_mkdir.pass \ new_recursive.pass \ new_no_dir.pass \ new_on_top.pass \ new_no_nest_child.pass \ new_no_nest_parent.pass \ new_no_access.pass \ new_no_on_file.pass \ new_missing_dir.pass \ new_missing_nickname.pass \ new_bad_option.pass # `svms open' tests: OPEN_OKS= \ open_help.ok \ open_empty.ok \ open_basic.ok \ open_duplicate.ok \ open_no_create.ok OPEN_PASSES= \ open_help.pass \ open_empty.pass \ open_basic.pass \ open_duplicate.pass \ open_no_create.pass # `svms parent' command tests: PARENT_OKS= \ parent_help.ok \ parent_empty.ok \ parent_basic.ok \ parent_tell.ok \ parent_bad_dir_url.ok \ parent_bad_eager_lazy.ok \ parent_bad_unparent_dir.ok \ parent_bad_unparent_url.ok \ parent_bad_unparent_proxy.ok \ parent_bad_proxy_no_host.ok PARENT_PASSES= \ parent_help.pass \ parent_empty.pass \ parent_basic.pass \ parent_tell.pass \ parent_bad_dir_url.pass \ parent_bad_eager_lazy.pass \ parent_bad_unparent_dir.pass \ parent_bad_unparent_url.pass \ parent_bad_unparent_proxy.pass \ parent_bad_proxy_no_host.pass # `svms putback' command tests: PUTBACK_OKS= \ putback_help.ok \ putback_empty.ok \ putback_basic.ok PUTBACK_PASSES= \ putback_help.pass \ putback_empty.pass \ putback_basic.pass # `svms refresh' testing: REFRESH_OKS= \ refresh_empty.ok \ refresh_help.ok \ refresh_basic.ok \ refresh_damaged.ok \ refresh_multiple.ok \ refresh_subdir.ok REFRESH_PASSES= \ refresh_empty.pass \ refresh_help.pass \ refresh_basic.pass \ refresh_damaged.pass \ refresh_multiple.pass \ refresh_subdir.pass # slice testing: SLICE_OKS= \ slice_basic.ok SLICE_PASSES= \ slice_basic.pass # `svms tell' tests: TELL_OKS= \ tell_help.ok \ tell_empty.ok \ tell_basic.ok TELL_PASSES= \ tell_help.pass \ tell_empty.pass \ tell_basic.pass # `svms unedit' tests: UNEDIT_OKS= \ unedit_help.ok \ unedit_basic.ok \ unedit_no_arguments.ok \ unedit_no_open.ok # `svms unedit' tests: UNEDIT_PASSES= \ unedit_help.pass \ unedit_basic.pass \ unedit_no_arguments.pass \ unedit_no_open.pass COPY_LIST = \ ${OKS} \ index.html \ Makefile SOURCE_LIST = \ ${OKS} \ Makefile .PHONE: all clean copy spell test all: source.html init: $(SVMS) ${OKS} test: $(SVMS) $(WAIT) ${TESTS} @-ls *.fail 2>/dev/null > /tmp/failed @if [ -s /tmp/failed ] ; then \ echo "The following tests failed:" ; \ cat /tmp/failed ; \ else \ echo "All tests passed" ; \ fi @rm -f /tmp/failed clean: rm -f $(SVMS) ${TESTS} ${FAILS} svms source.html $(CLEAN) copy: ${COPY_LIST} if [ "$(COPY_DIRECTORY)" = "" ] ; \ then \ echo "Please set COPY_DIRECTORY in `pwd`" ; \ false ; \ fi rm -rf $(COPY_DIRECTORY) mkdir -p $(COPY_DIRECTORY) cp ${COPY_LIST} $(COPY_DIRECTORY) $(SVMS): rm -f $@ (cd .. ; ln -s `pwd`/$(PLATFORM)/svms $@) # Each test should be "reentrant". # `svms bringover' command tests: bringover_help: # Make sure that `svms help bringover' works: $(SVMS) help bringover bringover_empty: # Make sure that `svms bringover' with no arguments works: $(SVMS) bringover bringover_basic: # Do a real simple test of the `svms bringover' command: $(FRESH) # Create the parent project and contents: mkdir -p $(PDIR)/parent/dir1 $(PDIR)/parent/dir2 $(SVMS) new -R $(PDIR)/parent $@ $(CD)/parent; $(SVMS) mkdir dir1 echo Hello > $(PDIR)/parent/dir1/hello.txt $(CD)/parent/dir1; $(SVMS) create hello.txt $(CD)/parent; $(SVMS) mkdir dir2 echo Goodbye > $(PDIR)/parent/dir2/goodbye.txt $(CD)/parent/dir2; $(SVMS) create goodbye.txt # Create the child project: mkdir -p $(PDIR)/child $(SVMS) new -R $(PDIR)/child $@ # Do the first bringover: $(CD)/child; $(SVMS) parent -e -d $(PDIR)/parent $(CD)/child; $(SVMS) bringover :/... diff $(PDIR)/parent/dir1/hello.txt $(PDIR)/child/dir1/hello.txt diff $(PDIR)/parent/dir2/goodbye.txt $(PDIR)/child/dir1/goodbye.txt # Modify a file in the parent: $(CD)/parent/dir1; $(SVMS) open hello.txt echo Hi >> $(PDIR)/parent/dir1/hello.txt $(CD)/parent/dir1; $(SVMS) close hello.txt # Perform the second bringover: $(CD)/child; $(SVMS) bringover diff $(PDIR)/parent/dir1/hello.txt $(PDIR)/child/dir1/hello.txt diff $(PDIR)/parent/dir2/goodbye.txt $(PDIR)/child/dir1/goodbye.txt $(FRESH) # `svms close' command tests: close_help: # Make sure that `svms help close' works: $(SVMS) help close close_empty: # Make sure that `svms close' with no arguments works: $(SVMS) close close_basic: # Do a real simple test of the `svms close' command: $(FRESH) $(SVMS) new -R $(PDIR) $@ echo Hello > $(PDIR)/hello.txt $(CD) ; $(SVMS) create hello.txt cat $(PDIR)/SVMS/h.hello.txt $(CD) ; $(SVMS) open hello.txt echo Goodbye > $(PDIR)/hello.txt $(CD) ; $(SVMS) close -n hello.txt cat $(PDIR)/SVMS/h.hello.txt $(CD) ; $(SVMS) open hello.txt echo Hello > $(PDIR)/hello.txt echo Hula > $(PDIR)/hello.txt echo Goodbye > $(PDIR)/hello.txt $(CD) ; $(SVMS) close -n hello.txt cat $(PDIR)/hello.txt # Capture directory structure: ls -R $(PDIR) if [ -w $(PDIR)/hello.txt ] ; \ then echo "File is writable (incorrect)" ; \ else echo "File is read-only (correct)" ; \ fi cat $(PDIR)/SVMS/h.hello.txt $(FRESH) close_no_change: # Do a sequence of open/close's with no underlying file changes: $(FRESH) $(SVMS) new -R $(PDIR) $@ echo Hello > $(PDIR)/hello.txt $(CD) ; $(SVMS) create hello.txt cat $(PDIR)/SVMS/h.hello.txt $(CD) ; $(SVMS) open hello.txt # Close file without making any modifications: $(CD) ; $(SVMS) close -n hello.txt cat $(PDIR)/SVMS/h.hello.txt $(CD) ; $(SVMS) open hello.txt # Close file without making any modifications: $(CD) ; $(SVMS) close -n hello.txt cat $(PDIR)/hello.txt # Capture directory structure: ls -R $(PDIR) if [ -w $(PDIR)/hello.txt ] ; \ then echo "File is writable (incorrect)" ; \ else echo "File is read-only (correct)" ; \ fi cat $(PDIR)/SVMS/h.hello.txt $(FRESH) close_multiple: # Make sure that multiple `svms close' commands work: $(FRESH) $(SVMS) new -R $(PDIR) $@ echo Hello > $(PDIR)/hello.txt echo Goodbye >> $(PDIR)/hello.txt $(CD) ; $(SVMS) create hello.txt if [ -w $(PDIR)/hello.txt ] ; \ then echo "File is read-write (incorrect)" ; \ else echo "File is read-only (correct)" ; \ fi $(CD) ; $(SVMS) open hello.txt if [ -w $(PDIR)/hello.txt ] ; \ then echo "File is read-write (correct)" ; \ else echo "File is read-only (incorrect)" ; \ fi cp $(PDIR)/SVMS/h.hello.txt $(PDIR)/h.hello.txt for i in 1 2 3 4 5 6 7 8 9 10 ; do \ echo Line $$i >> $(PDIR)/hello.txt ; \ echo >> $(PDIR)/hello.txt ; \ done echo Bye >> $(PDIR)/hello.txt $(CD) ; echo comment 1 | $(SVMS) close -p hello.txt if [ -w $(PDIR)/hello.txt ] ; \ then echo "File is read-write (incorrect)" ; \ else echo "File is read-only (correct)" ; \ fi $(CD) ; $(SVMS) open hello.txt if [ -w $(PDIR)/hello.txt ] ; \ then echo "File is read-write (correct)" ; \ else echo "File is read-only (incorrect)" ; \ fi echo Goodbye already >> $(PDIR)/hello.txt $(CD) ; echo comment 2 | $(SVMS) close -p hello.txt cat $(PDIR)/SVMS/h.hello.txt $(FRESH) close_subdir: # Make sure that a file can be closed from a sub-directory: $(FRESH) $(SVMS) new -R $(PDIR) $@ $(CD) ; mkdir subdir ; $(SVMS) mkdir subdir echo Hello > $(PDIR)/subdir/hello.txt $(CD)/subdir ; $(SVMS) create hello.txt $(CD)/subdir ; $(SVMS) open hello.txt echo Goodbye >> $(PDIR)/subdir/hello.txt $(CD)/subdir ; $(SVMS) close -n hello.txt ls -R $(PDIR) cat $(PDIR)/SVMS/d.subdir/h.hello.txt $(FRESH) close_timestamp: # Make sure that a file can be closed with a set timestamp: $(FRESH) $(SVMS) new -R $(PDIR) $@ $(CD) ; mkdir subdir ; $(SVMS) mkdir subdir echo Hello > $(PDIR)/subdir/hello.txt $(CD)/subdir ; $(SVMS) create -T 1995/01/01@12:34:56GMT hello.txt $(CD)/subdir ; $(SVMS) open hello.txt echo Goodbye >> $(PDIR)/subdir/hello.txt $(CD)/subdir ; $(SVMS) close -n -T 1995/01/01@12:34:57GMT hello.txt ls -R $(PDIR) cat $(PDIR)/SVMS/d.subdir/h.hello.txt | \ sed "s,1995/01/01@12:34:56GMT,{TS1},g" | \ sed "s,1995/01/01@12:34:57GMT,{TS2},g" $(FRESH) close_n_and_p: # Make sure that using both -n and -p optons on same command fails: $(FRESH) $(SVMS) new -R $(PDIR) $@ ($(CD) ; \ echo Hi > hello.txt ; \ $(SVMS) create hello.txt ; \ $(SVMS) open hello.txt ; \ if $(SVMS) close -n -p hello.txt ; \ then echo "Command succeeded (incorrect)" ; \ else echo "Command failed (correct)" ; \ fi) $(FRESH) # `svms create' command tests: create_help: # Make sure that `svms help create' works: $(SVMS) help create create_empty: # Make sure that `svms create' with no arguments works: $(SVMS) create create_basic: # Make sure that the basic `svms create' command works: $(FRESH) $(SVMS) new -R $(PDIR) $@ echo Hello > $(PDIR)/hello.txt echo Goodbye >> $(PDIR)/hello.txt $(CD); $(SVMS) create hello.txt # Verify that the file is now read-only: if [ -w $(PDIR)/hello.txt ] ; \ then echo "File is read-write (incorrect)" ; \ else echo "File is read-only (correct)" ; \ fi # Capture the directory structure: ls -R $(PDIR) cat $(PDIR)/SVMS/p.listing cat $(PDIR)/SVMS/h.hello.txt $(FRESH) create_subdir: # Make sure that it is possible to do an `svms create' from # a sub-directory: $(FRESH) $(SVMS) new -R $(PDIR) $@ ($(CD) ; mkdir subdir ; $(SVMS) mkdir subdir) echo Hello > $(PDIR)/subdir/hello.txt ($(CD)/subdir ; \ if $(SVMS) create hello.txt ; then \ echo "Command succeeded" ; else \ echo "Command failed" ; \ fi) # Capture the directory structure: ls -R $(PDIR) cat $(PDIR)/SVMS/d.subdir/p.listing $(FRESH) create_no_subdir: # Make sure that creating a file without a corresponding # sub-directory fails: $(FRESH) $(SVMS) new -R $(PDIR) $@ mkdir $(PDIR)/subdir echo Hello > $(PDIR)/subdir/hello.txt ($(CD)/subdir; \ if $(SVMS) create hello.txt ; \ then echo "Command succeeded (incorrect)" ; \ else echo "Command failed (correct)" ; \ fi) $(FRESH) create_subdir2: # Make sure that it is possible to do an `svms create' from # a sub-sub-directory: $(FRESH) $(SVMS) new -R $(PDIR) $@ ($(CD) ; \ mkdir subdir subdir/subdir2 ; \ $(SVMS) mkdir subdir subdir/subdir2) echo Hello > $(PDIR)/subdir/subdir2/hello.txt ($(CD)/subdir/subdir2 ; \ if $(SVMS) create hello.txt ; \ then echo "Command succeeded (correct)" ; \ else echo "Command failed (incorrect)" ; \ fi) # Capture the directory structure: ls -R $(PDIR) cat $(PDIR)/SVMS/d.subdir/d.subdir2/p.listing $(FRESH) create_duplicate: # Make sure that a create on top of an existing file fails: $(FRESH) $(SVMS) new -R $(PDIR) $@ echo Hello > $(PDIR)/hello.txt ($(CD) ; \ $(SVMS) create hello.txt ; \ chmod +w hello.txt ; \ if $(SVMS) create hello.txt ; \ then echo "Command succeeded (incorrect)" ; \ else echo "Command failed (correct)"; \ fi) $(FRESH) create_timestamp: # Make sure that a create with a timestamp works: $(FRESH) $(SVMS) new -R $(PDIR) $@ echo Hello > $(PDIR)/hello.txt $(CD) ; $(SVMS) create -T 1995/01/01@12:34:56GMT hello.txt cat $(PDIR)/SVMS/h.hello.txt | \ sed "s,1995/01/01@12:34:56GMT,{TS1},g" $(FRESH) create_no_tree: # Make sure that an error occurs when a tree is specified. $(FRESH) $(SVMS) new -R $(PDIR) $@ ($(CD) ; \ if $(SVMS) create ... ; \ then echo "Command succeeded (incorrect)" ; \ else echo "Command failed (correct)" ; \ fi) $(FRESH) create_no_file: # Make sure that an error occurs when no file is specified. $(FRESH) $(SVMS) new -R $(PDIR) $@ ($(CD) ; \ if $(SVMS) create no.file ; \ then echo "Command succeeded (incorrect)" ; \ else echo "Command failed (correct)" ; \ fi) $(FRESH) create_no_dir: # Make sure that an error occurs when a directory is specified. $(FRESH) $(SVMS) new -R $(PDIR) $@ mkdir $(PDIR)/foo ($(CD) ; \ if $(SVMS) create foo ; \ then echo "Command succeeded (incorrect)" ; \ else echo "Command failed (correct)" ; \ fi) $(FRESH) # `sccs diffs' tests: diffs_help: # Make sure that `svms help diffs' works: $(SVMS) help create diffs_empty: # Make sure that `svms diffs' with no arguments works: $(SVMS) create diffs_basic: # Make sure that the basic `svms diffs' command works: $(FRESH) $(SVMS) new -R $(PDIR) $@ echo Hello > $(PDIR)/hello.txt echo Goodbye >> $(PDIR)/hello.txt $(CD) ; $(SVMS) create hello.txt $(CD) ; $(SVMS) open hello.txt echo Hi > $(PDIR)/hello.txt echo Hello >> $(PDIR)/hello.txt echo Bye >> $(PDIR)/hello.txt $(CD) ; $(SVMS) diffs hello.txt $(FRESH) # Basic file test: file_basic: # Make sure that the basic create/open/close loop works: $(FRESH) $(SVMS) new -R $(PDIR) $@ ($(CD) ; \ echo Hello > file.txt ; \ echo Goodbye >> file.txt ; \ $(SVMS) create file.txt ; \ $(SVMS) open file.txt ; \ echo Hello > file.txt ; \ echo Middle >> file.txt ; \ echo Goodbye >> file.txt ; \ $(SVMS) close -n file.txt \ ) cat $(PDIR)/SVMS/h.file.txt $(FRESH) file_large: # Make sure that large files can be saved and restored: $(FRESH) $(SVMS) new -R $(PDIR) $@ echo Hello > $(PDIR)/hello.txt ($(CD) ; \ $(SVMS) create hello.txt ) ($(CD) ; \ $(SVMS) open hello.txt ) for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ; do \ echo "line $$i" >> $(PDIR)/temp.txt ; \ done cat $(PDIR)/temp.txt >> $(PDIR)/hello.txt cat $(PDIR)/temp.txt | sort -r >> $(PDIR)/hello.txt cat $(PDIR)/temp.txt >> $(PDIR)/hello.txt cat $(PDIR)/temp.txt | sort -r >> $(PDIR)/hello.txt cat $(PDIR)/temp.txt >> $(PDIR)/hello.txt cat $(PDIR)/temp.txt >> $(PDIR)/hello.txt ($(CD) ; \ $(SVMS) close -n hello.txt ) cat $(PDIR)/SVMS/h.hello.txt $(FRESH) # `svms get' command tests: get_help: # Make sure that `svms help get' works: $(SVMS) help get get_basic: # Make sure that the basic `svms get' command works: $(FRESH) $(SVMS) new -R $(PDIR) $@ echo Hello > $(PDIR)/hello.txt $(CD) ; $(SVMS) create hello.txt rm -f $(PDIR)/hello.txt $(CD) ; $(SVMS) get hello.txt # Verify that the file is read-only: if [ -w $(PDIR)/hello.txt ] ; \ then echo "File is read-write (incorrect)" ; \ else echo "File is read-only (correct)" ; \ fi # Verify that the file is closed in the p.listing file: cat $(PDIR)/SVMS/p.listing # Verify that we got the right contents: cat $(PDIR)/hello.txt $(FRESH) get_no_arguments: # Make sure that `svms get' with no arguments works: $(SVMS) get get_no_overwrite: # Make sure that `svms get' will not overwrite a read-write file: $(FRESH) $(SVMS) new -R $(PDIR) $@ echo Hello > $(PDIR)/hello.txt $(CD) ; $(SVMS) create hello.txt chmod +w $(PDIR)/hello.txt echo Goodbye >> $(PDIR)/hello.txt # Remember the state of the files: ls -l $(PDIR)/hello.txt > $(PDIR)/root.ls1 ls -l $(PDIR)/SVMS > $(PDIR)/svms.ls1 cp $(PDIR)/hello.txt $(PDIR)/hello.txt.save cp $(PDIR)/SVMS/h.hello.txt $(PDIR)/h.hello.txt.save cp $(PDIR)/SVMS/p.listing $(PDIR)/p.listing.save # Run the command and make sure that it fails: $(CD) ; if $(SVMS) get hello.txt ; \ then echo "Command succeeded (incorrect)" ; \ else echo "Command failed (correct)" ; \ fi # Verify that no files changed: ls -l $(PDIR)/hello.txt > $(PDIR)/root.ls2 ls -l $(PDIR)/SVMS > $(PDIR)/svms.ls2 cmp $(PDIR)/root.ls1 $(PDIR)/root.ls2 cmp $(PDIR)/svms.ls1 $(PDIR)/svms.ls2 cmp $(PDIR)/hello.txt $(PDIR)/hello.txt.save cmp $(PDIR)/SVMS/h.hello.txt $(PDIR)/h.hello.txt.save cmp $(PDIR)/SVMS/p.listing $(PDIR)/p.listing.save $(FRESH) get_no_open: # Make sure that `svms get' will not overwrite an open file: $(FRESH) $(SVMS) new -R $(PDIR) $@ echo Hello > $(PDIR)/hello.txt $(CD) ; $(SVMS) create hello.txt $(CD) ; $(SVMS) open $(PDIR)/hello.txt echo Goodbye >> $(PDIR)/hello.txt # Remember the state of the files: ls -l $(PDIR)/hello.txt > $(PDIR)/root.ls1 ls -l $(PDIR)/SVMS > $(PDIR)/svms.ls1 cp $(PDIR)/hello.txt $(PDIR)/hello.txt.save cp $(PDIR)/SVMS/h.hello.txt $(PDIR)/h.hello.txt.save cp $(PDIR)/SVMS/p.listing $(PDIR)/p.listing.save $(CD); if $(SVMS) get hello.txt ; \ then echo "Command succeeded (incorrect)" ; \ else echo "Command failed (correct)" ; \ fi # Verify that no files changed: ls -l $(PDIR)/hello.txt > $(PDIR)/root.ls2 ls -l $(PDIR)/SVMS > $(PDIR)/svms.ls2 cmp $(PDIR)/root.ls1 $(PDIR)/root.ls2 cmp $(PDIR)/svms.ls1 $(PDIR)/svms.ls2 cmp $(PDIR)/hello.txt $(PDIR)/hello.txt.save cmp $(PDIR)/SVMS/h.hello.txt $(PDIR)/h.hello.txt.save cmp $(PDIR)/SVMS/p.listing $(PDIR)/p.listing.save $(FRESH) # `svms history' command tests: history_help: # Make sure that `svms help history' works: $(SVMS) help history history_empty: # Make sure that `svms history' with no arguments works: $(SVMS) history history_basic: # Make sure that the basic `svms history' command works: $(FRESH) $(SVMS) new -R $(PDIR) $@ echo Hello > $(PDIR)/hello.txt $(CD) ; $(SVMS) create hello.txt $(CD) ; $(SVMS) history hello.txt $(CD) ; $(SVMS) open hello.txt echo Goodbye >> $(PDIR)/hello.txt $(CD) ; echo Comment 1 | $(SVMS) close -p hello.txt $(CD) ; $(SVMS) history hello.txt $(CD) ; $(SVMS) open hello.txt echo Bye >> $(PDIR)/hello.txt $(CD) ; echo Comment 2 | $(SVMS) close -p hello.txt $(CD) ; $(SVMS) history hello.txt $(FRESH) history_multiple: # Make sure that the `svms history' command with multiple files works: $(FRESH) $(SVMS) new -R $(PDIR) $@ # Create hello.txt: echo Hello > $(PDIR)/hello.txt $(CD) ; $(SVMS) create hello.txt $(CD) ; $(SVMS) open hello.txt echo Goodbye >> $(PDIR)/hello.txt $(CD) ; echo Comment 1 | $(SVMS) close -p hello.txt # Create goodbye.txt: echo Goodbye > $(PDIR)/goodbye.txt $(CD) ; $(SVMS) create goodbye.txt $(CD) ; $(SVMS) open goodbye.txt $(CD) ; echo Comment 2 | $(SVMS) close -p goodbye.txt # List history for both: $(CD) ; $(SVMS) history hello.txt goodbye.txt $(FRESH) # `svms mkdir' command tests: mkdir_help: # Make sure that `svms help mkdir' works: $(SVMS) help mkdir mkdir_empty: # Make sure that `svms mkdir' with no arguments works: $(SVMS) mkdir mkdir_basic: # Make sure that the basic `svms mkdir' command works: $(FRESH) $(SVMS) new -R $(PDIR) $@ ($(CD); \ mkdir src ; \ $(SVMS) mkdir src ) # Record the file structure: ls -R $(PDIR) cat $(PDIR)/SVMS/p.listing cat $(PDIR)/SVMS/d.src/p.listing cat $(PDIR)/SVMS/h.src $(FRESH) mkdir_multiple: # Make sure that multiple directories can be created with one command: $(FRESH) $(SVMS) new -R $(PDIR) $@ ($(CD) ; \ mkdir src include ; \ $(SVMS) mkdir src include ) # Record the file structure: ls -R $(PDIR) more $(PDIR)/SVMS/p.listing $(FRESH) mkdir_repeat: # Make sure that multiple mkdir commands can be executed sequentially: $(FRESH) $(SVMS) new -R $(PDIR) $@ ($(CD) ; \ $(SVMS) mkdir -c src ; \ $(SVMS) mkdir -c include ; \ $(SVMS) mkdir -c man ) # Record the file structure: ls -R $(PDIR) more $(PDIR)/SVMS/p.listing $(FRESH) mkdir_duplicate: # Make sure that an error message occurs on duplicate mkdir commands # of the same directory. $(FRESH) $(SVMS) new -R $(PDIR) $@ -($(CD); \ mkdir src ; \ $(SVMS) mkdir src ; \ $(SVMS) mkdir src ) $(FRESH) mkdir_d_option: # Make sure that the -d flag suppresses duplicate error message: $(FRESH) $(SVMS) new -R $(PDIR) $@ ($(CD); \ mkdir src include ; \ $(SVMS) mkdir src ; \ $(SVMS) mkdir -d src include ) # Record the file structure: ls -R $(PDIR) $(FRESH) mkdir_c_option: # Make sure that the -c flag creates the actual directories: $(FRESH) $(SVMS) new -R $(PDIR) $@ ($(CD) ; \ $(SVMS) mkdir -c src include ) # Record the file structure: ls -R $(PDIR) $(FRESH) mkdir_nested: # Make sure that nested directories are created: $(FRESH) $(SVMS) new -R $(PDIR) $@ -($(CD) ; \ $(SVMS) mkdir -c src/compiler src ) # Record the file structure: ls -R $(PDIR) cat $(PDIR)/SVMS/p.listing cat $(PDIR)/SVMS/d.src/p.listing cat $(PDIR)/SVMS/d.src/d.compiler/p.listing $(FRESH) mkdir_c_option_error: # Make sure that the -c flag fails if the directory already exists: $(FRESH) $(SVMS) new -R $(PDIR) $@ -($(CD) ; \ mkdir src ; \ $(SVMS) mkdir -c src ) $(FRESH) mkdir_subdir: # Make sure that the -c option works from a sub-directory: $(FRESH) $(SVMS) new -R $(PDIR) $@ ($(CD) ; \ $(SVMS) mkdir -c src ; \ cd src ; \ $(SVMS) mkdir -c program ) # Record the directory structure: ls -R $(PDIR) cat $(PDIR)/SVMS/p.listing cat $(PDIR)/SVMS/d.src/p.listing cat $(PDIR)/SVMS/d.src/d.program/p.listing $(FRESH) mkdir_bogus_file: # Make sure that `svms mkdir' fails if the file is a text file: $(FRESH) $(SVMS) new -R $(PDIR) $@ ($(CD) ; \ touch src ; \ if $(SVMS) mkdir src ; then \ echo "Command succeeded (incorrect)" ; else \ echo "Command failed (correct)" ; \ fi) $(FRESH) mkdir_bad_option: # Make sure that the 'svms mkdir' command can deal with a bad option: $(SVMS) mkdir -x foo # `svms new' command tests: new_help: # Make sure that `svms help new' works: $(SVMS) help new new_empty: # Make sure that `svms new' with no arguments works: $(SVMS) new new_basic: # Make sure that the basic `svms new' command works: $(FRESH) mkdir $(PDIR) $(SVMS) new $(PDIR) $@ # Do a recursive directory list to record structure: ls -R $(PDIR) cat $(PDIR)/SVMS/p.listing $(FRESH) new_mkdir: # Make sure that the basic `svms new -R' command works: $(FRESH) $(SVMS) new -R $(PDIR) $@ # Do a recursive directory list to record structure: ls -R $(PDIR) cat $(PDIR)/SVMS/p.listing $(FRESH) new_recursive: # Make sure that multi-level `svms new -R' command works: $(FRESH)/foo/bar $(SVMS) new -R $(PDIR)/foo/bar $@ # Do a recursive directory list to record structure: ls -R $(PDIR) $(FRESH) new_no_dir: # Make sure that `svms new' fails when no directory is present: $(FRESH) $(SVMS) new $(PDIR) $@ $(FRESH) new_no_nest_child: # Make sure that creating nested projects does not work: # Case 1: Creating a nested child: $(FRESH) # Create parent directory first (succeeds) $(SVMS) new -R $(PDIR)/parent new_no_nest_child_parent # Create the child directory second (fails) -$(SVMS) new -R $(PDIR)/parent/child new_no_nest_child_child # Capture the directory structure: ls -R $(PDIR) $(FRESH) new_no_nest_parent: # Make sure that creating nested projects does not work: # Case 2: Creating a nested parent # This case is to expensive to test for since it requires a # recursive search of all child diretories to find an SVMS # directory. Instead, this problem is caught the first time # an svms command is executed in the child project. So, we'll # let this test case go as is. $(FRESH) # Create the child directory second (succeeds) $(SVMS) new -R $(PDIR)/parent/child new_no_nest_parent_child # Create parent directory first (succeeds) $(SVMS) new -R $(PDIR)/parent new_no_nest_child_parent_parent # Capture the directory structure: ls -R $(PDIR) $(FRESH) new_on_top: # Make sure that two `svms new' commands to the same directory fail: $(FRESH) # First one succeeds: $(SVMS) new -R $(PDIR) $@ # Second one fails: -$(SVMS) new -R $(PDIR) $@ $(FRESH) new_no_access: # Make sure that `svms new' to an inaccesible directory fails: $(FRESH) mkdir $(PDIR) chmod 0 $(PDIR) # This command should fail! -$(SVMS) new -R $(PDIR)/foo $@ chmod 777 $(PDIR) $(FRESH) new_no_on_file: # Make sure that `svms new' on top of a file fails: $(FRESH) touch $(PDIR) -$(SVMS) new $(PDIR) $@ $(FRESH) new_missing_dir: # Make sure that a missing project directory properly fails: $(SVMS) new -R new_missing_nickname: # Make sure that a missing nickname properly fails: $(FRESH) $(SVMS) new $(PDIR) $(FRESH) new_bad_option: # Make sure that a bad option (-r) properly fails: $(FRESH) $(SVMS) new -r $(PDIR) $@ $(FRESH) # `svms open' command tests: open_help: # Make sure that `svms help open' works: $(SVMS) help open open_empty: # Make sure that `svms open' with no arguments works: $(SVMS) open open_basic: # Make sure that basic `svms open' command works: $(FRESH) $(SVMS) new -R $(PDIR) $@ echo Hello > $(PDIR)/hello.txt echo Goodbye >> $(PDIR)/hello.txt ($(CD) ; $(SVMS) create hello.txt ) if [ -w $(PDIR)/hello.txt ] ; \ then echo "File is read-write (incorrect)" ; \ else echo "File is read-only (correct)" ; \ fi ($(CD) ; \ if $(SVMS) open hello.txt ; \ then echo "Command succeeded (correct)" ; \ else echo "Command failed (incorrect)" ; \ fi ) if [ -w $(PDIR)/hello.txt ] ; \ then echo "File is read-write (correct)" ; \ else echo "File is read-only (incorrect)" ; \ fi cat $(PDIR)/hello.txt $(FRESH) open_duplicate: # Make sure that two open's in a row fail: $(FRESH) $(SVMS) new -R $(PDIR) $@ echo Hello > $(PDIR)/hello.txt ($(CD) ; \ $(SVMS) create hello.txt ; \ $(SVMS) open hello.txt ; \ if $(SVMS) open hello.txt ; \ then echo "Command succeeded (incorrect)" ; \ else echo "Command failed (correct)" ; \ fi) $(FRESH) open_no_create: # Make sure that an open of a non-created file fails: $(FRESH) $(SVMS) new -R $(PDIR) $@ echo Hello > $(PDIR)/hello.txt ($(CD) ; \ if $(SVMS) open hello.txt ; \ then echo "Command succeeded (incorrect)" ; \ else echo "Command failed (correct)" ; \ fi) $(FRESH) # `svms parent' command tests: parent_help: # Make sure that `svms help parent' works: $(SVMS) help parent parent_empty: # Make sure that `svms parent' with no arguments works: $(SVMS) parent parent_basic: # Make sure that `svms parent basic' works: $(FRESH) $(FRESH) parent_tell: # Do a bunch of tests on `svms parent -t': $(FRESH) $(SVMS) new -R $(PDIR)/parent $@_parent $(SVMS) new -R $(PDIR)/child $@_child $(CD)/child; $(SVMS) parent -t $(CD)/child; $(SVMS) parent -h http://somehost/ $(CD)/child; $(SVMS) parent -t $(CD)/child; $(SVMS) parent -p http://proxyhost:8080/ $(CD)/child; $(SVMS) parent -t $(CD)/child; $(SVMS) parent -l $(CD)/child; $(SVMS) parent -t $(CD)/child; $(SVMS) parent -d $(PDIR)/parent $(CD)/child; $(SVMS) parent -t $(CD)/child; $(SVMS) parent -e $(CD)/child; $(SVMS) parent -t $(CD)/child; $(SVMS) parent -u $(CD)/child; $(SVMS) parent -t $(FRESH) parent_bad_dir_url: # Make sure that an error message is generated for -d and -h: $(FRESH) $(SVMS) new -R $(PDIR) $@ ($(CD) ; \ if $(SVMS) parent -d /tmp -h http://foo.bar/ ; \ then echo "Command succeeded (incorrect)" ; \ else echo "Command failed (correct)"; \ fi) $(FRESH) parent_bad_eager_lazy: # Make sure that an error message is generated for -e and -l: $(FRESH) $(SVMS) new -R $(PDIR) $@ ($(CD) ; \ if $(SVMS) parent -e -l ; \ then echo "Command succeeded (incorrect)" ; \ else echo "Command failed (correct)"; \ fi) $(FRESH) parent_bad_unparent_dir: # Make sure that an error message is generated for -u and -d: $(FRESH) $(SVMS) new -R $(PDIR) $@ ($(CD) ; \ if $(SVMS) parent -u -d /tmp ; \ then echo "Command succeeded (incorrect)" ; \ else echo "Command failed (correct)"; \ fi) $(FRESH) parent_bad_unparent_url: # Make sure that an error message is generated for -u and -h: $(FRESH) $(SVMS) new -R $(PDIR) $@ ($(CD) ; \ if $(SVMS) parent -u -h http://foo.bar/ ; \ then echo "Command succeeded (incorrect)" ; \ else echo "Command failed (correct)"; \ fi) $(FRESH) parent_bad_unparent_proxy: # Make sure that an error message is generated for -u and -h: $(FRESH) $(SVMS) new -R $(PDIR) $@ ($(CD) ; \ if $(SVMS) parent -u -p http://foo.bar/ ; \ then echo "Command succeeded (incorrect)" ; \ else echo "Command failed (correct)"; \ fi) $(FRESH) parent_bad_proxy_no_host: # Make sure that an error message is generated for -p with no -h: $(FRESH) $(SVMS) new -R $(PDIR) $@ ($(CD) ; \ if $(SVMS) parent -p http://proxyhost:8080/ ; \ then echo "Command succeeded (incorrect)" ; \ else echo "Command failed (correct)" ; \ fi) $(FRESH) # `svms putback' command tests: putback_help: # Make sure that `svms help putback' works: $(SVMS) help putback putback_empty: # Make sure that `svms putback' with no arguments works: $(SVMS) putback putback_basic: # Do a real simple test of the `svms putback' command: $(FRESH) # Create the parent project and contents: $(SVMS) new -R $(PDIR)/parent $@ $(CD)/parent; $(SVMS) mkdir dir1 echo Hello > $(PDIR)/parent/dir1/hello.txt $(CD)/parent/dir1; $(SVMS) create hello.txt $(CD)/parent; $(SVMS) mkdir dir2 echo Goodbye > $(PDIR)/parent/dir2/goodbye.txt $(CD)/parent/dir2; $(SVMS) create goodbye.txt # Create the child project: $(SVMS) new -R $(PDIR)/child $@ # Do the first bringover: $(CD)/child; $(SVMS) parent $(PDIR)/parent $(CD)/child; $(SVMS) bringover diff $(PDIR)/parent/dir1/hello.txt $(PDIR)/child/dir1/hello.txt diff $(PDIR)/parent/dir2/goodbye.txt $(PDIR)/child/dir1/goodbye.txt # Modify a file in the child: $(CD)/child/dir1; $(SVMS) open hello.txt echo Hi >> $(PDIR)/child/dir1/hello.txt $(CD)/child/dir1; $(SVMS) close hello.txt # Perform the putback: $(CD)/child; $(SVMS) putback diff $(PDIR)/parent/dir1/hello.txt $(PDIR)/child/dir1/hello.txt diff $(PDIR)/parent/dir2/goodbye.txt $(PDIR)/child/dir1/goodbye.txt $(FRESH) # `svms tell' command tests: refresh_help: # Make sure that `svms help refresh' works: $(SVMS) help refresh refresh_empty: # Make sure that `svms refresh' with no arguments works: $(SVMS) refresh refresh_basic: # Make sure that basic `svms refresh' command works: $(FRESH) $(SVMS) new -R $(PDIR) $@ # Create a few subdirectories and files therein: mkdir $(PDIR)/subdir1 $(PDIR)/subdir1/subsubdir1 $(PDIR)/subdir2 $(CD) ; $(SVMS) mkdir subdir1 subdir1/subsubdir1 subdir2 echo Hello > $(PDIR)/top.txt $(CD) ; $(SVMS) create top.txt $(CD) ; $(SVMS) open top.txt echo 'Hello there' > $(PDIR)/subdir1/file1.txt $(CD)/subdir1 ; $(SVMS) create file1.txt echo 'Hi there' > $(PDIR)/subdir1/subsubdir1/another.txt $(CD)/subdir1/subsubdir1 ; $(SVMS) create another.txt echo 'Goodbye' > $(PDIR)/subdir2/goodbye.txt $(CD)/subdir2 ; $(SVMS) create goodbye.txt echo 'Fun fun fun' > $(PDIR)/subdir2/fun.txt $(CD)/subdir2 ; $(SVMS) create fun.txt $(CD)/subdir2 ; $(SVMS) open fun.txt # Hang onto the p.listing files for future comparison: cp $(PDIR)/SVMS/p.listing $(PDIR) cp $(PDIR)/SVMS/d.subdir1/p.listing $(PDIR)/subdir1 cp $(PDIR)/SVMS/d.subdir1/d.subsubdir1/p.listing \ $(PDIR)/subdir1/subsubdir1 cp $(PDIR)/SVMS/d.subdir2/p.listing $(PDIR)/subdir2 # Now damage the p.listing files: rm -f $(PDIR)/SVMS/p.listing rm -f $(PDIR)/SVMS/d.subdir1/p.listing rm -f $(PDIR)/SVMS/d.subdir1/d.subsubdir1/p.listing rm -f $(PDIR)/SVMS/d.subdir2/p.listing # Do the refresh: $(CD) ; $(SVMS) refresh -v :/... # Verify that the p.listing files are OK: diff $(PDIR)/SVMS/p.listing $(PDIR) diff $(PDIR)/SVMS/d.subdir1/p.listing $(PDIR)/subdir1 diff $(PDIR)/SVMS/d.subdir1/d.subsubdir1/p.listing \ $(PDIR)/subdir1/subsubdir1 diff $(PDIR)/SVMS/d.subdir2/p.listing $(PDIR)/subdir2 $(FRESH) refresh_damaged: # Make sure that basic `svms refresh' command works: $(FRESH) $(SVMS) new -R $(PDIR) $@ # Create a few subdirectories and files therein: mkdir $(PDIR)/subdir1 $(PDIR)/subdir1/subsubdir1 $(PDIR)/subdir2 $(CD) ; $(SVMS) mkdir subdir1 subdir1/subsubdir1 subdir2 echo Hello > $(PDIR)/top.txt $(CD) ; $(SVMS) create top.txt $(CD) ; $(SVMS) open top.txt echo 'Hello there' > $(PDIR)/subdir1/file1.txt $(CD)/subdir1 ; $(SVMS) create file1.txt echo 'Hi there' > $(PDIR)/subdir1/subsubdir1/another.txt $(CD)/subdir1/subsubdir1 ; $(SVMS) create another.txt echo 'Goodbye' > $(PDIR)/subdir2/goodbye.txt $(CD)/subdir2 ; $(SVMS) create goodbye.txt echo 'Fun fun fun' > $(PDIR)/subdir2/fun.txt $(CD)/subdir2 ; $(SVMS) create fun.txt $(CD)/subdir2 ; $(SVMS) open fun.txt # Hang onto the p.listing files for future comparison: cp $(PDIR)/SVMS/p.listing $(PDIR) cp $(PDIR)/SVMS/d.subdir1/p.listing $(PDIR)/subdir1 cp $(PDIR)/SVMS/d.subdir1/d.subsubdir1/p.listing \ $(PDIR)/subdir1/subsubdir1 cp $(PDIR)/SVMS/d.subdir2/p.listing $(PDIR)/subdir2 # Now damage the p.listing files: rm -f $(PDIR)/SVMS/p.listing rm -f $(PDIR)/SVMS/d.subdir1/p.listing rm -f $(PDIR)/SVMS/d.subdir1/d.subsubdir1/p.listing rm -f $(PDIR)/SVMS/d.subdir2/p.listing echo Damage > $(PDIR)/SVMS/p.listing echo Damage > $(PDIR)/SVMS/d.subdir1/p.listing echo Damage > $(PDIR)/SVMS/d.subdir1/d.subsubdir1/p.listing echo Damage > $(PDIR)/SVMS/d.subdir2/p.listing # Do the refresh: $(CD) ; $(SVMS) refresh -v :/... # Verify that the p.listing files are OK: diff $(PDIR)/SVMS/p.listing $(PDIR) diff $(PDIR)/SVMS/d.subdir1/p.listing $(PDIR)/subdir1 diff $(PDIR)/SVMS/d.subdir1/d.subsubdir1/p.listing \ $(PDIR)/subdir1/subsubdir1 diff $(PDIR)/SVMS/d.subdir2/p.listing $(PDIR)/subdir2 $(FRESH) refresh_multiple: # Test multiple subdirectory slices (should fail for now!): $(FRESH) $(SVMS) new -R $(PDIR) $@ mkdir $(PDIR)/subdir1 $(PDIR)/subdir2 $(CD) ; $(SVMS) mkdir subdir1 subdir2 ($(CD); \ if $(SVMS) refresh :/subdir1/... :/subdir2/... ; \ then echo "Command succeeded (incorrect)" ; \ else echo "Command failed (correct)" ; \ fi) $(FRESH) refresh_subdir: # For now, sure that svms refresh of subdirectories fail: $(FRESH) $(SVMS) new -R $(PDIR) $@ mkdir $(PDIR)/subdir $(CD) ; $(SVMS) mkdir subdir ($(CD) ; \ if $(SVMS) refresh :/subdir/... ; \ then echo "Command succeeded (incorrect)" ; \ else echo "Command failed (correct)" ; \ fi) $(FRESH) # slice testing: slice_basic: # Make sure that a basic project relative reference works: $(FRESH) $(SVMS) new -R $(PDIR) $@ mkdir $(PDIR)/subdir $(CD) ; $(SVMS) mkdir subdir echo Hello > $(PDIR)/subdir/hello.txt $(CD)/subdir ; $(SVMS) create :/subdir/hello.txt # Verify that it made the correct one: ls -R $(PDIR) $(FRESH) # `svms tell' command tests: tell_help: # Make sure that `svms help tell' works: $(SVMS) help tell tell_empty: # Make sure that `svms tell' with no arguments works: $(SVMS) tell tell_basic: # Make sure that basic `svms tell' command works: $(FRESH) $(SVMS) new -R $(PDIR) $@ # Create a few files in a couple of directories; leave two files open: echo Hello > $(PDIR)/top.txt $(CD) ; $(SVMS) create top.txt $(CD) ; $(SVMS) open top.txt mkdir $(PDIR)/subdir1 $(PDIR)/subdir2 $(CD) ; $(SVMS) mkdir subdir1 subdir2 echo Hello > $(PDIR)/subdir1/file1.txt $(CD)/subdir1 ; $(SVMS) create file1.txt cat $(PDIR)/SVMS/d.subdir1/p.listing $(CD)/subdir1 ; $(SVMS) open file1.txt cat $(PDIR)/SVMS/d.subdir1/p.listing echo Hello > $(PDIR)/subdir2/file2.txt $(CD)/subdir2 ; $(SVMS) create file2.txt cat $(PDIR)/SVMS/d.subdir1/p.listing # Do a whole bunch of `svms tell' commands: $(CD) ; $(SVMS) tell ... $(CD) ; $(SVMS) tell :/... $(CD) ; $(SVMS) tell subdir1/... $(CD) ; $(SVMS) tell :/subdir1/... $(CD) ; $(SVMS) tell subdir2/... $(CD) ; $(SVMS) tell :/subdir2/... $(CD)/subdir1 ; $(SVMS) tell ... $(CD)/subdir1 ; $(SVMS) tell :/... $(CD)/subdir1 ; $(SVMS) tell :/subdir1/... $(CD)/subdir1 ; $(SVMS) tell :/subdir2/... $(CD)/subdir1 ; $(SVMS) tell ../... $(CD)/subdir1 ; $(SVMS) tell ../subdir1/... $(CD)/subdir1 ; $(SVMS) tell ../subdir2/... $(CD)/subdir2 ; $(SVMS) tell ... $(CD)/subdir2 ; $(SVMS) tell :/... $(CD)/subdir2 ; $(SVMS) tell :/subdir1/... $(CD)/subdir2 ; $(SVMS) tell :/subdir2/... $(CD)/subdir2 ; $(SVMS) tell ../... $(CD)/subdir2 ; $(SVMS) tell ../subdir1/... $(CD)/subdir2 ; $(SVMS) tell ../subdir2/... $(FRESH) # `svms unedit' command tests: unedit_help: # Make sure that `svms help unedit' works: $(SVMS) help unedit unedit_basic: # Make sure that the basic `svms unedit' command works: $(FRESH) $(SVMS) new -R $(PDIR) $@ echo Hello > $(PDIR)/hello.txt $(CD) ; $(SVMS) create hello.txt $(CD) ; $(SVMS) open hello.txt echo Goodbye >> $(PDIR)/hello.txt $(CD) ; $(SVMS) unedit hello.txt # Verify that hello.txt is read-only if [ -w $(PDIR)/hello.txt ] ; \ then echo "File is read-write (incorrect)" ; \ else echo "File is read-only (correct)" ; \ fi # Verify that we got the right contents: cat $(PDIR)/hello.txt # Verify that the listing file says that hello.txt is not open: cat $(PDIR)/SVMS/p.listing $(FRESH) unedit_no_arguments: # Make sure that `svms unedit' with no arguments works: $(SVMS) unedit unedit_no_open: # Make sure that an `svms unedit' command of a non-open file fails: $(FRESH) $(SVMS) new -R $(PDIR) $@ echo Hello > $(PDIR)/hello.txt $(CD) ; $(SVMS) create hello.txt # Remember the state of the files: ls -l $(PDIR)/hello.txt > $(PDIR)/root.ls1 ls -l $(PDIR)/SVMS > $(PDIR)/svms.ls1 cp $(PDIR)/hello.txt $(PDIR)/hello.txt.save cp $(PDIR)/SVMS/h.hello.txt $(PDIR)/h.hello.txt.save cp $(PDIR)/SVMS/p.listing $(PDIR)/p.listing.save # Run the command and verify that it fails: $(CD) ; if $(SVMS) unedit hello.txt ; \ then echo "Command succeeded (incorrect)" ; \ else echo "Command failed (correct)" ; \ fi # Verify that no files changed: ls -l $(PDIR)/hello.txt > $(PDIR)/root.ls2 ls -l $(PDIR)/SVMS > $(PDIR)/svms.ls2 cmp $(PDIR)/root.ls1 $(PDIR)/root.ls2 cmp $(PDIR)/svms.ls1 $(PDIR)/svms.ls2 cmp $(PDIR)/hello.txt $(PDIR)/hello.txt.save cmp $(PDIR)/SVMS/h.hello.txt $(PDIR)/h.hello.txt.save cmp $(PDIR)/SVMS/p.listing $(PDIR)/p.listing.save $(FRESH) source.html: Makefile $(WAIT) ${SOURCE_LIST} @echo -n "Generating $@..." @rm -f $@ @echo '' > $@ @echo '
' >> $@ @echo 'These are the source files for the' >> $@ @echo 'SVMS Test Suite.
' >> $@ @echo 'The following source files are available:
' >> $@ @echo '