You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2020/10/30 06:05:37 UTC

[incubator-nuttx] 03/08: tools/testbuild.sh: Support regular expression in blacklist

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

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

commit 6be4d00c147739b4f42bf468e30bdf9924f065b2
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue Oct 27 01:44:23 2020 +0800

    tools/testbuild.sh: Support regular expression in blacklist
    
    and prepend 'uname -s' to config for filtering config by host
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 tools/README.txt   |  5 +++-
 tools/testbuild.sh | 87 +++++++++++++++++++++++++++++++++---------------------
 2 files changed, 58 insertions(+), 34 deletions(-)

diff --git a/tools/README.txt b/tools/README.txt
index 7282d0d..fc04784 100644
--- a/tools/README.txt
+++ b/tools/README.txt
@@ -1040,7 +1040,10 @@ testbuild.sh
   configured board.
 
   The prefix '-' can be used to skip a configuration:
-  -stm32f429i-disco/nsh,CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIL
+  -stm32f429i-disco/nsh
+
+  or skip a configuration on a specific host(e.g. Darwin):
+  -Darwin,sim:rpserver
 
 uncrustify.cfg
 --------------
diff --git a/tools/testbuild.sh b/tools/testbuild.sh
index afc27bc..b974e98 100755
--- a/tools/testbuild.sh
+++ b/tools/testbuild.sh
@@ -47,6 +47,23 @@ unset JOPTION
 PRINTLISTONLY=0
 GITCLEAN=0
 
+case $(uname -s) in
+  Darwin*)
+    HOST=Darwin
+    ;;
+  CYGWIN*)
+    HOST=Cygwin
+    ;;
+  MINGW32*)
+    HOST=MinGw
+    ;;
+  *)
+
+    # Assume linux as a fallback
+    HOST=Linux
+    ;;
+esac
+
 function showusage {
   echo ""
   echo "USAGE: $progname [-l|m|c|g|n] [-d] [-e <extraflags>] [-x] [-j <ncpus>] [-a <appsdir>] [-t <topdir>] [-p] [-G] <testlist-file>"
@@ -258,51 +275,55 @@ function build {
 function dotest {
   echo "===================================================================================="
   config=`echo $1 | cut -d',' -f1`
-  re="-${config/\//:}[[:space:]]"
-  if [[ "${blacklist} " =~ $re ]]; then
-    echo "Skipping: $1"
-  else
-    echo "Configuration/Tool: $1"
-    if [ ${PRINTLISTONLY} -eq 1 ]; then
+  check=${HOST},${config/\//:}
+
+  for re in $blacklist; do
+    if [[ "${check}" =~ ${re:1}$ ]]; then
+      echo "Skipping: $1"
       return
     fi
+  done
 
-    # Parse the next line
+  echo "Configuration/Tool: $1"
+  if [ ${PRINTLISTONLY} -eq 1 ]; then
+    return
+  fi
 
-    configdir=`echo $config | cut -s -d':' -f2`
+  # Parse the next line
+
+  configdir=`echo $config | cut -s -d':' -f2`
+  if [ -z "${configdir}" ]; then
+    configdir=`echo $config | cut -s -d'/' -f2`
     if [ -z "${configdir}" ]; then
-      configdir=`echo $config | cut -s -d'/' -f2`
-      if [ -z "${configdir}" ]; then
-        echo "ERROR: Malformed configuration: ${config}"
-        showusage
-      else
-        boarddir=`echo $config | cut -d'/' -f1`
-      fi
+      echo "ERROR: Malformed configuration: ${config}"
+      showusage
     else
-      boarddir=`echo $config | cut -d':' -f1`
+      boarddir=`echo $config | cut -d'/' -f1`
     fi
+  else
+    boarddir=`echo $config | cut -d':' -f1`
+  fi
 
-    path=$nuttx/boards/*/*/$boarddir/configs/$configdir
-    if [ ! -r $path/defconfig ]; then
-      echo "ERROR: no configuration found at $path"
-      showusage
-    fi
+  path=$nuttx/boards/*/*/$boarddir/configs/$configdir
+  if [ ! -r $path/defconfig ]; then
+    echo "ERROR: no configuration found at $path"
+    showusage
+  fi
 
-    unset toolchain
-    if [ "X$config" != "X$1" ]; then
-      toolchain=`echo $1 | cut -d',' -f2`
-      if [ -z "$toolchain" ]; then
-        echo "  Warning: no tool configuration"
-      fi
+  unset toolchain
+  if [ "X$config" != "X$1" ]; then
+    toolchain=`echo $1 | cut -d',' -f2`
+    if [ -z "$toolchain" ]; then
+      echo "  Warning: no tool configuration"
     fi
+  fi
 
-    # Perform the build test
+  # Perform the build test
 
-    echo "------------------------------------------------------------------------------------"
-    distclean
-    configure
-    build
-  fi
+  echo "------------------------------------------------------------------------------------"
+  distclean
+  configure
+  build
 }
 
 # Perform the build test for each entry in the test list file