Apply bash error handling consistently in all bash scripts
Change-Id: I36dcff9cc2593bcfb6aebbe84b59d95c711eb3e4
This commit is contained in:
		
							
								
								
									
										15
									
								
								.alltests
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								.alltests
									
									
									
									
									
								
							@@ -1,33 +1,22 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set -e
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TOP_DIR=$(python -c "import os; print os.path.dirname(os.path.realpath('$0'))")
 | 
					TOP_DIR=$(python -c "import os; print os.path.dirname(os.path.realpath('$0'))")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "==== Unit tests ===="
 | 
					echo "==== Unit tests ===="
 | 
				
			||||||
resetswift
 | 
					resetswift
 | 
				
			||||||
$TOP_DIR/.unittests $@
 | 
					$TOP_DIR/.unittests $@
 | 
				
			||||||
rvalue=$?
 | 
					 | 
				
			||||||
if [ $rvalue != 0 ] ; then
 | 
					 | 
				
			||||||
    exit $rvalue
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "==== Func tests ===="
 | 
					echo "==== Func tests ===="
 | 
				
			||||||
resetswift
 | 
					resetswift
 | 
				
			||||||
startmain
 | 
					startmain
 | 
				
			||||||
$TOP_DIR/.functests $@
 | 
					$TOP_DIR/.functests $@
 | 
				
			||||||
rvalue=$?
 | 
					 | 
				
			||||||
if [ $rvalue != 0 ] ; then
 | 
					 | 
				
			||||||
    exit $rvalue
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "==== Probe tests ===="
 | 
					echo "==== Probe tests ===="
 | 
				
			||||||
resetswift
 | 
					resetswift
 | 
				
			||||||
$TOP_DIR/.probetests $@
 | 
					$TOP_DIR/.probetests $@
 | 
				
			||||||
rvalue=$?
 | 
					 | 
				
			||||||
if [ $rvalue != 0 ] ; then
 | 
					 | 
				
			||||||
    exit $rvalue
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "All tests runs fine"
 | 
					echo "All tests runs fine"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exit 0
 | 
					exit 0
 | 
				
			||||||
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,6 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SRC_DIR=$(python -c "import os; print os.path.dirname(os.path.realpath('$0'))")
 | 
					SRC_DIR=$(python -c "import os; print os.path.dirname(os.path.realpath('$0'))")
 | 
				
			||||||
set -e
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
cd ${SRC_DIR}
 | 
					cd ${SRC_DIR}
 | 
				
			||||||
export TESTS_DIR=${SRC_DIR}/test/functional
 | 
					export TESTS_DIR=${SRC_DIR}/test/functional
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,7 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set -e
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cd /etc/swift
 | 
					cd /etc/swift
 | 
				
			||||||
 | 
					
 | 
				
			||||||
rm -f *.builder *.ring.gz backups/*.builder backups/*.ring.gz
 | 
					rm -f *.builder *.ring.gz backups/*.builder backups/*.ring.gz
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,9 +1,13 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
swift-init all stop
 | 
					set -e
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					swift-init all kill
 | 
				
			||||||
# Remove the following line if you did not set up rsyslog for individual logging:
 | 
					# Remove the following line if you did not set up rsyslog for individual logging:
 | 
				
			||||||
sudo find /var/log/swift -type f -exec rm -f {} \;
 | 
					sudo find /var/log/swift -type f -exec rm -f {} \;
 | 
				
			||||||
sudo umount /mnt/sdb1
 | 
					if cut -d' ' -f2 /proc/mounts | grep -q /mnt/sdb1 ; then
 | 
				
			||||||
 | 
					    sudo umount /mnt/sdb1
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
# If you are using a loopback device set SAIO_BLOCK_DEVICE to "/srv/swift-disk"
 | 
					# If you are using a loopback device set SAIO_BLOCK_DEVICE to "/srv/swift-disk"
 | 
				
			||||||
sudo mkfs.xfs -f ${SAIO_BLOCK_DEVICE:-/dev/sdb1}
 | 
					sudo mkfs.xfs -f ${SAIO_BLOCK_DEVICE:-/dev/sdb1}
 | 
				
			||||||
sudo mount /mnt/sdb1
 | 
					sudo mount /mnt/sdb1
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1,5 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
swift-init main start
 | 
					set -e
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					swift-init main start
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1,5 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
swift-init rest start
 | 
					set -e
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					swift-init rest start
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user