* PATCH: test on Cygwin
@ 2001-05-21 10:30 Peter Stephenson
2001-05-21 14:20 ` Bart Schaefer
2001-05-22 10:21 ` Andrej Borsenkow
0 siblings, 2 replies; 5+ messages in thread
From: Peter Stephenson @ 2001-05-21 10:30 UTC (permalink / raw)
To: Zsh hackers list
This works around a problem with the tests on my version of Cygwin (not the
most recent) where rm -rf hung on a file which didn't have write
permission (i.e. did have the read-only bit set). It was a Samba-mounted
disk.
Andrej, have you seen this and do you know if it's fixed yet?
There are various other failures on my version of Cygwin: part of the
problem is that the test suite doesn't yet handle skipping tests for known
unsupported features.
Index: Test/C02cond.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/C02cond.ztst,v
retrieving revision 1.1
diff -u -r1.1 C02cond.ztst
--- Test/C02cond.ztst 2001/04/02 12:32:27 1.1
+++ Test/C02cond.ztst 2001/05/21 10:25:39
@@ -19,8 +19,6 @@
chmod u+s modish
chmod +t modish
- touch unmodish
- chmod 000 unmodish
%test
[[ -a zerolength && ! -a nonexistent ]]
@@ -70,7 +68,11 @@
[[ -p pipe && ! -p zerolength ]]
0:-p cond
+ touch unmodish
+ chmod 000 unmodish
[[ -r zerolength && ! -r unmodish ]]
+ # This works around a bug in rm -f in some versions of Cygwin
+ chmod 644 unmodish
0:-r cond
[[ -s nonzerolength && ! -s zerolength ]]
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK Tel: +44 (0)1223 392070
**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material.
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by
persons or entities other than the intended recipient is
prohibited.
If you received this in error, please contact the sender and
delete the material from any computer.
**********************************************************************
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH: test on Cygwin
2001-05-21 10:30 PATCH: test on Cygwin Peter Stephenson
@ 2001-05-21 14:20 ` Bart Schaefer
2001-05-21 15:37 ` Peter Stephenson
2001-05-22 10:21 ` Andrej Borsenkow
1 sibling, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2001-05-21 14:20 UTC (permalink / raw)
To: Peter Stephenson, Zsh hackers list
On May 21, 11:30am, Peter Stephenson wrote:
} Subject: PATCH: test on Cygwin
}
} + touch unmodish
} + chmod 000 unmodish
} [[ -r zerolength && ! -r unmodish ]]
} + # This works around a bug in rm -f in some versions of Cygwin
} + chmod 644 unmodish
} 0:-r cond
That can't be right. The test condition (`0:') depends on the test
case itself (`[[ -r ... ]]') being the last thing executed.
This is what the %clean section is for, no?
I won't yet commit the following in case I'm missing something really
obvious ...
--- zsh-forge/current/Test/C02cond.ztst Mon May 21 07:13:53 2001
+++ zsh-4.0/Test/C02cond.ztst Mon May 21 07:18:19 2001
@@ -19,6 +19,8 @@
chmod u+s modish
chmod +t modish
+ touch unmodish
+ chmod 000 unmodish
%test
[[ -a zerolength && ! -a nonexistent ]]
@@ -68,11 +70,7 @@
[[ -p pipe && ! -p zerolength ]]
0:-p cond
- touch unmodish
- chmod 000 unmodish
[[ -r zerolength && ! -r unmodish ]]
- # This works around a bug in rm -f in some versions of Cygwin
- chmod 644 unmodish
0:-r cond
[[ -s nonzerolength && ! -s zerolength ]]
@@ -151,3 +149,7 @@
[ `echo 0` -lt `echo 1` ]
0:substituion in `[' builtin
+
+%clean
+ # This works around a bug in rm -f in some versions of Cygwin
+ chmod 644 unmodish
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH: test on Cygwin
2001-05-21 14:20 ` Bart Schaefer
@ 2001-05-21 15:37 ` Peter Stephenson
0 siblings, 0 replies; 5+ messages in thread
From: Peter Stephenson @ 2001-05-21 15:37 UTC (permalink / raw)
To: Zsh hackers list
Bart wrote;
> On May 21, 11:30am, Peter Stephenson wrote:
> } Subject: PATCH: test on Cygwin
> }
> } + touch unmodish
> } + chmod 000 unmodish
> } [[ -r zerolength && ! -r unmodish ]]
> } + # This works around a bug in rm -f in some versions of Cygwin
> } + chmod 644 unmodish
> } 0:-r cond
>
> That can't be right. The test condition (`0:') depends on the test
> case itself (`[[ -r ... ]]') being the last thing executed.
Oh.
> This is what the %clean section is for, no?
Unfortunately that doesn't get executed if a test failed. That's because a
test failure is currently catastrophic: ztst.zsh performs it's own cleanup
and exits straight away. The following makes failures less catastrophic;
the Cygwin problem goes away with this and that other patch.
I tested that the remaining behaviour with test failures is as before.
It's still the case that one test failing will cause the sequence of tests
in one file to be aborted. That should now be fairly easy to alter.
Note the fact that running the function ZTST_test before a `||' would
affect the behaviour of TRAPZERR deep within a test --- it wouldn't trigger
because it wouldn't be the last element of a condition. I think this is
probably right, but I'm not sure --- and if not, I have no idea where to
draw the line.
Index: Test/ztst.zsh
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/ztst.zsh,v
retrieving revision 1.14
diff -u -r1.14 ztst.zsh
--- Test/ztst.zsh 2001/05/20 18:10:56 1.14
+++ Test/ztst.zsh 2001/05/21 15:30:51
@@ -53,6 +53,8 @@
ZTST_testdir=$PWD
ZTST_testname=$1
+integer ZTST_testfailed
+
# The source directory is not necessarily the current directory,
# but if $0 doesn't contain a `/' assume it is.
if [[ $0 = */* ]]; then
@@ -99,8 +101,8 @@
print -r "Was testing: $ZTST_message"
fi
print -r "$ZTST_testname: test failed."
- ZTST_cleanup
- exit 1
+ ZTST_testfailed=1
+ return 1
}
# Print messages if $ZTST_verbose is non-empty
@@ -114,7 +116,10 @@
(( SECONDS > COLUMNS+1 && (SECONDS -= COLUMNS) ))
}
-[[ ! -r $ZTST_testname ]] && ZTST_testfailed "can't read test file."
+if [[ ! -r $ZTST_testname ]]; then
+ ZTST_testfailed "can't read test file."
+ exit 1
+fi
exec 8>&1
exec 9<$ZTST_testname
@@ -136,15 +141,18 @@
# Get the name of the section. It may already have been read into
# $curline, or we may have to skip some initial comments to find it.
+# If argument present, it's OK to skip the reset of the current section,
+# so no error if we find garbage.
ZTST_getsect() {
local match mbegin mend
while [[ $ZTST_curline != '%'(#b)([[:alnum:]]##)* ]]; do
ZTST_getline || return 1
[[ $ZTST_curline = [[:blank:]]# ]] && continue
- if [[ $ZTST_curline != '%'[[:alnum:]]##* ]]; then
+ if [[ $# -eq 0 && $ZTST_curline != '%'[[:alnum:]]##* ]]; then
ZTST_testfailed "bad line found before or after section:
$ZTST_curline"
+ exit 1
fi
done
# have the next line ready waiting
@@ -194,6 +202,7 @@
'?') fn=$ZTST_err
;;
*) ZTST_testfailed "bad redir operator: $char"
+ return 1
;;
esac
if [[ $ZTST_flags = *q* ]]; then
@@ -201,6 +210,8 @@
else
print -r -- "$ZTST_redir" >>$fn
fi
+
+return 0
}
# Execute an indented chunk. Redirections will already have
@@ -278,21 +289,23 @@
else
ZTST_testfailed "expecting test status at:
$ZTST_curline"
+ return 1
fi
ZTST_getline
found=1
;;
- '<'*) ZTST_getredir
+ '<'*) ZTST_getredir || return 1
found=1
;;
- '>'*) ZTST_getredir
+ '>'*) ZTST_getredir || return 1
found=1
;;
- '?'*) ZTST_getredir
+ '?'*) ZTST_getredir || return 1
found=1
;;
*) ZTST_testfailed "bad line in test block:
$ZTST_curline"
+ return 1
;;
esac
done
@@ -311,6 +324,7 @@
$ZTST_code${$(<$ZTST_terr):+
Error output:
$(<$ZTST_terr)}"
+ return 1
fi
ZTST_verbose 2 "ZTST_test: test produced standard output:
@@ -324,6 +338,7 @@
$ZTST_code${$(<$ZTST_terr):+
Error output:
$(<$ZTST_terr)}"
+ return 1
fi
if [[ $ZTST_flags != *D* ]] && ! ZTST_diff -c $ZTST_err $ZTST_terr; then
ZTST_testfailed "error output differs from expected as shown above for:
@@ -348,11 +363,13 @@
print "$ZTST_testname: starting."
# Now go through all the different sections until the end.
-while ZTST_getsect; do
+ZTST_skipok=
+while ZTST_getsect $ZTST_skipok; do
case $ZTST_cursect in
prep) if (( ${ZTST_sects[prep]} + ${ZTST_sects[test]} + \
${ZTST_sects[clean]} )); then
ZTST_testfailed "\`prep' section must come first"
+ exit 1
fi
ZTST_prepclean
ZTST_sects[prep]=1
@@ -360,22 +377,28 @@
test)
if (( ${ZTST_sects[test]} + ${ZTST_sects[clean]} )); then
ZTST_testfailed "bad placement of \`test' section"
+ exit 1
fi
+ # careful here: we can't execute ZTST_test before || or &&
+ # because that affects the behaviour of traps in the tests.
ZTST_test
+ (( $? )) && ZTST_skipok=1
ZTST_sects[test]=1
;;
clean)
if (( ${ZTST_sects[test]} == 0 || ${ZTST_sects[clean]} )); then
ZTST_testfailed "bad use of \`clean' section"
+ else
+ ZTST_prepclean 1
+ ZTST_sects[clean]=1
fi
- ZTST_prepclean 1
- ZTST_sects[clean]=1
+ ZTST_skipok=
;;
*) ZTST_testfailed "bad section name: $ZTST_cursect"
;;
esac
done
-print "$ZTST_testname: all tests successful."
+(( $ZTST_testfailed )) || print "$ZTST_testname: all tests successful."
ZTST_cleanup
-exit 0
+exit $(( ZTST_testfailed ))
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK Tel: +44 (0)1223 392070
**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material.
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by
persons or entities other than the intended recipient is
prohibited.
If you received this in error, please contact the sender and
delete the material from any computer.
**********************************************************************
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: PATCH: test on Cygwin
2001-05-21 10:30 PATCH: test on Cygwin Peter Stephenson
2001-05-21 14:20 ` Bart Schaefer
@ 2001-05-22 10:21 ` Andrej Borsenkow
2001-05-22 10:31 ` Andrej Borsenkow
1 sibling, 1 reply; 5+ messages in thread
From: Andrej Borsenkow @ 2001-05-22 10:21 UTC (permalink / raw)
To: Zsh hackers list
>
> This works around a problem with the tests on my version of
> Cygwin (not the
> most recent) where rm -rf hung on a file which didn't have write
> permission (i.e. did have the read-only bit set). It was a Samba-mounted
> disk.
>
> Andrej, have you seen this and do you know if it's fixed yet?
>
delete readonly (S)
This parameter allows readonly files to be deleted. This is not
normal DOS semantics, but is allowed by UNIX.
This option may be useful for running applications such as rcs,
where UNIX file ownership prevents changing file permissions, and
DOS semantics prevent deletion of a read only file.
Default: delete readonly = no
In general it is very bad idea to run tests on mounted directory even if it
is mounted off NT server. SAMBA complicates things even more.
-andrej
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: PATCH: test on Cygwin
2001-05-22 10:21 ` Andrej Borsenkow
@ 2001-05-22 10:31 ` Andrej Borsenkow
0 siblings, 0 replies; 5+ messages in thread
From: Andrej Borsenkow @ 2001-05-22 10:31 UTC (permalink / raw)
To: Andrej Borsenkow, Zsh hackers list
> >
> > This works around a problem with the tests on my version of
> > Cygwin (not the
> > most recent) where rm -rf hung on a file which didn't have write
> > permission (i.e. did have the read-only bit set). It was a
> Samba-mounted
> > disk.
> >
Erm ... I did not pay attention to "hung". Yes, it does hang here when
directory contains read-only file on SAMBA drive with almost recent cygwin.
-andrej
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2001-05-22 10:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-21 10:30 PATCH: test on Cygwin Peter Stephenson
2001-05-21 14:20 ` Bart Schaefer
2001-05-21 15:37 ` Peter Stephenson
2001-05-22 10:21 ` Andrej Borsenkow
2001-05-22 10:31 ` Andrej Borsenkow
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).