[OpenWrt-Devel] [PATCH] uci: test: use valgrind to detect memory corruptions

Charlemagne Lasse charlemagnelasse at gmail.com
Fri May 17 02:44:25 PDT 2019


uci is currently a highly problematic software and its library & lua
bindings cannot be used without corrupting or leaking memory in the host
process. Every long running process will suffer. The only way to use it
with an acceptable risk is by using the cli interface which throws its
virtual memory region away after its finished.

To notice such problems faster, start the uci testsuite with the
valgrind memory checker.

Signed-off-by: Charlemagne Lasse <charlemagnelasse at gmail.com>
---
Bug report: https://bugs.openwrt.org/index.php?do=details&task_id=2288

 test/tests.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/test/tests.sh b/test/tests.sh
index ee72c31..5312d41 100644
--- a/test/tests.sh
+++ b/test/tests.sh
@@ -11,8 +11,10 @@ UCI_BIN="../uci"
  echo "uci is not present." >&2
  return 1
 }
-UCI="${UCI_BIN} -c ${CONFIG_DIR} -p ${CHANGES_DIR}"
-UCI_Q="${UCI_BIN} -c ${CONFIG_DIR} -p ${CHANGES_DIR} -q"
+CHECKS="--num-callers=25 --track-origins=yes --leak-check=full"
+VALGRIND="valgrind -q --tool=memcheck --error-exitcode=126 ${CHECKS}"
+UCI="${VALGRIND} ${UCI_BIN} -c ${CONFIG_DIR} -p ${CHANGES_DIR}"
+UCI_Q="${VALGRIND} ${UCI_BIN} -c ${CONFIG_DIR} -p ${CHANGES_DIR} -q"

 REF_DIR="./references"
 SCRIPTS_DIR="./tests.d"
-- 
2.11.0



More information about the openwrt-devel mailing list