[Asterisk-code-review] CI: Look up configured kernel.core pattern sysctl (asterisk[master])

George Joseph asteriskteam at digium.com
Thu Oct 4 08:54:25 CDT 2018


George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/10410 )

Change subject: CI: Look up configured kernel.core_pattern sysctl
......................................................................

CI: Look up configured kernel.core_pattern sysctl

Change-Id: I8246a0147df8d821fbbcabc1db1887104b8bedc4
---
M tests/CI/runUnittests.sh
1 file changed, 22 insertions(+), 5 deletions(-)

Approvals:
  Corey Farrell: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved; Approved for Submit



diff --git a/tests/CI/runUnittests.sh b/tests/CI/runUnittests.sh
index 7cb750b..2fb365d 100755
--- a/tests/CI/runUnittests.sh
+++ b/tests/CI/runUnittests.sh
@@ -3,6 +3,17 @@
 source $CIDIR/ci.functions
 ASTETCDIR=$DESTDIR/etc/asterisk
 
+asterisk_corefile_glob() {
+	local pattern=$(/sbin/sysctl -n kernel.core_pattern)
+
+	# If core_pattern is a pipe there isn't much we can do
+	if [[ ${pattern:0:1} == "|" ]] ; then
+		echo "core*"
+	else
+		echo "${pattern%%%*}*"
+	fi
+}
+
 cat <<-EOF > "$ASTETCDIR/logger.conf"
 	[logfiles]
 	full => notice,warning,error,debug,verbose
@@ -69,8 +80,14 @@
 set +x
 
 [ x"$USER_GROUP" != x ] && sudo chown -R $USER_GROUP $OUTPUTDIR
-if [ -f core* ] ; then
-	echo "*** Found a core file after running unit tests ***"
-	$DESTDIR/var/lib/asterisk/scripts/ast_coredumper --no-default-search core*
-	exit 1
-fi
+
+for core in $(asterisk_corefile_glob)
+do
+	if [ -f $core ]
+	then
+		echo "*** Found a core file ($core) after running unit tests ***"
+		sudo OUTPUTDIR=$OUTPUTDIR $DESTDIR/var/lib/asterisk/scripts/ast_coredumper --no-default-search $core
+	fi
+done
+
+exit 0

-- 
To view, visit https://gerrit.asterisk.org/10410
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I8246a0147df8d821fbbcabc1db1887104b8bedc4
Gerrit-Change-Number: 10410
Gerrit-PatchSet: 9
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2 (1000185)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181004/48742dca/attachment.html>


More information about the asterisk-code-review mailing list