⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ptest

📁 早期freebsd实现
💻
字号:
#! /bin/csh -f## Copyright (c) 1983, 1985, 1991 Peter J. Nicklin.# Copyright (c) 1991 Version Technology.# All Rights Reserved.## $License: VT.1.1 $# Redistribution and use in source and binary forms,  with or without# modification,  are permitted provided that the following conditions# are met:  (1) Redistributions of source code must retain the  above# copyright  notice,  this  list  of  conditions  and  the  following# disclaimer.  (2) Redistributions in binary form must reproduce  the# above  copyright notice,  this list of conditions and the following# disclaimer in the  documentation  and/or other  materials  provided# with  the  distribution.  (3) All advertising materials  mentioning# features or  use  of  this  software  must  display  the  following# acknowledgement:  ``This  product  includes  software  developed by# Version Technology.''  Neither the name of Version  Technology  nor# the  name  of  Peter J. Nicklin  may  be used to endorse or promote# products derived from this software without specific prior  written# permission.## THIS SOFTWARE IS PROVIDED BY VERSION TECHNOLOGY ``AS IS''  AND  ANY# EXPRESS OR IMPLIED WARRANTIES,  INCLUDING,  BUT NOT LIMITED TO, THE# IMPLIED  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL  VERSION  TECHNOLOGY  BE# LIABLE  FOR ANY DIRECT,  INDIRECT,  INCIDENTAL, SPECIAL, EXEMPLARY,# OR  CONSEQUENTIAL DAMAGES   (INCLUDING,   BUT   NOT   LIMITED   TO,# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;  LOSS OF USE, DATA, OR# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY# OF  LIABILITY,  WHETHER  IN  CONTRACT,  STRICT LIABILITY,  OR  TORT# (INCLUDING NEGLIGENCE OR OTHERWISE)  ARISING  IN ANY WAY OUT OF THE# USE OF THIS SOFTWARE,  EVEN  IF  ADVISED OF THE POSSIBILITY OF SUCH# DAMAGE.## Report problems and direct questions to nicklin@netcom.com## $Header: ptest.sh,v 4.5 91/11/26 17:01:57 nicklin Exp $## ptest - test a project module## Author: Peter J. Nicklin#set path = ($cwd $path)set template = C.ttop:if ($#argv > 0) then	switch ($argv[1])		case -d:			set debug			shift			breaksw		case -F*:			if ($argv[1] != -F) then				set argv[1] = `echo $argv[1] | sed -e s/-F//`			else if ($#argv < 2) then				set error				breaksw			else				shift			endif			set template = $argv[1]			shift			breaksw		case -P*:			if ($argv[1] != -P) then				set argv[1] = `echo $argv[1] | sed -e s/-P//`			else if ($#argv < 2) then				set error				breaksw			else				shift			endif			pushd . >& /dev/null			eval `chproject -f $argv[1]`			if ($status != 0) exit(1)			popd >& /dev/null			shift			breaksw		case -*:			echo "ptest: bad option $argv[1]"			set error			shift			breaksw		default:			goto next			breaksw		endsw		goto topendifnext:if ($?error) then	echo "ptest: usage: ptest [-d] [-F template] [-P projectname] [module ...]"	exit(1)endifif (!($?PROJECT)) then	echo "ptest: no project environment"	exit(1)endif# does the test case directory exist?if (!(-e $PROJECT/test)) then	echo "ptest: $PROJECT/test: No such file or directory"	exit(1)endif# test all modulesif ($#argv < 1) then	pushd $PROJECT/test >& /dev/null	foreach test (`ls`)		if ($test =~ *.a || -d $test ) set argv = ($argv $test:r)	end	if ($#argv < 1) then		echo "ptest: no test cases available"		exit(1)	endif	popd >& /dev/nullendif# remove compilable test programsforeach file (`ls`)	switch ($file)		case T*.sh:			breaksw		case T*.mkmf:			breaksw		case T*.*:			/bin/rm -f $file			breaksw	endswendforeach test ($argv[*])	# extract test files from archive	if (-e $PROJECT/test/$test.a) then		echo -n "${test}: extracting archive ... "		ar x $PROJECT/test/$test.a	else if (-d $PROJECT/test/$test) then		echo -n "${test}: copying test ... "		cp $PROJECT/test/$test/* .	else		echo "ptest: test case $test not found"		continue	endif	# Compile test program	unset userscript	foreach program (T*.*)		switch ($program)			case T*.sh:				set userscript				breaksw			default:				echo -n "compiling test ... "				if ( -e T$test.mkmf) then					mkmf -cd -fT_makefile -FT$test.mkmf PROGRAM=T$test				else					mkmf -cd -fT_makefile -M$template PROGRAM=T$test				endif				make -f T_makefile -s >& E$test				if ($status != 0) goto badtest				breaksw		endsw	end	# Run test	echo -n "executing test ... "	if ($?userscript) then		# User supplied test script		./T$test.sh >>& E$test		if ($status != 0) goto badtest	else if (-e I$test) then		# Default test script with input		./T$test < I$test |& diff - O$test >>& E$test		if ($status != 0) goto badtest	else		# Default test script without input		./T$test |& diff - O$test >>& E$test		if ($status != 0) goto badtest	endif	if (!($?debug)) /bin/rm -f E$test [TIO]$test* T_makefile	echo done	continuebadtest:	if (!($?debug)) /bin/rm -f [TIO]$test* T_makefile	echo failed	set errorendif ($?error) exit(1)exit(0)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -