Commit ac5b4307 authored by sbc's avatar sbc Committed by Commit bot

[NaCl SDK] Fix mysterious gtest failure in Html5FsTest::OpenForCreate

The failure seems to have been triggered from the recent
gtest update.  The exact revision seems to be:
https://code.google.com/p/googletest/source/detail?r=693

The issue only effects builds made with our older
gcc 4.4 toolchain. Neither asan nor valgrind report any
issues with the linux run of this test, and PNaCl build
also passes just fine so I'm assuming is a compiler bug
in the older toolchain.

The fix I found was to use "const char*" over "char []"
for local string constants.  In fact just adding a const
alone and leaving the [] syntax also fixes the issue.

Most likely there is an underlying compiler bug that
still needs to be addressed.

BUG=434821

Review URL: https://codereview.chromium.org/740023002

Cr-Commit-Position: refs/heads/master@{#304959}
parent 99083799
...@@ -251,9 +251,9 @@ TEST_F(Html5FsTest, OpenForCreate) { ...@@ -251,9 +251,9 @@ TEST_F(Html5FsTest, OpenForCreate) {
ASSERT_EQ(0, fs->Open(path, O_CREAT | O_RDWR, &node)); ASSERT_EQ(0, fs->Open(path, O_CREAT | O_RDWR, &node));
// Write some data. // Write some data.
char contents[] = "contents"; const char* contents = "contents";
int bytes_written = 0; int bytes_written = 0;
EXPECT_EQ(0, node->Write(HandleAttr(), &contents[0], strlen(contents), EXPECT_EQ(0, node->Write(HandleAttr(), contents, strlen(contents),
&bytes_written)); &bytes_written));
EXPECT_EQ(strlen(contents), bytes_written); EXPECT_EQ(strlen(contents), bytes_written);
...@@ -280,7 +280,7 @@ TEST_F(Html5FsTest, OpenForCreate) { ...@@ -280,7 +280,7 @@ TEST_F(Html5FsTest, OpenForCreate) {
} }
TEST_F(Html5FsTest, Read) { TEST_F(Html5FsTest, Read) {
const char contents[] = "contents"; const char* contents = "contents";
ASSERT_TRUE( ASSERT_TRUE(
ppapi_html5_.filesystem_template()->AddFile("/file", contents, NULL)); ppapi_html5_.filesystem_template()->AddFile("/file", contents, NULL));
ASSERT_TRUE(ppapi_html5_.filesystem_template()->AddDirectory("/dir", NULL)); ASSERT_TRUE(ppapi_html5_.filesystem_template()->AddDirectory("/dir", NULL));
...@@ -322,7 +322,7 @@ TEST_F(Html5FsTest, Read) { ...@@ -322,7 +322,7 @@ TEST_F(Html5FsTest, Read) {
} }
TEST_F(Html5FsTest, Write) { TEST_F(Html5FsTest, Write) {
const char contents[] = "contents"; const char* contents = "contents";
EXPECT_TRUE( EXPECT_TRUE(
ppapi_html5_.filesystem_template()->AddFile("/file", contents, NULL)); ppapi_html5_.filesystem_template()->AddFile("/file", contents, NULL));
EXPECT_TRUE(ppapi_html5_.filesystem_template()->AddDirectory("/dir", NULL)); EXPECT_TRUE(ppapi_html5_.filesystem_template()->AddDirectory("/dir", NULL));
...@@ -363,7 +363,7 @@ TEST_F(Html5FsTest, GetStat) { ...@@ -363,7 +363,7 @@ TEST_F(Html5FsTest, GetStat) {
const int creation_time = 1000; const int creation_time = 1000;
const int access_time = 2000; const int access_time = 2000;
const int modified_time = 3000; const int modified_time = 3000;
const char contents[] = "contents"; const char* contents = "contents";
// Create fake file. // Create fake file.
FakeHtml5FsNode* fake_node; FakeHtml5FsNode* fake_node;
...@@ -422,7 +422,7 @@ TEST_F(Html5FsTest, GetStat) { ...@@ -422,7 +422,7 @@ TEST_F(Html5FsTest, GetStat) {
} }
TEST_F(Html5FsTest, FTruncate) { TEST_F(Html5FsTest, FTruncate) {
const char contents[] = "contents"; const char* contents = "contents";
EXPECT_TRUE( EXPECT_TRUE(
ppapi_html5_.filesystem_template()->AddFile("/file", contents, NULL)); ppapi_html5_.filesystem_template()->AddFile("/file", contents, NULL));
EXPECT_TRUE(ppapi_html5_.filesystem_template()->AddDirectory("/dir", NULL)); EXPECT_TRUE(ppapi_html5_.filesystem_template()->AddDirectory("/dir", NULL));
...@@ -465,7 +465,7 @@ TEST_F(Html5FsTest, Chmod) { ...@@ -465,7 +465,7 @@ TEST_F(Html5FsTest, Chmod) {
} }
TEST_F(Html5FsTest, GetDents) { TEST_F(Html5FsTest, GetDents) {
const char contents[] = "contents"; const char* contents = "contents";
EXPECT_TRUE( EXPECT_TRUE(
ppapi_html5_.filesystem_template()->AddFile("/file", contents, NULL)); ppapi_html5_.filesystem_template()->AddFile("/file", contents, NULL));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment