Skip to content

Commit

Permalink
Enable PPAPI browser tests for Non-SFI ARM.
Browse files Browse the repository at this point in the history
- Add rules for building browser tests for Non-SFI ARM
- Enable browser tests for Non-SFI ARM
- Modify create_nonsfi_test_nmf.py to support Non-SFI ARM

BUG=372049
TEST=try bot with linux_arm and linux_arm_tester

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

Cr-Commit-Position: refs/heads/master@{#304000}
  • Loading branch information
mazda authored and Commit bot committed Nov 13, 2014
1 parent 30d61be commit e1b899f
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 33 deletions.
4 changes: 3 additions & 1 deletion chrome/browser_tests.isolate
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@
],
},
}],
['disable_nacl==0 and OS=="linux" and target_arch=="ia32"', {
[('disable_nacl==0 and OS=="linux" and '
'(target_arch=="ia32" or target_arch=="arm")'), {
'variables': {
'files': [
'<(PRODUCT_DIR)/ppapi_nacl_tests_pnacl_nonsfi.nmf',
Expand All @@ -118,6 +119,7 @@
'files': [
'<(PRODUCT_DIR)/ppapi_nacl_tests_newlib_arm.nexe',
'<(PRODUCT_DIR)/ppapi_nacl_tests_pnacl_newlib_arm.nexe',
'<(PRODUCT_DIR)/ppapi_nacl_tests_pnacl_newlib_arm_nonsfi.nexe',
],
},
}],
Expand Down
43 changes: 33 additions & 10 deletions chrome/test/data/nacl/nacl_test_data.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,21 @@
},
'conditions': [
['target_arch=="ia32" and OS=="linux"', {
# Enable nonsfi testing only on ia32-linux environment.
# Enable nonsfi testing on ia32-linux environment.
# This flag causes test_files to be copied into nonsfi directory,
# too.
'variables': {
'enable_x86_32_nonsfi': 1,
},
}],
['target_arch=="arm" and OS=="linux"', {
# Enable nonsfi testing on arm-linux environment.
# This flag causes test_files to be copied into nonsfi directory,
# too.
'variables': {
'enable_arm_nonsfi': 1,
},
}],
],
},
{
Expand Down Expand Up @@ -549,21 +557,29 @@
'nacl_ppapi_util',
],
'conditions': [
# These are needed to build a non-SFI nexe binary.
# Note that these trigger building nexe files for other
# architectures, such as x86-32 (based on enable_XXX variables).
# As described above, although the tests for pnacl are currently
# disabled, but building the binary should work.
# We cannot disable building, as enable_XXX variables are also used
# to build newlib linked nexes.
['target_arch=="ia32" and OS=="linux"', {
# Enable nonsfi testing only on ia32-linux environment.
# Enable nonsfi testing on ia32-linux environment.
'variables': {
# This is needed to build a non-SFI nexe binary.
# Note that this triggers building nexe files for other
# architectures, such as x86-32 (based on enable_XXX variables).
# As described above, although the tests for pnacl are currently
# disabled, but building the binary should work.
# We cannot disable building, as enable_XXX variables are also used
# to build newlib linked nexes.
'build_pnacl_newlib': 1,
'translate_pexe_with_build': 1,
'enable_x86_32_nonsfi': 1,
},
}],
['target_arch=="arm" and OS=="linux"', {
# Enable nonsfi testing on arm-linux environment.
'variables': {
'build_pnacl_newlib': 1,
'translate_pexe_with_build': 1,
'enable_arm_nonsfi': 1,
},
}],
],
},
{
Expand Down Expand Up @@ -603,12 +619,19 @@
],
'conditions': [
['target_arch=="ia32" and OS=="linux"', {
# Enable nonsfi testing only on ia32-linux environment.
# Enable nonsfi testing on ia32-linux environment.
'variables': {
'enable_x86_32_nonsfi': 1,
'translate_pexe_with_build': 1,
},
}],
['target_arch=="arm" and OS=="linux"', {
# Enable nonsfi testing on arm-linux environment.
'variables': {
'enable_arm_nonsfi': 1,
'translate_pexe_with_build': 1,
},
}],
],
},
{
Expand Down
4 changes: 2 additions & 2 deletions chrome/test/nacl/nacl_browsertest_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ class NaClBrowserTestGLibcExtension : public NaClBrowserTestGLibc {
#endif

// Currently, translation from pexe to non-sfi nexe is supported only for
// x86-32 binary.
#if defined(OS_LINUX) && defined(ARCH_CPU_X86)
// x86-32 or ARM binary.
#if defined(OS_LINUX) && (defined(ARCH_CPU_X86) || defined(ARCH_CPU_ARMEL))
# define MAYBE_PNACL_NONSFI(test_case) test_case
#else
# define MAYBE_PNACL_NONSFI(test_case) DISABLED_##test_case
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
# variable, as it is no longer used.
'out_pnacl_newlib_x86_32_nonsfi': '>(tc_lib_dir_pnacl_translate)/lib-x86-32-nonsfi/>(nlib_target)',
'out_newlib32_nonsfi': '>(tc_lib_dir_pnacl_translate)/lib-x86-32-nonsfi/>(nlib_target)',
'out_pnacl_newlib_arm_nonsfi': '>(tc_lib_dir_pnacl_translate)/lib-arm-nonsfi/>(nlib_target)',
'out_newlib_arm_nonsfi': '>(tc_lib_dir_pnacl_translate)/lib-arm-nonsfi/>(nlib_target)',
'build_glibc': 0,
'build_newlib': 0,
'build_pnacl_newlib': 1,
Expand All @@ -34,6 +36,7 @@
'enable_arm': 1,
'enable_mips': 1,
'enable_x86_32_nonsfi': 1,
'enable_arm_nonsfi': 1,
'sources': [
'irt_shim_ppapi.c',
'pnacl_shim.c',
Expand Down
35 changes: 30 additions & 5 deletions ppapi/ppapi_nacl.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,26 @@
},
],
}],
['disable_pnacl==0 and target_arch=="ia32" and OS=="linux"', {
# In addition to above configuration, build x86-32-nonsfi .nexe file
# by translating from .pexe binary, for non-SFI mode PPAPI testing.
['disable_pnacl==0 and (target_arch=="ia32" or target_arch=="arm") and OS=="linux"', {
# In addition to above configuration, build x86-32 and arm nonsfi
# .nexe files by translating from .pexe binary, for non-SFI mode PPAPI
# testing.
'variables': {
'enable_x86_32_nonsfi': 1,
'translate_pexe_with_build': 1,
'nmf_nonsfi%': '<(PRODUCT_DIR)/>(nexe_target)_pnacl_nonsfi.nmf',
},
'conditions': [
['target_arch=="ia32"', {
'variables': {
'enable_x86_32_nonsfi': 1,
},
}],
['target_arch=="arm"', {
'variables': {
'enable_arm_nonsfi': 1,
},
}],
],
# Shim is a dependency for the nexe because we pre-translate.
'dependencies': [
'<(DEPTH)/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:aot',
Expand All @@ -256,7 +268,20 @@
'python',
'>(create_nonsfi_test_nmf)',
'--output=>(nmf_nonsfi)',
'--program=>(out_pnacl_newlib_x86_32_nonsfi_nexe)',
],
'target_conditions': [
['enable_x86_32_nonsfi==1', {
'action': [
'--program=>(out_pnacl_newlib_x86_32_nonsfi_nexe)',
'--arch=x86-32',
],
}],
['enable_arm_nonsfi==1', {
'action': [
'--program=>(out_pnacl_newlib_arm_nonsfi_nexe)',
'--arch=arm',
],
}],
],
},
],
Expand Down
30 changes: 21 additions & 9 deletions ppapi/ppapi_nacl_test_common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
'out_pnacl_newlib%': '>(nacl_pnacl_newlib_out_dir)/>(nexe_target)_newlib_pnacl.pexe',
'nmf_pnacl_newlib%': '>(nacl_pnacl_newlib_out_dir)/>(nexe_target).nmf',
'out_pnacl_newlib_x86_32_nonsfi_nexe': '>(nacl_pnacl_newlib_nonsfi_out_dir)/>(nexe_target)_pnacl_newlib_x32_nonsfi.nexe',
'out_pnacl_newlib_arm_nonsfi_nexe': '>(nacl_pnacl_newlib_nonsfi_out_dir)/>(nexe_target)_pnacl_newlib_arm_nonsfi.nexe',
'nmf_pnacl_newlib_nonsfi%': '>(nacl_pnacl_newlib_nonsfi_out_dir)/>(nexe_target).nmf',
}],
],
Expand Down Expand Up @@ -77,7 +78,7 @@
},
],
}],
['test_files!=[] and build_pnacl_newlib==1 and enable_x86_32_nonsfi==1', {
['test_files!=[] and build_pnacl_newlib==1 and (enable_x86_32_nonsfi==1 or enable_arm_nonsfi==1)', {
'copies': [
{
'destination': '>(nacl_pnacl_newlib_nonsfi_out_dir)',
Expand Down Expand Up @@ -209,22 +210,33 @@
},
],
}],
['generate_nmf==1 and build_pnacl_newlib==1 and disable_pnacl==0 and enable_x86_32_nonsfi==1', {
['generate_nmf==1 and build_pnacl_newlib==1 and disable_pnacl==0 and (enable_x86_32_nonsfi==1 or enable_arm_nonsfi==1)', {
'actions': [
{
'action_name': 'Generate PNACL NEWLIB nonsfi NMF',
# If we add support for ARM, we should split the dependency on
# out_pnacl_newlib_x86_32_nonsfi_nexe to 'target_conditions',
# similar to build_newlib=1 config declared above.
'inputs': ['>(create_nonsfi_test_nmf)',
'>(out_pnacl_newlib_x86_32_nonsfi_nexe)'],
'inputs': ['>(create_nonsfi_test_nmf)'],
'outputs': ['>(nmf_pnacl_newlib_nonsfi)'],
'action': [
'python',
'>(create_nonsfi_test_nmf)',
'>@(create_nmf_args_portable)',
'--output=>(nmf_pnacl_newlib_nonsfi)',
'--program=>(out_pnacl_newlib_x86_32_nonsfi_nexe)',
'>@(create_nmf_args_portable)'
],
'target_conditions': [
['enable_x86_32_nonsfi==1', {
'inputs': ['>(out_pnacl_newlib_x86_32_nonsfi_nexe)'],
'action': [
'--program=>(out_pnacl_newlib_x86_32_nonsfi_nexe)',
'--arch=x86-32',
]
}],
['enable_arm_nonsfi==1', {
'inputs': ['>(out_pnacl_newlib_arm_nonsfi_nexe)'],
'action': [
'--program=>(out_pnacl_newlib_arm_nonsfi_nexe)',
'--arch=arm',
]
}],
],
},
],
Expand Down
18 changes: 12 additions & 6 deletions ppapi/tests/create_nonsfi_test_nmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,20 @@
import json
import logging
import os
import sys

_FILES_KEY = 'files'
_PORTABLE_KEY = 'portable'
_PROGRAM_KEY = 'program'
_URL_KEY = 'url'
_X86_32_NONSFI_KEY = 'x86-32-nonsfi'


def ParseArgs():
parser = argparse.ArgumentParser()
parser.add_argument(
'--program', metavar='FILE', help='Main program nexe')
parser.add_argument(
'--arch', metavar='ARCH', choices=('x86-32', 'arm'),
help='The archtecture of main program nexe')
# To keep compatibility with create_nmf.py, we use -x and --extra-files
# as flags.
parser.add_argument(
Expand All @@ -43,14 +45,15 @@ def ParseArgs():
return parser.parse_args()


def BuildNmfMap(root_path, program, extra_files):
def BuildNmfMap(root_path, program, arch, extra_files):
"""Build simple map representing nmf json."""
nonsfi_key = arch + '-nonsfi'
result = {
_PROGRAM_KEY: {
_X86_32_NONSFI_KEY: {
nonsfi_key: {
# The program path is relative to the root_path.
_URL_KEY: os.path.relpath(program, root_path)
}
},
}
}

Expand Down Expand Up @@ -81,12 +84,15 @@ def main():
if not args.program:
logging.error('--program is not specified.')
sys.exit(1)
if not args.arch:
logging.error('--arch is not specified.')
sys.exit(1)
if not args.output:
logging.error('--output is not specified.')
sys.exit(1)

nmf_map = BuildNmfMap(os.path.dirname(args.output),
args.program, args.extra_files)
args.program, args.arch, args.extra_files)
OutputNmf(nmf_map, args.output)


Expand Down

0 comments on commit e1b899f

Please sign in to comment.