Add unit tests and changes related

Base unit tests have been added with the means to generate
gcov coverage information and a small amounto of coverage
data.  Some changes were made to the code to make testing
coverage better and to fix identified issues.

Most important are the unique smart ptr changes; the
framework prototypes now require them to be shared pointers
as they are not released/reallocated (e.g. message Send()).

Issue-ID: RIC-148

Signed-off-by: E. Scott Daniels <daniels@research.att.com>
Change-Id: Ibc593ddc8687ce6d727bf6d3e2939c02f1e0afef
diff --git a/test/unit_test.sh b/test/unit_test.sh
new file mode 100755
index 0000000..9e0564b
--- /dev/null
+++ b/test/unit_test.sh
@@ -0,0 +1,88 @@
+#!/usr/bin/env bash
+# vim: ts=4 sw=4 noet:
+
+#==================================================================================
+#       Copyright (c) 2020 Nokia
+#       Copyright (c) 2020 AT&T Intellectual Property.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#==================================================================================
+
+#
+#	Mnemonic:	unit_test.sh
+#	Abstract:	This drives the unit tests and combs out the needed .gcov
+#				files which are by some magic collected for Sonar.
+#
+#	Date:		23 March 2020
+#	Author:		E. Scott Daniels
+# -----------------------------------------------------------------------------
+
+
+# Make a list of our modules under test so that we don't look at gcov
+# files that are generated for system lib headers in /usr/*
+# (bash makes the process of building a list of names  harder than it 
+# needs to be, so use caution with the printf() call.)
+#
+function mk_list {
+	grep -l "Source:\.\./src"  *.gcov | while read f
+	do
+		printf "$f "		# do NOT use echo or add \n!
+	done 
+}
+
+function abort_if_error {
+	if (( $1 == 0 ))
+	then
+		return
+	fi
+
+	if [[ -n /tmp/PID$$.log ]]
+	then
+		$spew /tmp/PID$$.log
+	fi
+	echo "abort: $2"
+
+	rm -f /tmp/PID$$.*
+	exit 1
+}
+
+# -------------------------------------------------------------------------
+
+spew="cat"					# default to dumping all make output on failure (-q turns it to ~40 lines)
+
+while [[ $1 == "-"* ]]
+do
+	case $1 in
+		-q) spew="head -40";;
+		-v)	spew="cat";;
+	esac
+
+	shift
+done
+
+make nuke >/dev/null
+make unit_test >/tmp/PID$$.log 2>&1
+abort_if_error $? "unable to make"
+
+spew="cat"
+./unit_test >/tmp/PID$$.log 2>&1
+abort_if_error $? "unit test failed"
+
+gcov unit_test >/tmp/PID$$.gcov_log 2>&1	# suss out our gcov files
+./scrub_gcov.sh								# remove cruft
+
+list=$( mk_list )
+./parse_gcov.sh $list						# generate simple, short, coverage stats
+
+rm -f /tmp/PID$$.*
+