Update hash and VTS for the 2nd FD of dumpstate
Bug: 33820081
Test: Run VTS
Change-Id: I139dfed6edb20fada2676684ab7013daefa69bc8
diff --git a/dumpstate/1.0/vts/functional/VtsHalDumpstateV1_0TargetTest.cpp b/dumpstate/1.0/vts/functional/VtsHalDumpstateV1_0TargetTest.cpp
index 7ab4812..046bf56 100644
--- a/dumpstate/1.0/vts/functional/VtsHalDumpstateV1_0TargetTest.cpp
+++ b/dumpstate/1.0/vts/functional/VtsHalDumpstateV1_0TargetTest.cpp
@@ -59,6 +59,7 @@
// Positive test: make sure dumpstateBoard() writes something to the FD.
TEST_F(DumpstateHidlTest, TestOk) {
FILE* file = tmpfile();
+
ASSERT_NE(nullptr, file) << "Could not create temp file: " << strerror(errno);
native_handle_t* handle = native_handle_create(1, 0);
@@ -80,6 +81,29 @@
native_handle_delete(handle);
}
+// Positive test: make sure dumpstateBoard() doesn't crash with two FDs.
+TEST_F(DumpstateHidlTest, TestHandleWithTwoFds) {
+ FILE* file1 = tmpfile();
+ FILE* file2 = tmpfile();
+
+ ASSERT_NE(nullptr, file1) << "Could not create temp file #1: " << strerror(errno);
+ ASSERT_NE(nullptr, file2) << "Could not create temp file #2: " << strerror(errno);
+
+ native_handle_t* handle = native_handle_create(2, 0);
+ ASSERT_NE(handle, nullptr) << "Could not create native_handle";
+ handle->data[0] = fileno(file1);
+ handle->data[1] = fileno(file2);
+
+ Return<void> status = dumpstate->dumpstateBoard(handle);
+ ASSERT_TRUE(status.isOk()) << "Status should be ok: " << status.description();
+
+ EXPECT_EQ(0, fclose(file1)) << errno;
+ EXPECT_EQ(0, fclose(file2)) << errno;
+
+ native_handle_close(handle);
+ native_handle_delete(handle);
+}
+
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
int status = RUN_ALL_TESTS();