Skip to content

Commit 70ed2ab

Browse files
committed
Add unit test for DB creation with unicode path
An issue arose when attempting to switch back to the main repo version of leveldb when the bitcoin data directory uses a unicode path. The leveldb windows file IO wrapper was using the *A ANSI win32 calls instead of the Unicode *W ones. This unit test will catch if the path created by leveldb doesn't match what we're expecting. For more info see google/leveldb#755.
1 parent 114e89e commit 70ed2ab

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/test/dbwrapper_tests.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,18 @@ BOOST_AUTO_TEST_CASE(iterator_string_ordering)
397397
}
398398
}
399399

400+
BOOST_AUTO_TEST_CASE(unicodepath)
401+
{
402+
// Attempt to create a database with a utf8 character in the path.
403+
// On Windows this test will fail if the directory is created using
404+
// the ANSI CreateDirectoryA call and the code page isn't UTF8.
405+
// It will succeed if the created with CreateDirectoryW.
406+
fs::path ph = GetDataDir() / "test_runner_₿_🏃_20191128_104644";
407+
CDBWrapper dbw(ph, (1 << 20));
408+
409+
fs::path lockPath = ph / "LOCK";
410+
BOOST_CHECK(boost::filesystem::exists(lockPath));
411+
}
400412

401413

402414
BOOST_AUTO_TEST_SUITE_END()

0 commit comments

Comments
 (0)