Test: Fix: exit status (was always 0)
This commit is contained in:
		@@ -3,6 +3,9 @@
 | 
				
			|||||||
# credit to https://github.com/w0rp/ale for script ideas and the color vader
 | 
					# credit to https://github.com/w0rp/ale for script ideas and the color vader
 | 
				
			||||||
# output function.
 | 
					# output function.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Global error return of the script
 | 
				
			||||||
 | 
					o_error=0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
printHelp() {
 | 
					printHelp() {
 | 
				
			||||||
    echo "Usage: $0 [OPTIONS]"
 | 
					    echo "Usage: $0 [OPTIONS]"
 | 
				
			||||||
    echo ""
 | 
					    echo ""
 | 
				
			||||||
@@ -12,10 +15,10 @@ printHelp() {
 | 
				
			|||||||
    echo ""
 | 
					    echo ""
 | 
				
			||||||
    echo "-n Specify vim/nvim version to run tests for."
 | 
					    echo "-n Specify vim/nvim version to run tests for."
 | 
				
			||||||
    echo "   Multiple versions can be specified by quoting the value and"
 | 
					    echo "   Multiple versions can be specified by quoting the value and"
 | 
				
			||||||
    echo "   separating versions with a space. E.g. -v \"vim1 vim2\"."
 | 
					    echo "   separating versions with a space. E.g. -n \"vim1 vim2\"."
 | 
				
			||||||
    echo "   Default is all available versions."
 | 
					    echo "   Default is all available versions."
 | 
				
			||||||
    echo ""
 | 
					    echo ""
 | 
				
			||||||
    echo "-l List available versions that can be used with the '-v' option"
 | 
					    echo "-l List available versions that can be used with the '-n' option"
 | 
				
			||||||
    echo ""
 | 
					    echo ""
 | 
				
			||||||
    echo "-t Select test type: 'vader', 'vint', or 'all'"
 | 
					    echo "-t Select test type: 'vader', 'vint', or 'all'"
 | 
				
			||||||
    echo ""
 | 
					    echo ""
 | 
				
			||||||
@@ -29,6 +32,7 @@ printHelp() {
 | 
				
			|||||||
printVersions() {
 | 
					printVersions() {
 | 
				
			||||||
    # print the names of all vim/nvim versions
 | 
					    # print the names of all vim/nvim versions
 | 
				
			||||||
    getVers
 | 
					    getVers
 | 
				
			||||||
 | 
					    exit 0
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
runVader() {
 | 
					runVader() {
 | 
				
			||||||
@@ -67,13 +71,15 @@ runVader() {
 | 
				
			|||||||
        # see README.md for more information
 | 
					        # see README.md for more information
 | 
				
			||||||
        docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${flags[@]}" \
 | 
					        docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${flags[@]}" \
 | 
				
			||||||
          /bin/bash -c "$test_cmd" 2>&1 | vader_filter | vader_color
 | 
					          /bin/bash -c "$test_cmd" 2>&1 | vader_filter | vader_color
 | 
				
			||||||
 | 
					        o_error=$(( $o_error | $? ))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # remaining tests
 | 
					        # remaining tests
 | 
				
			||||||
        docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${flags[@]}" \
 | 
					        docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${flags[@]}" \
 | 
				
			||||||
          "$v" -u test/vimrc -i NONE "+Vader! ${res}" 2>&1 | vader_filter | vader_color
 | 
					          "$v" -u test/vimrc -i NONE "+Vader! ${res}" 2>&1 | vader_filter | vader_color
 | 
				
			||||||
 | 
					        o_error=$(( $o_error | $? ))
 | 
				
			||||||
        set +o pipefail
 | 
					        set +o pipefail
 | 
				
			||||||
 | 
					 | 
				
			||||||
    done
 | 
					    done
 | 
				
			||||||
 | 
					    return $o_error
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
runVint() {
 | 
					runVint() {
 | 
				
			||||||
@@ -115,11 +121,13 @@ vader_filter() {
 | 
				
			|||||||
    done
 | 
					    done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [[ "$err" == 1 ]]; then
 | 
					    if [[ "$err" == 1 ]]; then
 | 
				
			||||||
 | 
					        o_error=1
 | 
				
			||||||
        echo ""
 | 
					        echo ""
 | 
				
			||||||
        echo "!---------Failed tests detected---------!"
 | 
					        echo "!---------Failed tests detected---------!"
 | 
				
			||||||
        echo "Run with the '-v' flag for verbose output"
 | 
					        echo "Run with the '-v' flag for verbose output"
 | 
				
			||||||
        echo ""
 | 
					        echo ""
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					    return $o_error
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Say Hi
 | 
					# Say Hi
 | 
				
			||||||
@@ -219,7 +227,6 @@ fi
 | 
				
			|||||||
trap exit 1 SIGINT SIGTERM
 | 
					trap exit 1 SIGINT SIGTERM
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# select which tests should run
 | 
					# select which tests should run
 | 
				
			||||||
o_error=0
 | 
					 | 
				
			||||||
case $type in
 | 
					case $type in
 | 
				
			||||||
    "vader" )
 | 
					    "vader" )
 | 
				
			||||||
        runVader
 | 
					        runVader
 | 
				
			||||||
@@ -244,5 +251,6 @@ case $type in
 | 
				
			|||||||
        exit 1
 | 
					        exit 1
 | 
				
			||||||
esac
 | 
					esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Exit
 | 
				
			||||||
echo "Script $(basename $0) exiting: $o_error"
 | 
					echo "Script $(basename $0) exiting: $o_error"
 | 
				
			||||||
exit $o_error
 | 
					exit $o_error
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user