mirror of
				git://git.code.sf.net/p/cdesktopenv/code
				synced 2025-03-09 15:50:02 +00:00 
			
		
		
		
	shtests: make aliases work again for shcomp tests (re: aed5c6d7)
				
					
				
			Moving the 'err_exit' and 'warning' alias definitions in the regression tests to one _common file introduced a bug: they are no longer expanded at compile time when the tests are run with shcomp, resulting in a 'command not found' (at best) on trying to execute one. shcomp requires that the alias definitions need to be present in the file itself. But that means maintaining 50-odd copies again. I'd rather add a hack to shtests to avoid this. src/cmd/ksh93/tests/shtests: - Before running a test with shcomp, physically concatenate _common and the test script together into a temporary file, minus the '.' command that includes _common, and compile that with shcomp.
This commit is contained in:
		
							parent
							
								
									88d7a62b4d
								
							
						
					
					
						commit
						bd38c8049d
					
				
					 1 changed files with 7 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -8,7 +8,7 @@ valgrindflags='--xml=yes --log-file=/dev/null --track-origins=yes --read-var-inf
 | 
			
		|||
 | 
			
		||||
USAGE=$'
 | 
			
		||||
[-s8?
 | 
			
		||||
@(#)$Id: shtests (ksh 93u+m) 2021-03-06 $
 | 
			
		||||
@(#)$Id: shtests (ksh 93u+m) 2021-03-23 $
 | 
			
		||||
]
 | 
			
		||||
[-author?David Korn <dgk@research.att.com>]
 | 
			
		||||
[-author?Glenn Fowler <gsf@research.att.com>]
 | 
			
		||||
| 
						 | 
				
			
			@ -405,8 +405,13 @@ do	[[ $i == *.sh ]] || i+='.sh'
 | 
			
		|||
		echo test $o begins ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"}
 | 
			
		||||
		tmp_s=$tmp/$u.shcomp
 | 
			
		||||
		mkdir -m700 "$tmp_s" || exit
 | 
			
		||||
		# must incorporate _common in script itself so the aliases are expanded at compile time
 | 
			
		||||
		sed '/^\. .*\/_common/ {
 | 
			
		||||
			r _common
 | 
			
		||||
			d
 | 
			
		||||
		}' < $i > $c.orig
 | 
			
		||||
		cd "$tmp_s" || exit
 | 
			
		||||
		if	$SHCOMP "$OLDPWD/$i" > $c
 | 
			
		||||
		if	"$SHCOMP" "$c.orig" > $c
 | 
			
		||||
		then	if	tmp=$tmp_s $valgrind $SHELL $trace $c
 | 
			
		||||
			then	echo test $o passed ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"} "[ $t $T 0 errors ]"
 | 
			
		||||
			else	e=$?
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue