~alpine/devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 2

[alpine-devel] APTS

Jeff Bilyk <jbilyk@gmail.com>
Details
Message ID
<AANLkTinecUoOkaUERsMuQxemh50V+rghw78t9f6CErmG@mail.gmail.com>
Sender timestamp
1293072631
DKIM signature
missing
Download raw message
Evening all,

Sorry for the non-git send-email'd way of sending this APKBUILD, but
it looks like perl-net-smtp-ssl decided that this would be a good time
to die on my edge build box...
http://git.alpinelinux.org/cgit/apts/plain/APKBUILD?id=0efa0aa0192581c2f6221022c070b48a015d94bd

If this could get added to the testing repo, it'd be great.  Thanks!
-- 
Jeff


---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Natanael Copa <ncopa@alpinelinux.org>
Details
Message ID
<1293097775.31649.0.camel@ncopa-desktop.nor.wtbts.net>
In-Reply-To
<AANLkTinecUoOkaUERsMuQxemh50V+rghw78t9f6CErmG@mail.gmail.com> (view parent)
Sender timestamp
1293097775
DKIM signature
missing
Download raw message
On Wed, 2010-12-22 at 21:50 -0500, Jeff Bilyk wrote:
> Evening all,
> 
> Sorry for the non-git send-email'd way of sending this APKBUILD, but
> it looks like perl-net-smtp-ssl decided that this would be a good time
> to die on my edge build box...
> http://git.alpinelinux.org/cgit/apts/plain/APKBUILD?id=0efa0aa0192581c2f6221022c070b48a015d94bd
> 
> If this could get added to the testing repo, it'd be great.  Thanks!


added. Thanks!

I will try have a look at the apts after I have relocated git.a.o.

-nc



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---

[alpine-devel] [PATCH] misc improvements for apts

Natanael Copa <ncopa@alpinelinux.org>
Details
Message ID
<1293551811-32485-1-git-send-email-ncopa@alpinelinux.org>
In-Reply-To
<AANLkTinecUoOkaUERsMuQxemh50V+rghw78t9f6CErmG@mail.gmail.com> (view parent)
Sender timestamp
1293551811
DKIM signature
missing
Download raw message
Patch: +63 -91
- allow run aots directly from git dir
- do not require the OUTFILE param, instead only out to stdout
- by default, run all tests even if any fails
- allow halt on first error with -e option
- send output from test to $tst.out
- allow specify outdir for *.out files with -o DIR
- no special logic for generic-apk
- strip .out from given test name so you can easily re-run all failed
  tests with: 'apts *.out'
---
 apts      |  152 +++++++++++++++++++++++++------------------------------------
 apts.conf |    2 +-
 2 files changed, 63 insertions(+), 91 deletions(-)

diff --git a/apts b/apts
index eb8128d..8cb4ccb 100755
--- a/apts
+++ b/apts
@@ -10,112 +10,84 @@
program=$0

usage() {
	echo "Usage: $program outputfile <package>"
	echo "Usage: $program [-he] [-o OUTDIR] [TEST...]"
	exit 1
}

# dont not halt on fail by default
halt_on_fail=

# default outdir is current working dir
outdir="$PWD"

# default TESTDIR to $PWD/tests so we can run it directly from git dir
# allow override with APTS_DIR env var
if [ -d .git ] && [ -d tests ]; then
	TESTSDIR=${APTS_DIR:-"$PWD/tests"}
else
	# default to /usr/share/apts/tests
	TESTSDIR=${APTS_DIR:-"/usr/share/apts/tests"}
	# allow use to override
	if [ -r /etc/apts/apts.conf ]; then
		. /etc/apts/apts.conf
	fi
fi

# parse opts
while getopts "h" opt; do
while getopts "d:eho:" opt; do
	case "$opt" in
	d) TESTSDIR="$OPTARG";;
	e) halt_on_fail=yes;;
	h) usage;;
	help) usage;;
	o) outdir=$OPTARG;;
	esac
