Commit 844c8ec3 authored by Michal Berger's avatar Michal Berger Committed by Jim Harris
Browse files

check_format: Reformat the Bash code in compliance with shfmt



Change-Id: I93e7b9d355870b0528a0ac3382fba1a10a558d45
Signed-off-by: default avatarMichal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1718


Community-CI: Mellanox Build Bot
Reviewed-by: default avatarKarol Latecki <karol.latecki@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 0c1d022b
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ $MAKE cc_version
$MAKE cxx_version
echo "** END ** Info for Hostname: $HOSTNAME"

function ocf_precompile {
function ocf_precompile() {
	# We compile OCF sources ourselves
	# They don't need to be checked with scanbuild and code coverage is not applicable
	# So we precompile OCF now for further use as standalone static library
@@ -48,7 +48,7 @@ function ocf_precompile {
	./configure $config_params
}

function make_fail_cleanup {
function make_fail_cleanup() {
	if [ -d $out/scan-build-tmp ]; then
		scanoutput=$(ls -1 $out/scan-build-tmp/)
		mv $out/scan-build-tmp/$scanoutput $out/scan-build
@@ -58,7 +58,7 @@ function make_fail_cleanup {
	false
}

function scanbuild_make {
function scanbuild_make() {
	pass=true
	$scanbuild $MAKE $MAKEFLAGS > $out/build_output.txt && rm -rf $out/scan-build-tmp || make_fail_cleanup
	xtrace_disable
@@ -92,7 +92,7 @@ function scanbuild_make {
	$pass
}

function porcelain_check {
function porcelain_check() {
	if [ $(git status --porcelain --ignore-submodules | wc -l) -ne 0 ]; then
		echo "Generated files missing from .gitignore:"
		git status --porcelain --ignore-submodules
@@ -103,7 +103,7 @@ function porcelain_check {
# Check that header file dependencies are working correctly by
#  capturing a binary's stat data before and after touching a
#  header file and re-making.
function header_dependency_check {
function header_dependency_check() {
	STAT1=$(stat app/spdk_tgt/spdk_tgt)
	sleep 1
	touch lib/nvme/nvme_internal.h
@@ -116,7 +116,7 @@ function header_dependency_check {
	fi
}

function test_make_uninstall {
function test_make_uninstall() {
	# Create empty file to check if it is not deleted by target uninstall
	touch "$SPDK_WORKSPACE/usr/lib/sample_xyz.a"
	$MAKE $MAKEFLAGS uninstall DESTDIR="$SPDK_WORKSPACE" prefix=/usr
@@ -127,7 +127,7 @@ function test_make_uninstall {
	fi
}

function build_doc {
function build_doc() {
	$MAKE -C "$rootdir"/doc --no-print-directory $MAKEFLAGS &> "$out"/doxygen.log
	if [ -s "$out"/doxygen.log ]; then
		cat "$out"/doxygen.log
@@ -149,7 +149,7 @@ function build_doc {
	rm -rf "$rootdir"/doc/output
}

function autobuild_test_suite {
function autobuild_test_suite() {
	run_test "autobuild_check_format" ./scripts/check_format.sh
	run_test "autobuild_external_code" sudo -E $rootdir/test/external_code/test_make.sh $rootdir
	if [ "$SPDK_TEST_OCF" -eq 1 ]; then
+12 −14
Original line number Diff line number Diff line
@@ -82,9 +82,7 @@ if [ $(uname -s) = Linux ]; then
	# If some OCSSD device is bound to other driver than nvme we won't be able to
	# discover if it is OCSSD or not so load the kernel driver first.


	while IFS= read -r -d '' dev
	do
	while IFS= read -r -d '' dev; do
		# Send Open Channel 2.0 Geometry opcode "0xe2" - not supported by NVMe device.
		if nvme admin-passthru $dev --namespace-id=1 --data-len=4096 --opcode=0xe2 --read > /dev/null; then
			bdf="$(basename $(readlink -e /sys/class/nvme/${dev#/dev/}/device))"
+18 −19
Original line number Diff line number Diff line
@@ -65,8 +65,7 @@ fi

if hash astyle; then
	echo -n "Checking coding style..."
	if [ "$(astyle -V)" \< "Artistic Style Version 3" ]
	then
	if [ "$(astyle -V)" \< "Artistic Style Version 3" ]; then
		echo -n " Your astyle version is too old so skipping coding style checks. Please update astyle to at least 3.0.1 version..."
	else
		rm -f astyle.log
@@ -75,9 +74,9 @@ if hash astyle; then
		#  as-is to enable ongoing work to synch with a generic upstream DPDK vhost library,
		#  rather than making diffs more complicated by a lot of changes to follow SPDK
		#  coding standards.
		git ls-files '*.[ch]' '*.cpp' '*.cc' '*.cxx' '*.hh' '*.hpp' | \
			grep -v rte_vhost | grep -v cpp_headers | \
			xargs -P$(nproc) -n10 astyle --options=.astylerc >> astyle.log
		git ls-files '*.[ch]' '*.cpp' '*.cc' '*.cxx' '*.hh' '*.hpp' \
			| grep -v rte_vhost | grep -v cpp_headers \
			| xargs -P$(nproc) -n10 astyle --options=.astylerc >> astyle.log
		if grep -q "^Formatted" astyle.log; then
			echo " errors detected"
			git diff
@@ -171,8 +170,8 @@ rm -f badcunit.log

echo -n "Checking blank lines at end of file..."

if ! git grep -I -l -e . -z  './*' ':!*.patch' | \
	xargs -0 -P$(nproc) -n1 scripts/eofnl > eofnl.log; then
if ! git grep -I -l -e . -z './*' ':!*.patch' \
	| xargs -0 -P$(nproc) -n1 scripts/eofnl > eofnl.log; then
	echo " Incorrect end-of-file formatting detected"
	cat eofnl.log
	rc=1
+36 −36
Original line number Diff line number Diff line
@@ -40,11 +40,11 @@ cache_pci () {
	local pci=$1 class=$2 vendor=$3 device=$4

	if [[ -n $class ]]; then
		class=0x${class/0x}
		class=0x${class/0x/}
		pci_bus_cache["$class"]="${pci_bus_cache["$class"]:+${pci_bus_cache["$class"]} }$pci"
	fi
	if [[ -n $vendor && -n $device ]]; then
		vendor=0x${vendor/0x} device=0x${device/0x}
		vendor=0x${vendor/0x/} device=0x${device/0x/}
		pci_bus_cache["$vendor"]="${pci_bus_cache["$vendor"]:+${pci_bus_cache["$vendor"]} }$pci"
		pci_bus_cache["$device"]="${pci_bus_cache["$device"]:+${pci_bus_cache["$device"]} }$pci"
		pci_bus_cache["$vendor:$device"]="${pci_bus_cache["$vendor:$device"]:+${pci_bus_cache["$vendor:$device"]} }$pci"
@@ -141,18 +141,18 @@ function iter_all_pci_class_code() {

	if hash lspci &> /dev/null; then
		if [ "$progif" != "00" ]; then
			lspci -mm -n -D | \
				grep -i -- "-p${progif}" | \
				awk -v cc="\"${class}${subclass}\"" -F " " \
			lspci -mm -n -D \
				| grep -i -- "-p${progif}" \
				| awk -v cc="\"${class}${subclass}\"" -F " " \
					'{if (cc ~ $2) print $1}' | tr -d '"'
		else
			lspci -mm -n -D | \
				awk -v cc="\"${class}${subclass}\"" -F " " \
			lspci -mm -n -D \
				| awk -v cc="\"${class}${subclass}\"" -F " " \
					'{if (cc ~ $2) print $1}' | tr -d '"'
		fi
	elif hash pciconf &> /dev/null; then
		local addr=($(pciconf -l | grep -i "class=0x${class}${subclass}${progif}" | \
			cut -d$'\t' -f1 | sed -e 's/^[a-zA-Z0-9_]*@pci//g' | tr ':' ' '))
		local addr=($(pciconf -l | grep -i "class=0x${class}${subclass}${progif}" \
			| cut -d$'\t' -f1 | sed -e 's/^[a-zA-Z0-9_]*@pci//g' | tr ':' ' '))
		printf "%04x:%02x:%02x:%x\n" ${addr[0]} ${addr[1]} ${addr[2]} ${addr[3]}
	elif iter_all_pci_sysfs "$(printf '0x%06x' $((0x$progif | 0x$subclass << 8 | 0x$class << 16)))"; then
		:
@@ -173,8 +173,8 @@ function iter_all_pci_dev_id() {
		lspci -mm -n -D | awk -v ven="\"$ven_id\"" -v dev="\"${dev_id}\"" -F " " \
			'{if (ven ~ $3 && dev ~ $4) print $1}' | tr -d '"'
	elif hash pciconf &> /dev/null; then
		local addr=($(pciconf -l | grep -i "chip=0x${dev_id}${ven_id}" | \
			cut -d$'\t' -f1 | sed -e 's/^[a-zA-Z0-9_]*@pci//g' | tr ':' ' '))
		local addr=($(pciconf -l | grep -i "chip=0x${dev_id}${ven_id}" \
			| cut -d$'\t' -f1 | sed -e 's/^[a-zA-Z0-9_]*@pci//g' | tr ':' ' '))
		printf "%04x:%02x:%02x:%x\n" ${addr[0]} ${addr[1]} ${addr[2]} ${addr[3]}
	elif iter_all_pci_sysfs "0x$ven_id:0x$dev_id"; then
		:
+7 −9
Original line number Diff line number Diff line
@@ -2,13 +2,11 @@

set -e

function err()
{
function err() {
	echo "$@" >&2
}

function usage()
{
function usage() {
	err "Detect compiler and linker versions, generate mk/cc.mk"
	err ""
	err "Usage: ./detect_cc.sh [OPTION]..."
@@ -24,8 +22,6 @@ function usage()
	err " --cross-prefix=prefix     Use the given prefix for the cross compiler toolchain"
}



for i in "$@"; do
	case "$i" in
		-h | --help)
@@ -64,6 +60,7 @@ for i in "$@"; do
			err "Unrecognized option $i"
			usage
			exit 1
			;;
	esac
done

@@ -105,6 +102,7 @@ case "$LD_TYPE" in
	*)
		err "Unsupported linker: $LD"
		exit 1
		;;
esac

CCAR="ar"
Loading