mirror of
				https://github.com/linuxkit/linuxkit.git
				synced 2025-10-31 08:50:30 +00:00 
			
		
		
		
	tests: traverse directories before removing them during cleanup
Without `-depth` find will first `rm -rf foo` and then try to recurse into `foo` resulting in `No such file or directory`. With this the various `|| true` suffixes should no longer be required. Lastly, in test/cases/040_packages/013_mkimage/test.sh cleanup any `disk.qcow2*` detritus as well as the image itself. Signed-off-by: Ian Campbell <ian.campbell@docker.com>
This commit is contained in:
		| @@ -12,7 +12,7 @@ NAME=check | |||||||
|  |  | ||||||
| clean_up() { | clean_up() { | ||||||
| 	# remove any images | 	# remove any images | ||||||
| 	find . -iname "${NAME}*" -exec rm {} \; | 	find . -depth -iname "${NAME}*" -exec rm -rf {} \; | ||||||
| } | } | ||||||
|  |  | ||||||
| trap clean_up EXIT | trap clean_up EXIT | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ set -e | |||||||
| . "${RT_PROJECT_ROOT}/_lib/lib.sh" | . "${RT_PROJECT_ROOT}/_lib/lib.sh" | ||||||
|  |  | ||||||
| clean_up() { | clean_up() { | ||||||
| 	find . -iname "test-kernel-config*" -not -iname "*.yml" -exec rm -rf {} \; || true | 	find . -depth -iname "test-kernel-config*" -not -iname "*.yml" -exec rm -rf {} \; | ||||||
| } | } | ||||||
| trap clean_up EXIT | trap clean_up EXIT | ||||||
|  |  | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ set -e | |||||||
| . "${RT_PROJECT_ROOT}/_lib/lib.sh" | . "${RT_PROJECT_ROOT}/_lib/lib.sh" | ||||||
|  |  | ||||||
| clean_up() { | clean_up() { | ||||||
| 	find . -iname "test-kernel-config*" -not -iname "*.yml" -exec rm -rf {} \; || true | 	find . -depth -iname "test-kernel-config*" -not -iname "*.yml" -exec rm -rf {} \; | ||||||
| } | } | ||||||
| trap clean_up EXIT | trap clean_up EXIT | ||||||
|  |  | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ set -e | |||||||
| . "${RT_PROJECT_ROOT}/_lib/lib.sh" | . "${RT_PROJECT_ROOT}/_lib/lib.sh" | ||||||
|  |  | ||||||
| clean_up() { | clean_up() { | ||||||
| 	find . -iname "test-kernel-config*" -not -iname "*.yml" -exec rm -rf {} \; || true | 	find . -depth -iname "test-kernel-config*" -not -iname "*.yml" -exec rm -rf {} \; | ||||||
| } | } | ||||||
| trap clean_up EXIT | trap clean_up EXIT | ||||||
|  |  | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ IMAGE_NAME="kmod-test" | |||||||
|  |  | ||||||
| clean_up() { | clean_up() { | ||||||
| 	docker rmi ${IMAGE_NAME} || true | 	docker rmi ${IMAGE_NAME} || true | ||||||
| 	find . -iname "kmod*" -not -iname "*.yml" -exec rm -rf {} \; || true | 	find . -depth -iname "kmod*" -not -iname "*.yml" -exec rm -rf {} \; | ||||||
| } | } | ||||||
| trap clean_up EXIT | trap clean_up EXIT | ||||||
|  |  | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ set -e | |||||||
| . "${RT_PROJECT_ROOT}/_lib/lib.sh" | . "${RT_PROJECT_ROOT}/_lib/lib.sh" | ||||||
|  |  | ||||||
| clean_up() { | clean_up() { | ||||||
| 	find . -iname "test-binfmt*" -not -iname "*.yml" -exec rm -rf {} \; || true | 	find . -depth -iname "test-binfmt*" -not -iname "*.yml" -exec rm -rf {} \; | ||||||
| } | } | ||||||
| trap clean_up EXIT | trap clean_up EXIT | ||||||
|  |  | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ set -e | |||||||
| . "${RT_PROJECT_ROOT}/_lib/lib.sh" | . "${RT_PROJECT_ROOT}/_lib/lib.sh" | ||||||
|  |  | ||||||
| clean_up() { | clean_up() { | ||||||
| 	find . -iname "test-ca-certificates*" -not -iname "*.yml" -exec rm -rf {} \; || true | 	find . -depth -iname "test-ca-certificates*" -not -iname "*.yml" -exec rm -rf {} \; | ||||||
| } | } | ||||||
| trap clean_up EXIT | trap clean_up EXIT | ||||||
|  |  | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ set -e | |||||||
| . "${RT_PROJECT_ROOT}/_lib/lib.sh" | . "${RT_PROJECT_ROOT}/_lib/lib.sh" | ||||||
|  |  | ||||||
| clean_up() { | clean_up() { | ||||||
| 	find . -iname "test-dhcpcd*" -not -iname "*.yml" -exec rm -rf {} \; || true | 	find . -depth -iname "test-dhcpcd*" -not -iname "*.yml" -exec rm -rf {} \; | ||||||
| } | } | ||||||
| trap clean_up EXIT | trap clean_up EXIT | ||||||
|  |  | ||||||
|   | |||||||
| @@ -10,9 +10,10 @@ set -e | |||||||
| . "${RT_PROJECT_ROOT}/_lib/lib.sh" | . "${RT_PROJECT_ROOT}/_lib/lib.sh" | ||||||
|  |  | ||||||
| clean_up() { | clean_up() { | ||||||
| 	find . -iname "run*" -not -iname "*.yml" -exec rm -rf {} \; | 	find . -depth -iname "run*" -not -iname "*.yml" -exec rm -rf {} \; | ||||||
| 	find . -iname "mkimage*" -not -iname "*.yml" -exec rm -rf {} \; | 	find . -depth -iname "mkimage*" -not -iname "*.yml" -exec rm -rf {} \; | ||||||
| 	rm -f disk.qcow2 tarball.img | 	find . -depth -iname "disk.qcow2*" -not -iname "*.yml" -exec rm -rf {} \; | ||||||
|  | 	rm -f tarball.img | ||||||
| } | } | ||||||
| trap clean_up EXIT | trap clean_up EXIT | ||||||
|  |  | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ set -e | |||||||
| . "${RT_PROJECT_ROOT}/_lib/lib.sh" | . "${RT_PROJECT_ROOT}/_lib/lib.sh" | ||||||
|  |  | ||||||
| clean_up() { | clean_up() { | ||||||
| 	find . -iname "test-sysctl*" -not -iname "*.yml" -exec rm -rf {} \; || true | 	find . -depth -iname "test-sysctl*" -not -iname "*.yml" -exec rm -rf {} \; | ||||||
| } | } | ||||||
| trap clean_up EXIT | trap clean_up EXIT | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user