summaryrefslogtreecommitdiffstats
path: root/native_client_sdk
diff options
context:
space:
mode:
authorbinji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-05 01:46:49 +0000
committerbinji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-05 01:46:49 +0000
commit13c49f23885aa2bb2f030fab9aa57a3ef89ea86e (patch)
treed88a04e9879a4b5eb56bfcd790c8c85b45bdd116 /native_client_sdk
parent223059e4eda6f1a8cd341f1ccecaece90b9132f6 (diff)
downloadchromium_src-13c49f23885aa2bb2f030fab9aa57a3ef89ea86e.zip
chromium_src-13c49f23885aa2bb2f030fab9aa57a3ef89ea86e.tar.gz
chromium_src-13c49f23885aa2bb2f030fab9aa57a3ef89ea86e.tar.bz2
[NaCl SDK] Build nacl_mounts_test without experimental.
BUG=122229 NOTRY=true Review URL: https://chromiumcodereview.appspot.com/10860077 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@160293 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk')
-rwxr-xr-xnative_client_sdk/src/build_tools/build_sdk.py36
-rwxr-xr-xnative_client_sdk/src/build_tools/generate_make.py13
-rwxr-xr-xnative_client_sdk/src/build_tools/make_rules.py14
-rw-r--r--native_client_sdk/src/libraries/gtest/library.dsc2
-rw-r--r--native_client_sdk/src/libraries/gtest_ppapi/library.dsc2
-rw-r--r--native_client_sdk/src/libraries/nacl_mounts/kernel_intercept.cc12
-rw-r--r--native_client_sdk/src/libraries/nacl_mounts/kernel_intercept.h3
-rw-r--r--native_client_sdk/src/libraries/nacl_mounts/library.dsc1
-rw-r--r--native_client_sdk/src/libraries/nacl_mounts_test/example.dsc16
-rw-r--r--native_client_sdk/src/libraries/nacl_mounts_test/example.js15
-rw-r--r--native_client_sdk/src/libraries/nacl_mounts_test/index.html23
-rw-r--r--native_client_sdk/src/libraries/nacl_mounts_test/kernel_intercept_test.cc56
-rw-r--r--native_client_sdk/src/libraries/nacl_mounts_test/mount_node_test.cc22
-rw-r--r--native_client_sdk/src/libraries/nacl_mounts_test/nacl_mounts_test.vcproj202
-rw-r--r--native_client_sdk/src/libraries/nacl_mounts_test/path_test.cc42
-rw-r--r--native_client_sdk/src/libraries/nacl_mounts_test/test.cc12
16 files changed, 165 insertions, 306 deletions
diff --git a/native_client_sdk/src/build_tools/build_sdk.py b/native_client_sdk/src/build_tools/build_sdk.py
index 14890bf..c20f0a5 100755
--- a/native_client_sdk/src/build_tools/build_sdk.py
+++ b/native_client_sdk/src/build_tools/build_sdk.py
@@ -584,6 +584,16 @@ LIB_DICT = {
'win': ['x86_32']
}
+
+def MakeDirectoryOrClobber(pepperdir, dirname, clobber):
+ dirpath = os.path.join(pepperdir, dirname)
+ if clobber:
+ buildbot_common.RemoveDir(dirpath)
+ buildbot_common.MakeDir(dirpath)
+
+ return dirpath
+
+
def BuildStepCopyExamples(pepperdir, toolchains, build_experimental, clobber):
buildbot_common.BuildStep('Copy examples')
@@ -592,15 +602,8 @@ def BuildStepCopyExamples(pepperdir, toolchains, build_experimental, clobber):
if not os.path.exists(os.path.join(pepperdir, 'toolchain')):
buildbot_common.ErrorExit('Examples depend on missing toolchains.')
- exampledir = os.path.join(pepperdir, 'examples')
- if clobber:
- buildbot_common.RemoveDir(exampledir)
- buildbot_common.MakeDir(exampledir)
-
- libdir = os.path.join(pepperdir, 'lib')
- if clobber:
- buildbot_common.RemoveDir(libdir)
- buildbot_common.MakeDir(libdir)
+ exampledir = MakeDirectoryOrClobber(pepperdir, 'examples', clobber)
+ libdir = MakeDirectoryOrClobber(pepperdir, 'lib', clobber)
plat = getos.GetPlatform()
for arch in LIB_DICT[plat]:
@@ -614,11 +617,7 @@ def BuildStepCopyExamples(pepperdir, toolchains, build_experimental, clobber):
config))
- srcdir = os.path.join(pepperdir, 'src')
- if clobber:
- buildbot_common.RemoveDir(srcdir)
- buildbot_common.MakeDir(srcdir)
-
+ MakeDirectoryOrClobber(pepperdir, 'src', clobber)
# Copy individual files
files = ['favicon.ico', 'httpd.cmd', 'httpd.py', 'index.html']
@@ -792,10 +791,8 @@ TEST_LIBRARY_LIST = [
def BuildStepCopyTests(pepperdir, toolchains, build_experimental, clobber):
buildbot_common.BuildStep('Copy Tests')
- testingdir = os.path.join(pepperdir, 'testing')
- if clobber:
- buildbot_common.RemoveDir(testingdir)
- buildbot_common.MakeDir(testingdir)
+ MakeDirectoryOrClobber(pepperdir, 'testlibs', clobber)
+ MakeDirectoryOrClobber(pepperdir, 'tests', clobber)
args = ['--dstroot=%s' % pepperdir, '--master']
for toolchain in toolchains:
@@ -817,7 +814,8 @@ def BuildStepCopyTests(pepperdir, toolchains, build_experimental, clobber):
def BuildStepBuildTests(pepperdir, platform):
- BuildStepMakeAll(pepperdir, platform, 'testing', 'Build Tests')
+ BuildStepMakeAll(pepperdir, platform, 'testlibs', 'Build Test Libraries')
+ BuildStepMakeAll(pepperdir, platform, 'tests', 'Build Tests')
def BuildStepRunPyautoTests(pepperdir, platform, pepper_ver):
diff --git a/native_client_sdk/src/build_tools/generate_make.py b/native_client_sdk/src/build_tools/generate_make.py
index 0ba4098..1a6c8b0 100755
--- a/native_client_sdk/src/build_tools/generate_make.py
+++ b/native_client_sdk/src/build_tools/generate_make.py
@@ -37,6 +37,10 @@ def WriteReplaced(srcpath, dstpath, replacements):
open(dstpath, 'wb').write(text)
+def ShouldProcessHTML(desc):
+ return desc['DEST'] in ('examples', 'tests')
+
+
def GenerateSourceCopyList(desc):
sources = []
# Add sources for each target
@@ -46,7 +50,7 @@ def GenerateSourceCopyList(desc):
# And HTML and data files
sources.extend(desc.get('DATA', []))
- if desc['DEST'] == 'examples':
+ if ShouldProcessHTML(desc):
sources.append('common.js')
return sources
@@ -214,7 +218,7 @@ DSC_FORMAT = {
'SEARCH': (list, '', False),
'POST': (str, '', False),
'PRE': (str, '', False),
- 'DEST': (str, ['examples', 'src', 'testing'], True),
+ 'DEST': (str, ['examples', 'src', 'testlibs', 'tests'], True),
'NAME': (str, '', False),
'DATA': (list, '', False),
'TITLE': (str, '', False),
@@ -415,8 +419,7 @@ def FindAndCopyFiles(src_files, root, search_dirs, dst_dir):
for src_name in src_files:
src_file = FindFile(src_name, root, search_dirs)
if not src_file:
- ErrorMsgFunc('Failed to find: ' + src_name)
- return None
+ ErrorExit('Failed to find: ' + src_name)
dst_file = os.path.join(dst_dir, src_name)
if os.path.exists(dst_file):
if os.stat(src_file).st_mtime <= os.stat(dst_file).st_mtime:
@@ -576,7 +579,7 @@ def main(argv):
ErrorExit('\n*** Failed to process project: %s ***' % filename)
# if this is an example update the html
- if desc['DEST'] == 'examples':
+ if ShouldProcessHTML(desc):
ProcessHTML(srcroot, options.dstroot, desc, toolchains)
# Create a list of projects for each DEST. This will be used to generate a
diff --git a/native_client_sdk/src/build_tools/make_rules.py b/native_client_sdk/src/build_tools/make_rules.py
index d72fa64..02752dc 100755
--- a/native_client_sdk/src/build_tools/make_rules.py
+++ b/native_client_sdk/src/build_tools/make_rules.py
@@ -47,7 +47,7 @@ TRANSLATE:=$(TC_PATH)/$(OSNAME)_x86_pnacl/newlib/bin/pnacl-translate
LINUX_DEFAULTS = """
LINUX_CC?=gcc -c
LINUX_CXX?=g++ -c -std=gnu++98
-LINUX_LINK?=g++ -shared -Wl,-as-needed
+LINUX_LINK?=g++
LINUX_LIB?=ar r
LINUX_CCFLAGS=-I$(NACL_SDK_ROOT)/include -I$(NACL_SDK_ROOT)/include/linux
"""
@@ -82,18 +82,18 @@ WIN_CC_RULES = {
# Link rules for various platforms.
#
NEXE_LINK_RULES = {
- 'Debug': '<TAB>$(<LINK>) -o $@ $^ -g <MACH> $(<TC>_LDFLAGS) $(<PROJ>_LDFLAGS) -L$(NACL_SDK_ROOT)/lib/$(OSNAME)_<ARCH>_<tc>/<config> <LIBLIST>',
- 'Release': '<TAB>$(<LINK>) -o $@ $^ <MACH> $(<TC>_LDFLAGS) $(<PROJ>_LDFLAGS) -L$(NACL_SDK_ROOT)/lib/$(OSNAME)_<ARCH>_<tc>/<config> <LIBLIST>'
+ 'Debug': '<TAB>$(<LINK>) -o $@ $^ -g <MACH> $(<TC>_LDFLAGS) $(<PROJ>_LDFLAGS) -L$(NACL_SDK_ROOT)/lib/$(OSNAME)_<ARCH>_<tc>/<config> -Wl,--start-group <LIBLIST> -Wl,--end-group',
+ 'Release': '<TAB>$(<LINK>) -o $@ $^ <MACH> $(<TC>_LDFLAGS) $(<PROJ>_LDFLAGS) -L$(NACL_SDK_ROOT)/lib/$(OSNAME)_<ARCH>_<tc>/<config> -Wl,--start-group <LIBLIST> -Wl,--end-group'
}
SO_LINK_RULES = {
- 'Debug': '<TAB>$(<LINK>) -o $@ $^ -g <MACH> -shared $(<PROJ>_LDFLAGS) -L$(NACL_SDK_ROOT)/lib/$(OSNAME)_<ARCH>_<tcname>/<config> <LIBLIST>',
- 'Release': '<TAB>$(<LINK>) -o $@ $^ <MACH> -shared $(<PROJ>_LDFLAGS) -L$(NACL_SDK_ROOT)/lib/$(OSNAME)_<ARCH>_<tcname>/<config> <LIBLIST>',
+ 'Debug': '<TAB>$(<LINK>) -o $@ $^ -g <MACH> -shared $(<PROJ>_LDFLAGS) -L$(NACL_SDK_ROOT)/lib/$(OSNAME)_<ARCH>_<tcname>/<config>',
+ 'Release': '<TAB>$(<LINK>) -o $@ $^ <MACH> -shared $(<PROJ>_LDFLAGS) -L$(NACL_SDK_ROOT)/lib/$(OSNAME)_<ARCH>_<tcname>/<config>',
}
LINUX_SO_LINK_RULES = {
- 'Debug': '<TAB>$(<LINK>) -o $@ $^ -g <MACH> -shared $(<PROJ>_LDFLAGS) -L$(NACL_SDK_ROOT)/lib/$(OSNAME)_<tcname>/<config> <LIBLIST>',
- 'Release': '<TAB>$(<LINK>) -o $@ $^ <MACH> -shared $(<PROJ>_LDFLAGS) -L$(NACL_SDK_ROOT)/lib/$(OSNAME)_<tcname>/<config> <LIBLIST>',
+ 'Debug': '<TAB>$(<LINK>) -o $@ $^ -g <MACH> -shared $(<PROJ>_LDFLAGS) -L$(NACL_SDK_ROOT)/lib/$(OSNAME)_<tcname>/<config> -Wl,--whole-archive <LIBLIST> -Wl,--no-whole-archive',
+ 'Release': '<TAB>$(<LINK>) -o $@ $^ <MACH> -shared $(<PROJ>_LDFLAGS) -L$(NACL_SDK_ROOT)/lib/$(OSNAME)_<tcname>/<config> -Wl,--whole-archive <LIBLIST> -Wl,--no-whole-archive',
}
PEXE_TRANSLATE_RULE = """
diff --git a/native_client_sdk/src/libraries/gtest/library.dsc b/native_client_sdk/src/libraries/gtest/library.dsc
index d89883c..0660b7c 100644
--- a/native_client_sdk/src/libraries/gtest/library.dsc
+++ b/native_client_sdk/src/libraries/gtest/library.dsc
@@ -82,6 +82,6 @@
'DEST': 'include/gtest/internal/src',
},
],
- 'DEST': 'testing',
+ 'DEST': 'testlibs',
'NAME': 'gtest',
}
diff --git a/native_client_sdk/src/libraries/gtest_ppapi/library.dsc b/native_client_sdk/src/libraries/gtest_ppapi/library.dsc
index cfc5f10..6ab61c8 100644
--- a/native_client_sdk/src/libraries/gtest_ppapi/library.dsc
+++ b/native_client_sdk/src/libraries/gtest_ppapi/library.dsc
@@ -27,6 +27,6 @@
'DEST': 'include/gtest_ppapi',
},
],
- 'DEST': 'testing',
+ 'DEST': 'testlibs',
'NAME': 'gtest_ppapi',
}
diff --git a/native_client_sdk/src/libraries/nacl_mounts/kernel_intercept.cc b/native_client_sdk/src/libraries/nacl_mounts/kernel_intercept.cc
index 6550d7b..d8526e8 100644
--- a/native_client_sdk/src/libraries/nacl_mounts/kernel_intercept.cc
+++ b/native_client_sdk/src/libraries/nacl_mounts/kernel_intercept.cc
@@ -84,3 +84,15 @@ int ki_isatty(int fd) {
int ki_close(int fd) {
return s_kp->close(fd);
}
+
+int ki_remove(const char* path) {
+ return s_kp->remove(path);
+}
+
+int ki_unlink(const char* path) {
+ return s_kp->unlink(path);
+}
+
+int ki_access(const char* path, int amode) {
+ return s_kp->access(path, amode);
+}
diff --git a/native_client_sdk/src/libraries/nacl_mounts/kernel_intercept.h b/native_client_sdk/src/libraries/nacl_mounts/kernel_intercept.h
index 8333562..6dee717 100644
--- a/native_client_sdk/src/libraries/nacl_mounts/kernel_intercept.h
+++ b/native_client_sdk/src/libraries/nacl_mounts/kernel_intercept.h
@@ -37,6 +37,9 @@ int ki_getdents(int fd, void* buf, unsigned int count);
int ki_fsync(int fd);
int ki_isatty(int fd);
int ki_close(int fd);
+int ki_remove(const char* path);
+int ki_unlink(const char* path);
+int ki_access(const char* path, int amode);
EXTERN_C_END
diff --git a/native_client_sdk/src/libraries/nacl_mounts/library.dsc b/native_client_sdk/src/libraries/nacl_mounts/library.dsc
index 61c25a2..379f1fd 100644
--- a/native_client_sdk/src/libraries/nacl_mounts/library.dsc
+++ b/native_client_sdk/src/libraries/nacl_mounts/library.dsc
@@ -52,5 +52,4 @@
],
'DEST': 'src',
'NAME': 'nacl_mounts',
- 'EXPERIMENTAL': True
}
diff --git a/native_client_sdk/src/libraries/nacl_mounts_test/example.dsc b/native_client_sdk/src/libraries/nacl_mounts_test/example.dsc
index 7db3e8d..1260c30 100644
--- a/native_client_sdk/src/libraries/nacl_mounts_test/example.dsc
+++ b/native_client_sdk/src/libraries/nacl_mounts_test/example.dsc
@@ -1,5 +1,9 @@
{
- 'TOOLS': ['newlib', 'glibc', 'pnacl', 'win'],
+ # TODO(binji): pnacl doesn't build right now because gtest doesn't build yet.
+ 'TOOLS': ['newlib', 'glibc', 'win', 'linux'],
+
+ # Need to add ../../examples for common.js
+ 'SEARCH': ['.', '../../examples'],
'TARGETS': [
{
'NAME' : 'nacl_mounts_test',
@@ -11,12 +15,14 @@
'mount_node_test.cc',
'mount_test.cc',
'path_test.cc',
- 'test.cc',
],
- 'LIBS': ['ppapi', 'pthread', 'gtest', 'nacl_mounts']
+ 'LIBS': ['ppapi', 'pthread', 'gtest', 'nacl_mounts', 'ppapi_cpp', 'gtest_ppapi']
}
],
- 'DEST': 'testing',
+ 'DATA': [
+ 'example.js'
+ ],
+ 'DEST': 'tests',
'NAME': 'nacl_mounts_test',
- 'EXPERIMENTAL': True,
+ 'TITLE': 'NaCl Mounts test',
}
diff --git a/native_client_sdk/src/libraries/nacl_mounts_test/example.js b/native_client_sdk/src/libraries/nacl_mounts_test/example.js
new file mode 100644
index 0000000..4e7cb0a
--- /dev/null
+++ b/native_client_sdk/src/libraries/nacl_mounts_test/example.js
@@ -0,0 +1,15 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+// Called by the common.js module.
+function moduleDidLoad() {
+ // The module is not hidden by default so we can easily see if the plugin
+ // failed to load.
+ common.hideModule();
+ common.naclModule.postMessage('RunGTest');
+}
+
+function handleMessage(event) {
+ var logEl = document.getElementById('log');
+ logEl.innerHTML += event.data + '<br>';
+}
diff --git a/native_client_sdk/src/libraries/nacl_mounts_test/index.html b/native_client_sdk/src/libraries/nacl_mounts_test/index.html
new file mode 100644
index 0000000..5d2cf08
--- /dev/null
+++ b/native_client_sdk/src/libraries/nacl_mounts_test/index.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<!--
+Copyright (c) 2012 The Chromium Authors. All rights reserved.
+Use of this source code is governed by a BSD-style license that can be
+found in the LICENSE file.
+-->
+<head>
+ <meta http-equiv="Pragma" content="no-cache">
+ <meta http-equiv="Expires" content="-1">
+ <title><TITLE></title>
+ <script type="text/javascript" src="common.js"></script>
+ <script type="text/javascript" src="example.js"></script>
+</head>
+<body data-name="<NAME>" data-tc="<tc>" data-path="<path>">
+ <h1><TITLE></h1>
+ <h2>Status: <code id="statusField">NO-STATUS</code></h2>
+ <!-- The NaCl plugin will be embedded inside the element with id "listener".
+ See common.js.-->
+ <div id="listener"></div>
+ <div id="log"></div>
+</body>
+</html>
diff --git a/native_client_sdk/src/libraries/nacl_mounts_test/kernel_intercept_test.cc b/native_client_sdk/src/libraries/nacl_mounts_test/kernel_intercept_test.cc
index 494db2f..3b6657a 100644
--- a/native_client_sdk/src/libraries/nacl_mounts_test/kernel_intercept_test.cc
+++ b/native_client_sdk/src/libraries/nacl_mounts_test/kernel_intercept_test.cc
@@ -20,92 +20,92 @@ class KernelProxyMock : public KernelProxy {
KernelProxyMock() {}
virtual ~KernelProxyMock() {}
- int chdir(const char* path) {
+ virtual int chdir(const char* path) {
events.push_back("chdir");
return 0;
}
- char* getcwd(char* buf, size_t size) {
+ virtual char* getcwd(char* buf, size_t size) {
events.push_back("getcwd");
return buf;
}
- char* getwd(char* buf) {
+ virtual char* getwd(char* buf) {
events.push_back("getwd");
return buf;
}
- int dup(int oldfd) {
+ virtual int dup(int oldfd) {
events.push_back("dup");
return oldfd;
}
- int chmod(const char *path, mode_t mode) {
+ virtual int chmod(const char *path, mode_t mode) {
events.push_back("chmod");
return 0;
}
- int stat(const char *path, struct stat *buf) {
+ virtual int stat(const char *path, struct stat *buf) {
events.push_back("stat");
return 0;
}
- int mkdir(const char *path, mode_t mode) {
+ virtual int mkdir(const char *path, mode_t mode) {
events.push_back("mkdir");
return 0;
}
- int rmdir(const char *path) {
+ virtual int rmdir(const char *path) {
events.push_back("rmdir");
return 0;
}
- int mount(const char *source, const char *target,
+ virtual int mount(const char *source, const char *target,
const char *filesystemtype, unsigned long mountflags, const void *data) {
events.push_back("mount");
return 0;
}
- int umount(const char *path) {
+ virtual int umount(const char *path) {
events.push_back("umount");
return 0;
}
- int open(const char *path, int oflag) {
+ virtual int open(const char *path, int oflag) {
events.push_back("open");
return 0;
}
- ssize_t read(int fd, void *buf, size_t nbyte) {
+ virtual ssize_t read(int fd, void *buf, size_t nbyte) {
events.push_back("read");
return 0;
}
- ssize_t write(int fd, const void *buf, size_t nbyte) {
+ virtual ssize_t write(int fd, const void *buf, size_t nbyte) {
events.push_back("write");
return 0;
}
- int fstat(int fd, struct stat *buf) {
+ virtual int fstat(int fd, struct stat *buf) {
events.push_back("fstat");
return 0;
}
- int getdents(int fd, void *buf, unsigned int count) {
+ virtual int getdents(int fd, void *buf, unsigned int count) {
events.push_back("getdents");
return 0;
}
- int fsync(int fd) {
+ virtual int fsync(int fd) {
events.push_back("fsync");
return 0;
}
- int isatty(int fd) {
+ virtual int isatty(int fd) {
events.push_back("isatty");
return 0;
}
- int close(int fd) {
+ virtual int close(int fd) {
events.push_back("close");
return 0;
}
- off_t lseek(int fd, off_t offset, int whence) {
+ virtual off_t lseek(int fd, off_t offset, int whence) {
events.push_back("lseek");
return 0;
}
- int remove(const std::string& path) {
+ virtual int remove(const char* path) {
events.push_back("remove");
return 0;
}
- int unlink(const std::string& path) {
+ virtual int unlink(const char* path) {
events.push_back("unlink");
return 0;
}
- int access(const std::string& path, int amode) {
+ virtual int access(const char* path, int amode) {
events.push_back("access");
return 0;
}
@@ -136,7 +136,7 @@ TEST(KernelIntercept, SanityChecks) {
ki_dup(1);
EXPECT_EQ("dup", mock->LastStr());
- ki_chmod("foo", NULL);
+ ki_chmod("foo", 0);
EXPECT_EQ("chmod", mock->LastStr());
ki_stat("foo", NULL);
@@ -177,5 +177,13 @@ TEST(KernelIntercept, SanityChecks) {
ki_close(1);
EXPECT_EQ("close", mock->LastStr());
-}
+ ki_remove("foo");
+ EXPECT_EQ("fsync", mock->LastStr());
+
+ ki_unlink("foo");
+ EXPECT_EQ("isatty", mock->LastStr());
+
+ ki_access("foo", 0);
+ EXPECT_EQ("close", mock->LastStr());
+}
diff --git a/native_client_sdk/src/libraries/nacl_mounts_test/mount_node_test.cc b/native_client_sdk/src/libraries/nacl_mounts_test/mount_node_test.cc
index 3994b9d..76eb978 100644
--- a/native_client_sdk/src/libraries/nacl_mounts_test/mount_node_test.cc
+++ b/native_client_sdk/src/libraries/nacl_mounts_test/mount_node_test.cc
@@ -42,6 +42,9 @@ class MockMemory : public MountNodeMem {
}
void Link() { MountNodeMem::Link(); }
void Unlink() { MountNodeMem::Unlink(); }
+
+ protected:
+ using MountNodeMem::Init;
};
class MockDir : public MountNodeDir {
@@ -68,20 +71,23 @@ class MockDir : public MountNodeDir {
}
void Link() { MountNodeDir::Link(); }
void Unlink() { MountNodeDir::Unlink(); }
+
+ protected:
+ using MountNodeDir::Init;
};
TEST(MountNodeTest, File) {
MockMemory *file = new MockMemory;
- EXPECT_EQ(true, file->Init(S_IREAD | S_IWRITE));
+ EXPECT_TRUE(file->Init(S_IREAD | S_IWRITE));
// Test properties
EXPECT_EQ(0, file->GetLinks());
EXPECT_EQ(S_IREAD | S_IWRITE, file->GetMode());
EXPECT_EQ(S_IFREG, file->GetType());
- EXPECT_EQ(false, file->IsaDir());
- EXPECT_EQ(true, file->IsaFile());
- EXPECT_EQ(false, file->IsaTTY());
+ EXPECT_FALSE(file->IsaDir());
+ EXPECT_TRUE(file->IsaFile());
+ EXPECT_FALSE(file->IsaTTY());
EXPECT_EQ(1, file->RefCount());
// Test IO
@@ -125,9 +131,9 @@ TEST(MountNodeTest, Directory) {
EXPECT_EQ(0, root->GetLinks());
EXPECT_EQ(S_IREAD | S_IWRITE, root->GetMode());
EXPECT_EQ(S_IFDIR, root->GetType());
- EXPECT_EQ(true, root->IsaDir());
- EXPECT_EQ(false, root->IsaFile());
- EXPECT_EQ(false, root->IsaTTY());
+ EXPECT_TRUE(root->IsaDir());
+ EXPECT_FALSE(root->IsaFile());
+ EXPECT_FALSE(root->IsaTTY());
EXPECT_EQ(1, root->RefCount());
// IO operations should fail
@@ -140,7 +146,7 @@ TEST(MountNodeTest, Directory) {
// Test directory operations
MockMemory* file = new MockMemory;
- EXPECT_EQ(true, file->Init(S_IREAD | S_IWRITE));
+ EXPECT_TRUE(file->Init(S_IREAD | S_IWRITE));
EXPECT_EQ(1, root->RefCount());
EXPECT_EQ(1, file->RefCount());
diff --git a/native_client_sdk/src/libraries/nacl_mounts_test/nacl_mounts_test.vcproj b/native_client_sdk/src/libraries/nacl_mounts_test/nacl_mounts_test.vcproj
deleted file mode 100644
index 3ba54a4..0000000
--- a/native_client_sdk/src/libraries/nacl_mounts_test/nacl_mounts_test.vcproj
+++ /dev/null
@@ -1,202 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="nacl_mounts_test"
- ProjectGUID="{02975542-C04C-4BE3-8444-4614088F698B}"
- RootNamespace="nacl_mounts_test"
- Keyword="Win32Proj"
- TargetFrameworkVersion="196613"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\utils;..\win;..\..\..\..\testing\gtest\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- EnableIntrinsicFunctions="true"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- RuntimeLibrary="2"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\mount_node_test.cc"
- >
- </File>
- <File
- RelativePath=".\path_test.cc"
- >
- </File>
- <File
- RelativePath=".\test.cc"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/native_client_sdk/src/libraries/nacl_mounts_test/path_test.cc b/native_client_sdk/src/libraries/nacl_mounts_test/path_test.cc
index 44176f3..679c3a1 100644
--- a/native_client_sdk/src/libraries/nacl_mounts_test/path_test.cc
+++ b/native_client_sdk/src/libraries/nacl_mounts_test/path_test.cc
@@ -16,10 +16,10 @@ TEST(PathTest, SanityChecks) {
delete ph2;
Path p1(".");
- EXPECT_EQ(false, p1.IsAbsolute());
+ EXPECT_FALSE(p1.IsAbsolute());
EXPECT_EQ(".", p1.Join());
Path p2("/");
- EXPECT_EQ(true, p2.IsAbsolute());
+ EXPECT_TRUE(p2.IsAbsolute());
EXPECT_EQ("/", p2.Join());
}
@@ -32,27 +32,27 @@ TEST(PathTest, Assignment) {
Path self_str("./rel/from/string");
EXPECT_EQ(0, empty.Size());
- EXPECT_EQ(false, empty.IsAbsolute());
+ EXPECT_FALSE(empty.IsAbsolute());
EXPECT_EQ(std::string(""), empty.Join());
EXPECT_EQ(1, dot.Size());
- EXPECT_EQ(false, dot.IsAbsolute());
+ EXPECT_FALSE(dot.IsAbsolute());
EXPECT_EQ(std::string("."), dot.Join());
EXPECT_EQ(1, root.Size());
- EXPECT_EQ(true, root.IsAbsolute());
+ EXPECT_TRUE(root.IsAbsolute());
EXPECT_EQ(std::string("/"), root.Join());
EXPECT_EQ(4, abs_str.Size());
- EXPECT_EQ(true, abs_str.IsAbsolute());
+ EXPECT_TRUE(abs_str.IsAbsolute());
EXPECT_EQ(std::string("/abs/from/string"), abs_str.Join());
EXPECT_EQ(3, rel_str.Size());
- EXPECT_EQ(false, rel_str.IsAbsolute());
+ EXPECT_FALSE(rel_str.IsAbsolute());
EXPECT_EQ(std::string("rel/from/string"), rel_str.Join());
EXPECT_EQ(3, self_str.Size());
- EXPECT_EQ(false, self_str.IsAbsolute());
+ EXPECT_FALSE(self_str.IsAbsolute());
EXPECT_EQ(std::string("rel/from/string"), self_str.Join());
empty = "";
@@ -63,58 +63,58 @@ TEST(PathTest, Assignment) {
self_str = "./rel/from/assign";
EXPECT_EQ(1, empty.Size());
- EXPECT_EQ(false, empty.IsAbsolute());
+ EXPECT_FALSE(empty.IsAbsolute());
EXPECT_EQ(std::string("."), empty.Join());
EXPECT_EQ(1, dot.Size());
- EXPECT_EQ(false, dot.IsAbsolute());
+ EXPECT_FALSE(dot.IsAbsolute());
EXPECT_EQ(std::string("."), dot.Join());
EXPECT_EQ(1, root.Size());
- EXPECT_EQ(true, root.IsAbsolute());
+ EXPECT_TRUE(root.IsAbsolute());
EXPECT_EQ(std::string("/"), root.Join());
EXPECT_EQ(4, abs_str.Size());
- EXPECT_EQ(true, abs_str.IsAbsolute());
+ EXPECT_TRUE(abs_str.IsAbsolute());
EXPECT_EQ(std::string("/abs/from/assign"), abs_str.Join());
EXPECT_EQ(3, rel_str.Size());
- EXPECT_EQ(false, rel_str.IsAbsolute());
+ EXPECT_FALSE(rel_str.IsAbsolute());
EXPECT_EQ(std::string("rel/from/assign"), rel_str.Join());
EXPECT_EQ(3, self_str.Size());
- EXPECT_EQ(false, self_str.IsAbsolute());
+ EXPECT_FALSE(self_str.IsAbsolute());
EXPECT_EQ(std::string("rel/from/assign"), self_str.Join());
Path cpy_str;
cpy_str = empty;
EXPECT_EQ(1, cpy_str.Size());
- EXPECT_EQ(false, cpy_str.IsAbsolute());
+ EXPECT_FALSE(cpy_str.IsAbsolute());
EXPECT_EQ(std::string("."), cpy_str.Join());
cpy_str = dot;
EXPECT_EQ(1, cpy_str.Size());
- EXPECT_EQ(false, cpy_str.IsAbsolute());
+ EXPECT_FALSE(cpy_str.IsAbsolute());
EXPECT_EQ(std::string("."), cpy_str.Join());
cpy_str = root;
EXPECT_EQ(1, cpy_str.Size());
- EXPECT_EQ(true, cpy_str.IsAbsolute());
+ EXPECT_TRUE(cpy_str.IsAbsolute());
EXPECT_EQ(std::string("/"), cpy_str.Join());
cpy_str = abs_str;
EXPECT_EQ(4, cpy_str.Size());
- EXPECT_EQ(true, cpy_str.IsAbsolute());
+ EXPECT_TRUE(cpy_str.IsAbsolute());
EXPECT_EQ(std::string("/abs/from/assign"), cpy_str.Join());
cpy_str = rel_str;
EXPECT_EQ(3, cpy_str.Size());
- EXPECT_EQ(false, cpy_str.IsAbsolute());
+ EXPECT_FALSE(cpy_str.IsAbsolute());
EXPECT_EQ(std::string("rel/from/assign"), cpy_str.Join());
cpy_str = self_str;
EXPECT_EQ(3, cpy_str.Size());
- EXPECT_EQ(false, cpy_str.IsAbsolute());
+ EXPECT_FALSE(cpy_str.IsAbsolute());
EXPECT_EQ(std::string("rel/from/assign"), cpy_str.Join());
}
@@ -148,7 +148,7 @@ TEST(PathTest, Collapse) {
Path p3("sim/ple//spli/tter/te/st/");
path_components = p3.Split();
EXPECT_EQ(6, static_cast<int>(path_components.size()));
- EXPECT_EQ(false, p3.IsAbsolute());
+ EXPECT_FALSE(p3.IsAbsolute());
EXPECT_EQ("sim", path_components[0]);
EXPECT_EQ("ple", path_components[1]);
EXPECT_EQ("spli", path_components[2]);
diff --git a/native_client_sdk/src/libraries/nacl_mounts_test/test.cc b/native_client_sdk/src/libraries/nacl_mounts_test/test.cc
deleted file mode 100644
index 7d7803a..0000000
--- a/native_client_sdk/src/libraries/nacl_mounts_test/test.cc
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "gtest/gtest.h"
-
-int main(int argc, char **argv) {
- testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-