Add big-endian data file for LMDB dataset tests

This commit is contained in:
Fred Reiss 2019-08-12 14:50:33 -07:00
parent d1002d97ef
commit d0ed82209b
3 changed files with 13 additions and 1 deletions

View File

@ -20,6 +20,7 @@ from __future__ import print_function
import os
import shutil
import sys
from tensorflow.contrib.data.python.ops import readers
from tensorflow.python.data.kernel_tests import test_base
@ -40,7 +41,10 @@ class LMDBDatasetTest(test_base.DatasetTestBase):
def setUp(self):
super(LMDBDatasetTest, self).setUp()
# Copy database out because we need the path to be writable to use locks.
path = os.path.join(prefix_path, "lmdb", "testdata", "data.mdb")
# The on-disk format of an LMDB database is different on big-endian
# machines, because LMDB is a memory-mapped database.
db_file = "data.mdb" if sys.byteorder == "little" else "data_bigendian.mdb"
path = os.path.join(prefix_path, "lmdb", "testdata", db_file)
self.db_path = os.path.join(self.get_temp_dir(), "data.mdb")
shutil.copy(path, self.db_path)

View File

@ -5512,11 +5512,19 @@ filegroup(
testonly = 1,
srcs = [
# A simple key-value store:
# 0 : 'b'
# 1 : 'b'
# ...
# 9 : 'b'
# Which is then overwritten with:
# 0 : 'a'
# 1 : 'b'
# ...
# 9 : 'j'
"lib/lmdb/testdata/data.mdb",
# LMDB, being a memory-mapped database, uses a different file format on
# big-endian systems.
"lib/lmdb/testdata/data_bigendian.mdb",
],
visibility = ["//visibility:public"],
)

Binary file not shown.