ART: Fix unused return-value in test
Check the return value of system() call.
Change-Id: I1f5f9621f6a39029b9df5b0d4ab0e230ba6c79a3
diff --git a/compiler/utils/assembler_thumb_test.cc b/compiler/utils/assembler_thumb_test.cc
index 772fa9a..7738627 100644
--- a/compiler/utils/assembler_thumb_test.cc
+++ b/compiler/utils/assembler_thumb_test.cc
@@ -15,9 +15,11 @@
*/
#include <dirent.h>
+#include <errno.h>
#include <fstream>
-#include <sys/types.h>
#include <map>
+#include <string.h>
+#include <sys/types.h>
#include "gtest/gtest.h"
#include "utils/arm/assembler_thumb2.h"
@@ -105,12 +107,14 @@
// Assemble the .S
snprintf(cmd, sizeof(cmd), "%sas %s -o %s.o", toolsdir.c_str(), filename, filename);
- system(cmd);
+ int cmd_result = system(cmd);
+ ASSERT_EQ(cmd_result, 0) << strerror(errno);
// Remove the $d symbols to prevent the disassembler dumping the instructions
// as .word
snprintf(cmd, sizeof(cmd), "%sobjcopy -N '$d' %s.o %s.oo", toolsdir.c_str(), filename, filename);
- system(cmd);
+ int cmd_result2 = system(cmd);
+ ASSERT_EQ(cmd_result2, 0) << strerror(errno);
// Disassemble.
@@ -119,7 +123,8 @@
if (kPrintResults) {
// Print the results only, don't check. This is used to generate new output for inserting
// into the .inc file.
- system(cmd);
+ int cmd_result3 = system(cmd);
+ ASSERT_EQ(cmd_result3, 0) << strerror(errno);
} else {
// Check the results match the appropriate results in the .inc file.
FILE *fp = popen(cmd, "r");