jolly submitted this change.
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
IPAd: Check for memory leaks after each test
After each test, use grep to verify that no pending allocation is left
after the last free() function call.
The built-in memory leak detection will print the current memory useage
to stdout. The last debug message must have an allocation count of 0
bytes.
Related: SYS#8199
Change-Id: Ifd5390ac230b48614585d2820b9133daebd8c321
---
M ipad/IPAd_Tests.ttcn
A ipad/checkleak.sh
M ipad/testenv.cfg
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/ipad/IPAd_Tests.ttcn b/ipad/IPAd_Tests.ttcn
index 4001b68..226c70b 100644
--- a/ipad/IPAd_Tests.ttcn
+++ b/ipad/IPAd_Tests.ttcn
@@ -470,7 +470,7 @@
f_sleep(1.0);
map(self:PIPE, system:PIPE);
f_PIPEasp_exec_async_start(PIPE, "sh", "rm -f nvstate.bin ; " &
- "onomondo-ipa -C example_ca/pki/issued/alttest.cabundle " &
+ "stdbuf -oL -eL onomondo-ipa -C example_ca/pki/issued/alttest.cabundle " &
parameters &
" 2>&1 | tee -i /tmp/single_log >> onomondo-ipa.log");
@@ -483,8 +483,18 @@
/* Stop IPAd, if still running. */
private function f_stop_ipad(charstring parameters := "") runs on IPAd_ConnHdlr {
+ /* Wait for IPAd to terminate, so that the log is complete. */
+ f_sleep(1.0);
+
map(self:PIPE, system:PIPE);
+
+ /* Expect that the last line Terminate iPAd in case it freezes. */
+ log("Finally checking for memory leaks...");
+ f_PIPEasp_exec_sync(PIPE, "sh checkleak.sh", 0);
+
+ /* Terminate iPAd in case it freezes. */
f_PIPEasp_exec_async_stop(PIPE, "onomondo-ipa");
+
unmap(self:PIPE, system:PIPE);
}
diff --git a/ipad/checkleak.sh b/ipad/checkleak.sh
new file mode 100755
index 0000000..2a9b7d7
--- /dev/null
+++ b/ipad/checkleak.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+grep "====> free" onomondo-ipa.log | tail -n 1 | grep " 0 bytes total"
diff --git a/ipad/testenv.cfg b/ipad/testenv.cfg
index dfec811..98a2fee 100644
--- a/ipad/testenv.cfg
+++ b/ipad/testenv.cfg
@@ -1,7 +1,7 @@
[testsuite]
program=IPAd_Tests
config=IPAd_Tests.cfg
-copy=example_ca
+copy=example_ca checkleak.sh
[pcscd]
prepare=require_vsmartcard_vpcd.sh
To view, visit change 43622. To unsubscribe, or for help writing mail filters, visit settings.