Description: Use /usr/bin/trace-cmd in trace-utest if in-tree not build
 This allows us to test the installed package more easily.
Author: Nick Rosbrook <enr0n@ubuntu.com>
Bug-Ubuntu: https://bugs.launchpad.net/bugs/2051850
Last-Update: 2024-04-05
--- a/utest/tracecmd-utest.c
+++ b/utest/tracecmd-utest.c
@@ -469,7 +469,7 @@
 	return 0;
 }
 
-static int test_suite_init(void)
+static int find_in_tree_tracecmd_exec(void)
 {
 	struct stat st;
 	const char *p;
@@ -497,6 +497,14 @@
 	return 0;
 }
 
+static int test_suite_init(void)
+{
+        if (find_in_tree_tracecmd_exec() != 0)
+                strncpy(tracecmd_exec, "/usr/bin/trace-cmd", sizeof(tracecmd_exec));
+
+        return 0;
+}
+
 void test_tracecmd_lib(void)
 {
 	CU_pSuite suite = NULL;
