You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/04/20 13:07:42 UTC

[incubator-nuttx] 02/09: tools: Remove the temp variable in checking program exit code

This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 5c1497aeb111f7fc6f7541e7da791012cef38847
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sun Apr 19 16:58:55 2020 +0800

    tools: Remove the temp variable in checking program exit code
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 tools/checkpatch.sh | 18 ++++++------------
 tools/testbuild.sh  |  6 ++----
 2 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/tools/checkpatch.sh b/tools/checkpatch.sh
index 08adb21..6c10fd4 100755
--- a/tools/checkpatch.sh
+++ b/tools/checkpatch.sh
@@ -42,17 +42,13 @@ usage() {
 }
 
 check_file() {
-  $TOOLDIR/nxstyle $@ 2>&1
-  ret=$?
-  if [ $ret != 0 ]; then
-    fail=$ret
+  if ! $TOOLDIR/nxstyle $@ 2>&1; then
+    fail=1
   fi
 
   if [ $spell != 0 ]; then
-    codespell -q 7 ${@: -1}
-    ret=$?
-    if [ $ret != 0 ]; then
-      fail=$ret
+    if ! codespell -q 7 ${@: -1}; then
+      fail=1
     fi
   fi
 }
@@ -83,10 +79,8 @@ check_ranges() {
 }
 
 check_patch() {
-  git apply --check $1
-  ret=$?
-  if [ $ret != 0 ]; then
-    fail=$ret
+  if ! git apply --check $1; then
+    fail=1
   else
     git apply $1
     diffs=`cat $1`
diff --git a/tools/testbuild.sh b/tools/testbuild.sh
index eca88ee..d1f3f34 100755
--- a/tools/testbuild.sh
+++ b/tools/testbuild.sh
@@ -158,10 +158,8 @@ blacklist=`grep "^-" $testfile || true`
 cd $nuttx || { echo "ERROR: failed to CD to $nuttx"; exit 1; }
 
 function makefunc {
-  ${MAKE} ${MAKE_FLAGS} "${EXTRA_FLAGS}" $@ 1>/dev/null
-  ret=$?
-  if [ $ret != 0 ]; then
-    fail=$ret
+  if ! ${MAKE} ${MAKE_FLAGS} "${EXTRA_FLAGS}" $@ 1>/dev/null; then
+    fail=1
   fi
 }