Commit fd95ee52 authored by binji@chromium.org's avatar binji@chromium.org

[NaCl SDK] Fix the AppEngine lua build after r243629.

Lua builds using the SDK's common.mk build files, but passes NACL_ARCH=pnacl
when building for pnacl.

nacl_config.py is now (as of r243629) used in common.mk, but it would error out
if toolchain=pnacl, and arch was not unspecified.

This change allows toolchain=pnacl, arch=pnacl.

BUG=none
R=sbc@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245364 0039d316-1c4b-4281-b951-d872f2087c98
parent d538141a
...@@ -22,6 +22,7 @@ if sys.version_info < (2, 6, 0): ...@@ -22,6 +22,7 @@ if sys.version_info < (2, 6, 0):
VALID_ARCHES = ('arm', 'x86_32', 'x86_64', 'i686') VALID_ARCHES = ('arm', 'x86_32', 'x86_64', 'i686')
VALID_PNACL_ARCHES = (None, 'pnacl')
ARCH_NAME = { ARCH_NAME = {
'arm': 'arm', 'arm': 'arm',
'x86_32': 'i686', 'x86_32': 'i686',
...@@ -91,7 +92,7 @@ def ExpectToolchain(toolchain, expected_toolchains): ...@@ -91,7 +92,7 @@ def ExpectToolchain(toolchain, expected_toolchains):
def ExpectArch(arch, expected_arches): def ExpectArch(arch, expected_arches):
Expect(arch in expected_arches, Expect(arch in expected_arches,
'Expected arch to be one of [%s], not %s.' % ( 'Expected arch to be one of [%s], not %s.' % (
', '.join(expected_arches), arch)) ', '.join(map(str, expected_arches)), arch))
def CheckValidToolchainArch(toolchain, arch, arch_required=False): def CheckValidToolchainArch(toolchain, arch, arch_required=False):
...@@ -103,7 +104,7 @@ def CheckValidToolchainArch(toolchain, arch, arch_required=False): ...@@ -103,7 +104,7 @@ def CheckValidToolchainArch(toolchain, arch, arch_required=False):
'Expected no arch for host toolchain %r. Got %r.' % ( 'Expected no arch for host toolchain %r. Got %r.' % (
toolchain, arch)) toolchain, arch))
elif toolchain == 'pnacl': elif toolchain == 'pnacl':
Expect(arch is None, Expect(arch is None or arch == 'pnacl',
'Expected no arch for toolchain %r. Got %r.' % (toolchain, arch)) 'Expected no arch for toolchain %r. Got %r.' % (toolchain, arch))
elif arch_required: elif arch_required:
Expect(arch is not None, Expect(arch is not None,
...@@ -112,7 +113,11 @@ def CheckValidToolchainArch(toolchain, arch, arch_required=False): ...@@ -112,7 +113,11 @@ def CheckValidToolchainArch(toolchain, arch, arch_required=False):
', '.join(VALID_ARCHES), toolchain)) ', '.join(VALID_ARCHES), toolchain))
if arch: if arch:
ExpectArch(arch, VALID_ARCHES) if toolchain == 'pnacl':
ExpectArch(arch, VALID_PNACL_ARCHES)
else:
ExpectArch(arch, VALID_ARCHES)
if arch == 'arm': if arch == 'arm':
Expect(toolchain == 'newlib', 'The arm arch only supports newlib.') Expect(toolchain == 'newlib', 'The arm arch only supports newlib.')
...@@ -148,7 +153,6 @@ def GetToolchainDir(toolchain, arch=None): ...@@ -148,7 +153,6 @@ def GetToolchainDir(toolchain, arch=None):
root = GetPosixSDKPath() root = GetPosixSDKPath()
platform = getos.GetPlatform() platform = getos.GetPlatform()
if toolchain == 'pnacl': if toolchain == 'pnacl':
assert arch is None
subdir = '%s_pnacl' % platform subdir = '%s_pnacl' % platform
else: else:
assert arch is not None assert arch is not None
......
...@@ -87,6 +87,8 @@ class TestNaclConfig(unittest.TestCase): ...@@ -87,6 +87,8 @@ class TestNaclConfig(unittest.TestCase):
'/sdk_root/toolchain/mac_x86_glibc/bin/x86_64-nacl-%s' % nacl_tool, '/sdk_root/toolchain/mac_x86_glibc/bin/x86_64-nacl-%s' % nacl_tool,
'pnacl': '/sdk_root/toolchain/mac_pnacl/bin/pnacl-%s' % pnacl_tool, 'pnacl': '/sdk_root/toolchain/mac_pnacl/bin/pnacl-%s' % pnacl_tool,
('pnacl', 'pnacl'):
'/sdk_root/toolchain/mac_pnacl/bin/pnacl-%s' % pnacl_tool,
} }
for tc_arch, expected in cases.iteritems(): for tc_arch, expected in cases.iteritems():
...@@ -102,6 +104,12 @@ class TestNaclConfig(unittest.TestCase): ...@@ -102,6 +104,12 @@ class TestNaclConfig(unittest.TestCase):
self.assertRaises(nacl_config.Error, self.assertRaises(nacl_config.Error,
nacl_config.GetToolPath, toolchain, None, tool) nacl_config.GetToolPath, toolchain, None, tool)
# Using toolchain=pnacl with any arch other than None, or 'pnacl' is an
# error.
for arch in ('x86_32', 'x86_64', 'arm', 'foobar'):
self.assertRaises(nacl_config.Error,
nacl_config.GetToolPath, toolchain, arch, tool)
# No arm glibc. # No arm glibc.
self.assertRaises(nacl_config.Error, self.assertRaises(nacl_config.Error,
nacl_config.GetToolPath, 'glibc', 'arm', tool) nacl_config.GetToolPath, 'glibc', 'arm', tool)
......
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