Here's what I've got for the initial version of the package testing
part of things. I'll try to whip up a quick script that will take the
original APTS .mk files and convert them to the format used by this
script (take out line 1 and s/apk_delete/apk_del). Tried to keep it
as simple as possible since it'll need to run quite a bit. Also,
tried to keep the output fairly easy to search through.
Thoughts/feedback?
Jeff
On Wed, Nov 24, 2010 at 4:26 PM, Jeff Bilyk <jbilyk@gmail.com> wrote:
> initial commit with package testing script and 2 package scripts
> ---
> apts2 | 31 +++++++++++++++++++++++++++++++
> packages/lsof | 3 +++
> packages/sed | 4 ++++
> 3 files changed, 38 insertions(+), 0 deletions(-)
> create mode 100755 apts2
> create mode 100644 packages/lsof
> create mode 100644 packages/sed
>
> diff --git a/apts2 b/apts2
> new file mode 100755
> index 0000000..f4fd910
> --- /dev/null
> +++ b/apts2
> @@ -0,0 +1,31 @@
> +#!/bin/sh
> +
> +# Get file to output to
> +ARGUMENTS="$@"
> +OUTFILE="`echo $ARGUMENTS | awk -F ' ' '{print $1}'`"
> +if [ -z "$OUTFILE" ];
> + then echo "Usage: $0 outputfile <package>" && exit 1;
> +fi
> +
> +if [ "$OUTFILE" == "-h" ];
> + then echo "Usage: $0 outputfile <package>" && exit 0;
> +fi
> +
> +if [ "$OUTFILE" == "--help" ];
> + then echo "Usage: $0 outputfile <package>" && exit 0;
> +fi
> +
> +PACKAGE="`echo $ARGUMENTS | awk -F ' ' '{print $2}'`"
> +
> +if [ -z "$PACKAGE" ];
> + then echo "All packages to be tested" && for package in `ls ./packages`;
> + do echo "Testing $package apk" && /bin/sh -e ./packages/$package >> "$OUTFILE" 2>&1 && echo "$package passed tests" >> "$OUTFILE" && echo "$package passed tests";
> +
> + done && exit 0;
> +else test -e ./packages/$PACKAGE && echo "Testing $PACKAGE apk" && /bin/sh -e ./packages/$PACKAGE >> "$OUTFILE" 2>&1 && echo "$PACKAGE passed tests" && exit 0;
> +
> +fi
> +
> +if [ "$?" == "1" ];
> + then echo "Testing file for $PACKAGE does not exist" && exit 1;
> +fi
> \ No newline at end of file
> diff --git a/packages/lsof b/packages/lsof
> new file mode 100644
> index 0000000..3c49a22
> --- /dev/null
> +++ b/packages/lsof
> @@ -0,0 +1,3 @@
> + apk_add $@
> + lsof
> + apk_del $@
> diff --git a/packages/sed b/packages/sed
> new file mode 100644
> index 0000000..0d1b744
> --- /dev/null
> +++ b/packages/sed
> @@ -0,0 +1,4 @@
> + apk_add $@
> + echo "hello" | sed 's/hello/world/g' | grep 'world'
> + apk_del $@
> + [ `readlink /bin/sed` = /bin/busybox ]
> --
> 1.7.3.2
>
>
--
Jeff
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
On Wed, 2010-11-24 at 22:30 -0500, Jeff Bilyk wrote:
> Here's what I've got for the initial version of the package testing
> part of things. I'll try to whip up a quick script that will take the
> original APTS .mk files and convert them to the format used by this
> script (take out line 1 and s/apk_delete/apk_del). Tried to keep it
> as simple as possible since it'll need to run quite a bit. Also,
> tried to keep the output fairly easy to search through.
>
> Thoughts/feedback?
I looked at it. I'm ok with the idea behind, but code itself could have
use of some minor improvements ;)
I think I should set up a git repo for you.
> Jeff
>
> On Wed, Nov 24, 2010 at 4:26 PM, Jeff Bilyk <jbilyk@gmail.com> wrote:
> > initial commit with package testing script and 2 package scripts
> > ---
> > apts2 | 31 +++++++++++++++++++++++++++++++
i think we can just call the main script for 'apts' rather han 'apts2'
> > packages/lsof | 3 +++
> > packages/sed | 4 ++++
maybe call the dir 'tests' instead of 'packages' since it holds the test
scripts?
> > 3 files changed, 38 insertions(+), 0 deletions(-)
> > create mode 100755 apts2
> > create mode 100644 packages/lsof
> > create mode 100644 packages/sed
> >
> > diff --git a/apts2 b/apts2
> > new file mode 100755
> > index 0000000..f4fd910
> > --- /dev/null
> > +++ b/apts2
> > @@ -0,0 +1,31 @@
> > +#!/bin/sh
> > +
> > +# Get file to output to
> > +ARGUMENTS="$@"
> > +OUTFILE="`echo $ARGUMENTS | awk -F ' ' '{print $1}'`"
> > +if [ -z "$OUTFILE" ];
> > + then echo "Usage: $0 outputfile <package>" && exit 1;
> > +fi
There are better wais to parse the opts
program=$0
usage() {
echo "Usage: $program outputfile <package>"
exit 1
}
# parse options
while getopts "h" opt; do
case "$opt" in
h) usage;;
esac
done
# remove options so we have package... in $@
shift $(( $OPTIND - 1 ))
# do wa have any file args?
if [ $# -eq 0 ]; then
echo "no outfile"
fi
i=1
while [ $# -gt 0 ]; do
echo "file number $i: $1"
i=$(( $i + 1 ))
shift
done
> > +
> > +if [ "$OUTFILE" == "-h" ];
> > + then echo "Usage: $0 outputfile <package>" && exit 0;
> > +fi
> > +
> > +if [ "$OUTFILE" == "--help" ];
> > + then echo "Usage: $0 outputfile <package>" && exit 0;
> > +fi
> > +
> > +PACKAGE="`echo $ARGUMENTS | awk -F ' ' '{print $2}'`"
> > +
> > +if [ -z "$PACKAGE" ];
> > + then echo "All packages to be tested" && for package in `ls ./packages`;
> > + do echo "Testing $package apk" && /bin/sh -e ./packages/$package >> "$OUTFILE" 2>&1 && echo "$package passed tests" >> "$OUTFILE" && echo "$package passed tests";
> > +
> > + done && exit 0;
> > +else test -e ./packages/$PACKAGE && echo "Testing $PACKAGE apk" && /bin/sh -e ./packages/$PACKAGE >> "$OUTFILE" 2>&1 && echo "$PACKAGE passed tests" && exit 0;
> > +
> > +fi
> > +
> > +if [ "$?" == "1" ];
> > + then echo "Testing file for $PACKAGE does not exist" && exit 1;
> > +fi
> > \ No newline at end of file
> > diff --git a/packages/lsof b/packages/lsof
> > new file mode 100644
> > index 0000000..3c49a22
> > --- /dev/null
> > +++ b/packages/lsof
> > @@ -0,0 +1,3 @@
> > + apk_add $@
> > + lsof
> > + apk_del $@
> > diff --git a/packages/sed b/packages/sed
> > new file mode 100644
> > index 0000000..0d1b744
> > --- /dev/null
> > +++ b/packages/sed
> > @@ -0,0 +1,4 @@
> > + apk_add $@
> > + echo "hello" | sed 's/hello/world/g' | grep 'world'
> > + apk_del $@
> > + [ `readlink /bin/sed` = /bin/busybox ]
> > --
> > 1.7.3.2
> >
> >
>
>
>
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---