setup a bit of a test framework
This commit is contained in:
		| @@ -43,6 +43,7 @@ realinstall: ${BIN} ${CONF} ${CONF_APPEND} | ||||
| install: all realinstall ${INSTALLAFTER} | ||||
|  | ||||
| check test:: | ||||
| 	@if test -e runtests.sh ; then ./runtests.sh || exit $$? ; fi | ||||
|  | ||||
| # A lot of scripts don't have anything to clean | ||||
| # Also, some rm implentation require a file argument regardless of error | ||||
|   | ||||
| @@ -18,3 +18,6 @@ _installafter: | ||||
| 	@# Put functions.sh into the init.d dir so 3rd party apps don't have to | ||||
| 	@# be multilib aware | ||||
| 	ln -snf ${PREFIX}/${RC_LIB}/sh/functions.sh ${DESTDIR}/${PREFIX}/${INITDIR} || exit $$? | ||||
|  | ||||
| check test:: | ||||
| 	./runtests.sh | ||||
|   | ||||
							
								
								
									
										25
									
								
								sh/runtests.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										25
									
								
								sh/runtests.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| top_srcdir=${top_srcdir:-..} | ||||
| . ${top_srcdir}/test/setup_env.sh | ||||
|  | ||||
| ret=0 | ||||
|  | ||||
| tret=0 | ||||
| ebegin "Testing yesno()" | ||||
| for f in yes YES Yes true TRUE True 1 ; do | ||||
| 	if ! yesno ${f} ; then | ||||
| 		((tret+=1)) | ||||
| 		echo "!${f}!" | ||||
| 	fi | ||||
| done | ||||
| for f in no NO No false FALSE False 0 ; do | ||||
| 	if yesno ${f} ; then | ||||
| 		((tret+=1)) | ||||
| 		echo "!${f}!" | ||||
| 	fi | ||||
| done | ||||
| eend ${tret} | ||||
| ((ret+=tret)) | ||||
|  | ||||
| exit ${ret} | ||||
| @@ -3,7 +3,7 @@ all: | ||||
| install: | ||||
|  | ||||
| check test:: | ||||
| 	./symbols.sh | ||||
| 	./runtests.sh | ||||
|  | ||||
| clean: | ||||
| 	rm -f *.out | ||||
|   | ||||
| @@ -1,11 +1,7 @@ | ||||
| #!/bin/sh | ||||
| 
 | ||||
| top_srcdir=${top_srcdir:-../..} | ||||
| srcdir=${builddir:-.} | ||||
| top_builddir=${top_srcdir:-../..} | ||||
| builddir=${builddir:-.} | ||||
| 
 | ||||
| . ${top_srcdir}/sh/functions.sh | ||||
| . ${top_srcdir}/test/setup_env.sh | ||||
| 
 | ||||
| libeinfo_srcdir="${srcdir}/../libeinfo" | ||||
| libeinfo_builddir="${builddir}/../libeinfo" | ||||
| @@ -14,11 +10,6 @@ librc_builddir="${builddir}/../librc" | ||||
| rc_srcdir="${srcdir}/../rc" | ||||
| rc_builddir="${builddir}/../rc" | ||||
| 
 | ||||
| make -s -C ${rc_builddir} links | ||||
| 
 | ||||
| export LD_LIBRARY_PATH=${libeinfo_builddir}:${librc_builddir}:${LD_LIBRARY_PATH} | ||||
| export PATH=${rc_builddir}:${PATH} | ||||
| 
 | ||||
| checkit() { | ||||
| 	local base=$1; shift | ||||
| 	echo "$@" | tr ' ' '\n' > ${base}.out | ||||
							
								
								
									
										22
									
								
								test/setup_env.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										22
									
								
								test/setup_env.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| if [ -z "${top_srcdir}" ] ; then | ||||
| 	echo "You must set top_srcdir before sourcing this file" 1>&2 | ||||
| 	exit 1 | ||||
| fi | ||||
|  | ||||
| srcdir=${srcdir:-.} | ||||
| top_builddir=${top_builddir:-${top_srcdir}} | ||||
| builddir=${builddir:-${srcdir}} | ||||
|  | ||||
| export LD_LIBRARY_PATH=${top_builddir}/src/libeinfo:${top_builddir}/src/librc:${LD_LIBRARY_PATH} | ||||
| export PATH=${top_builddir}/src/rc:${PATH} | ||||
|  | ||||
| ${MAKE:-make} -s -C ${top_srcdir}/src/rc links | ||||
|  | ||||
| . ${top_srcdir}/sh/functions.sh | ||||
|  | ||||
| if [ $? -ne 0 ] ; then | ||||
| 	echo "Sourcing functions.sh failed !?" 1>&2 | ||||
| 	exit 1 | ||||
| fi | ||||
							
								
								
									
										5
									
								
								test/skel.runtests.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										5
									
								
								test/skel.runtests.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,5 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| # top_srcdir=${top_srcdir:-SET/THIS/PATH/OK!?} | ||||
| . ${top_srcdir}/test/setup_env.sh | ||||
|  | ||||
		Reference in New Issue
	
	Block a user