Skip to content

Instantly share code, notes, and snippets.

@latticetower
Last active August 5, 2016 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save latticetower/250214fd37fe08e2b8f63c7bbad5be8d to your computer and use it in GitHub Desktop.
Save latticetower/250214fd37fe08e2b8f63c7bbad5be8d to your computer and use it in GitHub Desktop.
#!/bin/sh
# autopkgtest check: build and run pymol scripts from directory and subdirectories
# ignores errors appearing inside PYMOL command line, checks if message
# "PyMOL: normal program termination." present in pymol's output.
# Author: Tatiana Malygina <merlettaia@gmail.com>
set -e
testsdir="$(cd "$1" && pwd)"
echo "work with $testsdir"
pkg=pymol
if [ "$ADTTMP" = "" ] ; then
ADTTMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
trap "rm -rf $ADTTMP" 0 INT QUIT ABRT PIPE TERM
fi
cd $ADTTMP
#cp -a /usr/share/doc/${pkg}/examples/* .
#find . -type f -name "*.gz" -exec gunzip \{\} \;
#for lnk in `find . -type l -name "*.gz"` ; do
# ln -s `basename $(readlink $lnk) .gz` `echo $lnk | sed 's/\.gz$//'`
# rm $lnk
#done
for dir in $(find $testsdir -type d); do
echo "Processing new directory $dir"
#1. symlink all files to current dir
for file in $dir/*; do
if [ -f "$file" ]; then
ln -s $file
fi
done
#echo $(find -L . -type f)
# select .py and .pml and run
for file in $(find -L . -name '*.py' -or -name '*.pml'); do
command=$(pymol -c $file) # | grep 'PyMOL: normal program termination.')
echo $(echo "$command" | grep "PyMOL: normal program termination.")
if [ -z "$(echo "$command" | grep 'PyMOL: normal program termination.')" ]; then
echo -e 'not ok - copy $dir contents and run \"pymol -c $file | grep 'PyMOL: normal program termination.'\"' 1>&2
[ -z "$(echo "$command" | grep "PyMOL: normal program termination.")" ];
else
echo "ok - copy $dir contents and run \"pymol -c $file | grep 'PyMOL: normal program termination.'\""
fi
done
#delete all files and symlinks after folder processing
for file in $(find -P . -type f); do
rm $file
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment