File 0324-Update-run-dialyzer-script-to-be-more-generic-and-ag.patch of Package erlang

From fe523ea8fd0bb9c511637f76bd956856a4908659 Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Tue, 30 Apr 2019 16:24:39 +0200
Subject: [PATCH 2/2] Update run-dialyzer script to be more generic and
 aggressive

This version will abort when errors are found when building the PLT.
---
 scripts/run-dialyzer | 50 ++++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 40 insertions(+), 10 deletions(-)

diff --git a/scripts/run-dialyzer b/scripts/run-dialyzer
index 621de3fa65..44436594d3 100755
--- a/scripts/run-dialyzer
+++ b/scripts/run-dialyzer
@@ -1,17 +1,47 @@
 #!/bin/bash
 
 set -e
-set -x
 
-$ERL_TOP/bin/dialyzer --build_plt --apps asn1 compiler crypto dialyzer edoc erts et ftp hipe inets kernel mnesia observer public_key runtime_tools snmp ssh ssl stdlib syntax_tools tftp wx xmerl --statistics
-$ERL_TOP/bin/dialyzer -n -Wunknown -Wunmatched_returns --apps compiler erts ftp tftp kernel stdlib asn1 crypto dialyzer hipe parsetools public_key runtime_tools sasl tools --statistics
-$ERL_TOP/bin/dialyzer -n --apps common_test debugger edoc ftp inets mnesia observer ssh ssl syntax_tools tftp wx xmerl --statistics
+filter () {
+    FILTER_RESULT=""
+    for app in $1; do
+        if echo " $2 " | grep -v " $app " > /dev/null; then
+            FILTER_RESULT="$FILTER_RESULT $app"
+        fi
+    done
+}
+
+ALL_APPLICATIONS=$(ls -d -1 lib/*/ | sed 's:^lib\|/::g')
+echo "All applications: $ALL_APPLICATIONS" |tr '\n' ' ' && echo ""
+
+BASE_PLT="compiler crypto erts hipe kernel stdlib syntax_tools"
+APP_PLT="asn1 edoc et ftp inets mnesia observer public_key sasl runtime_tools snmp ssl tftp wx xmerl tools"
+NO_UNMATCHED="common_test debugger edoc eunit ftp inets mnesia observer reltool ssh ssl syntax_tools tftp wx xmerl"
+WARNINGS="diameter megaco snmp"
+
+TRAVIS_SKIP=""
+if [ "X$TRAVIS" = "Xtrue" ]; then
+   TRAVIS_SKIP="common_test eldap erl_docgen odbc eunit reltool os_mon diameter megaco snmp"
+fi
+
+filter "$ALL_APPLICATIONS" "$NO_UNMATCHED $WARNINGS $TRAVIS_SKIP"
+UNMATCHED=$FILTER_RESULT
+filter "$APP_PLT" "$TRAVIS_SKIP"
+APP_PLT=$FILTER_RESULT
+filter "$NO_UNMATCHED" "$TRAVIS_SKIP"
+NO_UNMATCHED=$FILTER_RESULT
+filter "$WARNINGS" "$TRAVIS_SKIP"
+WARNINGS=$FILTER_RESULT
 
-# In travis we don't dialyze everything as it takes too much time
-if [ "X$TRAVIS" != "Xtrue" ]; then
-    $ERL_TOP/bin/dialyzer -n -Wunknown -Wunmatched_returns --apps eldap erl_docgen et odbc --statistics
-    $ERL_TOP/bin/dialyzer -n --apps eunit reltool os_mon --statistics
+echo "UNMATCHED = $UNMATCHED"
+echo "NO_UNMATCHED = $NO_UNMATCHED"
+echo "WARNINGS = $WARNINGS"
+
+set -x
 
-    # These application are not run always as the currently have dialyzer warnings
-    # $ERL_TOP/bin/dialyzer -n --apps diameter megaco snmp --statistics
+$ERL_TOP/bin/dialyzer --build_plt -Wunknown --apps $BASE_PLT $APP_PLT --statistics
+$ERL_TOP/bin/dialyzer -n -Wunknown -Wunmatched_returns --apps $UNMATCHED --statistics
+$ERL_TOP/bin/dialyzer -n -Wunknown --apps $NO_UNMATCHED --statistics
+if [ "X$WARNINGS" != "X" ]; then
+    $ERL_TOP/bin/dialyzer -n --apps $WARNINGS --statistics
 fi
-- 
2.16.4

openSUSE Build Service is sponsored by