Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Use test script specific run directories



On 30 Sep, Philippe Altherr wrote:
> This patch is a prerequisite for running tests in parallel. It modifies
> ztst.zsh to run each test script in a dedicated directory. For each script path
> /X01script.zest, it creates the directory path/rundirs.tmp/X01script, cds into
> it, and runs the script from there. The command "make check", which runs all
> test scripts in Test/, creates the directory Test/rundirs.tmp/, and inside it
> one directory for each test script. The command doesn't delete the directories,
> such that they can be reused by the next run. The command "make clean" deletes
> them.

With this, the tests fail to run from a VPATH build. From any autoconf project,
you're supposed to be able to do something like:

  mkdir build
  cd build
  ../configure ....
  gmake

Note that this often does need GNU make. It can be a useful feature
as multiple builds can share a single source checkout or you can put a
build on a local scratch disc while the source stays on NFS. I now get
lots of errors along the lines of:

  ../../Test/ztst.zsh:69: failed to load module `zsh/parameter':

We've also gained new tests since you produced this patch. Adjusting X07
is trivial but I'm less sure of how X06 is to be fixed.

I also get an error message at the end of X02. With the
initial part of the path cut out, the message is:
  rm: /...../Test/rundirs.tmp/X02zlevi/zsh.ztst.83406: Directory not empty
That only occurs on some file systems.

It does produce rather a lot of extra directories. Are there really so
many clashes on temporary files affecting parallel runs. Would renaming
a few or getting them to have generated unique names perhaps do the job
instead?

>    # Count the number of directories on the stack.  Don't care what they are.
> -  dircount() { dirs -v | tail -1 | awk '{ print $1 + 1}'; }
> +  dircount() { local dirs=("${(@f)$(dirs -v)}"); echo $(( ${dirs[-1]%$'\t'*} + 1 )) }

I find myself wondering why, in the thread leading up to 20698, nobody
considered whether tail could be replaced. If the zsh/parameter module
is available, this is just echo $(( $#dirstack + 1 ))
If dirs -v is needed the newer ${ dirs -v } would avoid the fork and it
could perhaps just count lines instead of using the number.

> - PS1= $ZTST_testdir/../Src/zsh -fis <<<'
> -   [[ -d Modules/zsh ]] && module_path=( $PWD/Modules )
> + PS1= $ZTST_zsh -fis <<<'
> +   module_path=('"${(q)module_path}"')

I'm not sure about that use of "${(q)module_path}" there. I'm not quite
sure what sort of values in $module_path we need to expect here. Perhaps
${(@qqq)module_path} without the double quotes. Or can we save the
initial $PWD.

> +# Set the root to correspond to this build of zsh.
> +ZTST_root=$0:a:h:h

There's a new $ZSH_EXEPATH that may be a more reliable alternative to
$0. But it may be better to pass the location through from the
Makefile. This replaces $ZTST_testdir which was initialised from $PWD.
Can't we just take $PWD from before the first cd.

Oliver




Messages sorted by: Reverse Date, Date, Thread, Author