done

OUTFILE=$1
#remove opts so that package(s) is $@
shift $(( $OPTIND - 1 ))

# CD to test file dir. will print error message if needed so we dont bother
cd "$TESTSDIR" || exit 1

# are there any file arguments
# if there aren't any args then test all packages
if [ $# -eq 0 ]; then
	echo "no outfile specified"
	usage
	set -- *
fi

#remove opts so that package is $@
shift $(( $OPTIND - 1 ))

# shift once more
shift
totaltests=$#

# Get directory with test files
. /etc/apts/apts.conf
# Initialize counter
i=0

# Check that TESTSDIR exists before proceeding
test -e $TESTSDIR
if [ $? -gt 0 ]; then
	echo "Test file directory $TESTSDIR doesn't exit" && exit 1;
fi
echo "${totaltests} tests to be run"
passedtests="0"
failed=
for tst in "$@"; do
	# Increment counter for tested packages
	i=$((i + 1))
	outfile="$outdir"/$tst.out
	echo -n "Testing ${tst%.out} (${i}/${totaltests})..."
	if /bin/sh -e $tst $tst > "$outfile" 2>&1; then
		# test passed
		echo " ok"
		rm "$outfile"
		passedtests=$((passedtests + 1))
	else
		# test failed
		echo " failed"
		failed="$failed $tst"
		[ -n "$halt_on_fail" ] && break
	fi
done

# CD to test file dir
cd $TESTSDIR
echo ""
echo "$passedtests of $totaltests passed"

# if there aren't any args besides outfile test all packages
if [ $# -eq 0 ]; then
        
	# Initialize counter
	i=1

	# Get total number of packages for status counters
	totaltests=`ls ./tests/ | wc -w`
	echo "All (${totaltests}) packages to be tested"
	passedtests="0"
	for package in `ls ./tests/`; do
                echo "Testing $package apk (${i}/${totaltests})"
		
		# Increment counter for tested packages
		i=$((i + 1))
		/bin/sh -e ./tests/$package $package >> "$OUTFILE" 2>&1

		# If exit code is non-zero, exit apts
		if [ $? -gt 0 ]; then
			echo "$package failed tests" && exit 1;
		fi

		# Log to both outfile and stdout
		echo "$package passed tests" >> "$OUTFILE"
		echo "$package passed tests"
		passedtests=$((passedtests + 1))
        done
	echo "$passedtests of $totaltests passed"
	exit 0;
if [ -n "$failed" ]; then
	echo "The following packages failed:"
	echo $failed
fi

# If script still running, there's args, so test all specified packages
i=1

# Loop through all packages specified
while [ $# -gt 0 ]; do
	echo "Package $i: $1"
	PACKAGE=$1
	
	# does testing file exist
	test -e ./tests/$PACKAGE

	# If no testing file exists then run generic-apk
	if [ "$?" == "1" ]; then
		echo "Testing file for $PACKAGE does not exist"
		/bin/sh -e ./tests/generic-apk $PACKAGE >> "$OUTFILE" 2>&1
		
		# If  exit code is non-zero, exit apts
		if [ $? -gt 0 ]; then
			echo "$PACKAGE failed tests" && exit 1;
		fi
		# if script is running, package passed tests
		echo "$PACKAGE passed tests"

	# if testing file exists, then keep running
	else 
		echo "Testing $PACKAGE apk"
		/bin/sh -e ./tests/$PACKAGE $PACKAGE >> "$OUTFILE" 2>&1

		# If  exit code is non-zero, exit apts
		if [ $? -gt 0 ]; then
			echo "$PACKAGE failed tests" && exit 1;
		fi

		echo "$PACKAGE passed tests"
	fi
	
	# Increment counter and shift to next arg
	i=$((i + 1))
	shift
done
# return success if all tests passed
exit $(( $totaltests - $passedtests))

diff --git a/apts.conf b/apts.conf
index 4caf878..85ce08d 100644
--- a/apts.conf
+++ b/apts.conf
@@ -1 +1 @@
TESTSDIR=/usr/share/apts/
TESTSDIR=/usr/share/apts/tests
-- 
1.7.3.4



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---

Re: [alpine-devel] [PATCH] misc improvements for apts

Jeff Bilyk <jbilyk@gmail.com>
Details
Message ID
<AANLkTi=NDRfb9+-w5AuAwHiTBa=a4zYaSVQNNnr3S5fp@mail.gmail.com>
In-Reply-To
<1293551811-32485-1-git-send-email-ncopa@alpinelinux.org> (view parent)
Sender timestamp
1293795522
DKIM signature
missing
Download raw message
Applied.

On Tue, Dec 28, 2010 at 10:56 AM, Natanael Copa <ncopa@alpinelinux.org> wrote:
> - allow run aots directly from git dir
> - do not require the OUTFILE param, instead only out to stdout
> - by default, run all tests even if any fails
> - allow halt on first error with -e option
> - send output from test to $tst.out
> - allow specify outdir for *.out files with -o DIR
> - no special logic for generic-apk
> - strip .out from given test name so you can easily re-run all failed
>  tests with: 'apts *.out'
> ---
>  apts      |  152 +++++++++++++++++++++++++------------------------------------
>  apts.conf |    2 +-
>  2 files changed, 63 insertions(+), 91 deletions(-)
>
> diff --git a/apts b/apts
> index eb8128d..8cb4ccb 100755
> --- a/apts
> +++ b/apts
> @@ -10,112 +10,84 @@
>  program=$0
>
>  usage() {
> -       echo "Usage: $program outputfile <package>"
> +       echo "Usage: $program [-he] [-o OUTDIR] [TEST...]"
>        exit 1
>  }
>
> +# dont not halt on fail by default
> +halt_on_fail=
> +
> +# default outdir is current working dir
> +outdir="$PWD"
> +
> +# default TESTDIR to $PWD/tests so we can run it directly from git dir
> +# allow override with APTS_DIR env var
> +if [ -d .git ] && [ -d tests ]; then
> +       TESTSDIR=${APTS_DIR:-"$PWD/tests"}
> +else
> +       # default to /usr/share/apts/tests
> +       TESTSDIR=${APTS_DIR:-"/usr/share/apts/tests"}
> +       # allow use to override
> +       if [ -r /etc/apts/apts.conf ]; then
> +               . /etc/apts/apts.conf
> +       fi
> +fi
> +
>  # parse opts
> -while getopts "h" opt; do
> +while getopts "d:eho:" opt; do
>        case "$opt" in
> +       d) TESTSDIR="$OPTARG";;
> +       e) halt_on_fail=yes;;
>        h) usage;;
> -       help) usage;;
> +       o) outdir=$OPTARG;;
>        esac
>  done
>
> -OUTFILE=$1
> +#remove opts so that package(s) is $@
> +shift $(( $OPTIND - 1 ))
> +
> +# CD to test file dir. will print error message if needed so we dont bother
> +cd "$TESTSDIR" || exit 1
>
> -# are there any file arguments
> +# if there aren't any args then test all packages
>  if [ $# -eq 0 ]; then
> -       echo "no outfile specified"
> -       usage
> +       set -- *
>  fi
>
> -#remove opts so that package is $@
> -shift $(( $OPTIND - 1 ))
> -
> -# shift once more
> -shift
> +totaltests=$#
>
> -# Get directory with test files
> -. /etc/apts/apts.conf
> +# Initialize counter
> +i=0
>
> -# Check that TESTSDIR exists before proceeding
> -test -e $TESTSDIR
> -if [ $? -gt 0 ]; then
> -       echo "Test file directory $TESTSDIR doesn't exit" && exit 1;
> -fi
> +echo "${totaltests} tests to be run"
> +passedtests="0"
> +failed=
> +for tst in "$@"; do
> +       # Increment counter for tested packages
> +       i=$((i + 1))
> +       outfile="$outdir"/$tst.out
> +       echo -n "Testing ${tst%.out} (${i}/${totaltests})..."
> +       if /bin/sh -e $tst $tst > "$outfile" 2>&1; then
> +               # test passed
> +               echo " ok"
> +               rm "$outfile"
> +               passedtests=$((passedtests + 1))
> +       else
> +               # test failed
> +               echo " failed"
> +               failed="$failed $tst"
> +               [ -n "$halt_on_fail" ] && break
> +       fi
> +done
>
> -# CD to test file dir
> -cd $TESTSDIR
> +echo ""
> +echo "$passedtests of $totaltests passed"
>
> -# if there aren't any args besides outfile test all packages
> -if [ $# -eq 0 ]; then
> -
> -       # Initialize counter
> -       i=1
> -
> -       # Get total number of packages for status counters
> -       totaltests=`ls ./tests/ | wc -w`
> -       echo "All (${totaltests}) packages to be tested"
> -       passedtests="0"
> -       for package in `ls ./tests/`; do
> -                echo "Testing $package apk (${i}/${totaltests})"
> -
> -               # Increment counter for tested packages
> -               i=$((i + 1))
> -               /bin/sh -e ./tests/$package $package >> "$OUTFILE" 2>&1
> -
> -               # If exit code is non-zero, exit apts
> -               if [ $? -gt 0 ]; then
> -                       echo "$package failed tests" && exit 1;
> -               fi
> -
> -               # Log to both outfile and stdout
> -               echo "$package passed tests" >> "$OUTFILE"
> -               echo "$package passed tests"
> -               passedtests=$((passedtests + 1))
> -        done
> -       echo "$passedtests of $totaltests passed"
> -       exit 0;
> +if [ -n "$failed" ]; then
> +       echo "The following packages failed:"
> +       echo $failed
>  fi
>
> -# If script still running, there's args, so test all specified packages
> -i=1
> -
> -# Loop through all packages specified
> -while [ $# -gt 0 ]; do
> -       echo "Package $i: $1"
> -       PACKAGE=$1
> -
> -       # does testing file exist
> -       test -e ./tests/$PACKAGE
> -
> -       # If no testing file exists then run generic-apk
> -       if [ "$?" == "1" ]; then
> -               echo "Testing file for $PACKAGE does not exist"
> -               /bin/sh -e ./tests/generic-apk $PACKAGE >> "$OUTFILE" 2>&1
> -
> -               # If  exit code is non-zero, exit apts
> -               if [ $? -gt 0 ]; then
> -                       echo "$PACKAGE failed tests" && exit 1;
> -               fi
> -               # if script is running, package passed tests
> -               echo "$PACKAGE passed tests"
> -
> -       # if testing file exists, then keep running
> -       else
> -               echo "Testing $PACKAGE apk"
> -               /bin/sh -e ./tests/$PACKAGE $PACKAGE >> "$OUTFILE" 2>&1
> -
> -               # If  exit code is non-zero, exit apts
> -               if [ $? -gt 0 ]; then
> -                       echo "$PACKAGE failed tests" && exit 1;
> -               fi
> -
> -               echo "$PACKAGE passed tests"
> -       fi
> -
> -       # Increment counter and shift to next arg
> -       i=$((i + 1))
> -       shift
> -done
> +# return success if all tests passed
> +exit $(( $totaltests - $passedtests))
> +
> diff --git a/apts.conf b/apts.conf
> index 4caf878..85ce08d 100644
> --- a/apts.conf
> +++ b/apts.conf
> @@ -1 +1 @@
> -TESTSDIR=/usr/share/apts/
> +TESTSDIR=/usr/share/apts/tests
> --
> 1.7.3.4
>
>
>
> ---
> Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
> Help:         alpine-devel+help@lists.alpinelinux.org
> ---
>
>



-- 
Jeff


---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)