qahw_api: test: Handle SIGTERM signal in test app

Handle SIGTERM signal in test app if user kills the test app.

Change-Id: I1eaff7189e10d86e93e35bbe8e592271ef922148
diff --git a/qahw_api/test/qahw_multi_record_test.c b/qahw_api/test/qahw_multi_record_test.c
index ed8fe40..3421ac0 100644
--- a/qahw_api/test/qahw_multi_record_test.c
+++ b/qahw_api/test/qahw_multi_record_test.c
@@ -846,7 +846,11 @@
 
     /* Register the SIGINT to close the App properly */
     if (signal(SIGINT, stop_signal_handler) == SIG_ERR)
-        fprintf(log_file, "Failed to register SIGINT:%d\n",errno);
+        fprintf(log_file, "Failed to register SIGINT:%d\n", errno);
+
+    /* Register the SIGTERM to close the App properly */
+    if (signal(SIGTERM, stop_signal_handler) == SIG_ERR)
+        fprintf(log_file, "Failed to register SIGTERM:%d\n", errno);
 
     for (i = 0; i < MAX_RECORD_SESSIONS; i++) {
         if (thread_active[i] == 1) {
diff --git a/qahw_api/test/qahw_playback_test.c b/qahw_api/test/qahw_playback_test.c
index 3ce01ef..8834252 100644
--- a/qahw_api/test/qahw_playback_test.c
+++ b/qahw_api/test/qahw_playback_test.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
  * Not a Contribution.
  *
  * Copyright (C) 2015 The Android Open Source Project *
@@ -2403,8 +2403,14 @@
 
     /* Register the SIGINT to close the App properly */
     if (signal(SIGINT, stop_signal_handler) == SIG_ERR) {
-        fprintf(log_file, "Failed to register SIGINT:%d\n",errno);
-        fprintf(stderr, "Failed to register SIGINT:%d\n",errno);
+        fprintf(log_file, "Failed to register SIGINT:%d\n", errno);
+        fprintf(stderr, "Failed to register SIGINT:%d\n", errno);
+    }
+
+    /* Register the SIGTERM to close the App properly */
+    if (signal(SIGTERM, stop_signal_handler) == SIG_ERR) {
+        fprintf(log_file, "Failed to register SIGTERM:%d\n", errno);
+        fprintf(stderr, "Failed to register SIGTERM:%d\n", errno);
     }
 
     /* Check for Dual main content */