mirror of
				git://git.code.sf.net/p/cdesktopenv/code
				synced 2025-03-09 15:50:02 +00:00 
			
		
		
		
	shtests: use central temporary directory; add --keep option
This gets rid of repetitive code in test scripts to create their own temporary directories. Instead, shtests exports a $tmp to each test script that is a subdirectory of its own temporary directory. This has the advantage of having all test script temporary directories in one hierarchy. Along with a new option to keep temporary files, this makes it easy to inspect them if wanted. This does make the test scripts less self-contained as they now depend on a temporary directory being exported as $tmp. But they already depended on $SHELL being the shell to test, so they already were not quite self-contained. src/cmd/ksh93/tests/shtests: - Add -k/--keep option to keep temporary directory. Make the EXIT trap report its location instead of deleting it. - For each test, create a subdirectory of $tmp (named after the test script plus the tested locale or 'shcomp') and export that subdirectory to the test script as its own $tmp. - If -k is not given, delete each script's temporary files immediately after running it to minimise disk usage. src/cmd/ksh93/tests/*.sh: - Don't make own temp directory. - Refuse to run if $tmp is not set. - Miscellaneous tweaks.
This commit is contained in:
		
							parent
							
								
									fa70fc3f77
								
							
						
					
					
						commit
						d7afb57c49
					
				
					 51 changed files with 132 additions and 274 deletions
				
			
		| 
						 | 
				
			
			@ -28,14 +28,7 @@ alias err_exit='err_exit $LINENO'
 | 
			
		|||
Command=${0##*/}
 | 
			
		||||
integer Errors=0
 | 
			
		||||
 | 
			
		||||
tmp=$(
 | 
			
		||||
	d=${TMPDIR:-/tmp}/ksh93.readcsv.$$.${RANDOM:-0}
 | 
			
		||||
	mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
 | 
			
		||||
) || {
 | 
			
		||||
	err\_exit $LINENO 'mkdir failed'
 | 
			
		||||
	exit 1
 | 
			
		||||
}
 | 
			
		||||
trap 'cd / && rm -rf "$tmp"' EXIT
 | 
			
		||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
 | 
			
		||||
	
 | 
			
		||||
tmp1=$tmp/tmp1.csv
 | 
			
		||||
tmp2=$tmp/tmp2.csv
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue