| Index: ppapi/native_client/tests/nacl_browser/pnacl_client_translator/nacl.scons
|
| diff --git a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/nacl.scons b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/nacl.scons
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..24b8240b477b6e9f3bb088604913424f15ad9ae7
|
| --- /dev/null
|
| +++ b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/nacl.scons
|
| @@ -0,0 +1,104 @@
|
| +# 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.
|
| +
|
| +Import('env')
|
| +
|
| +# Browser tests for the pnacl translator. This requires starting with a pexe.
|
| +if not (env.Bit('bitcode') and env.Bit('pnacl_generate_pexe')):
|
| + Return()
|
| +
|
| +# The PNaCl coordinator cannot yet handle GLibC-based pexe.
|
| +# The driver cannot build the pexe on x86-64 for now.
|
| +# The bitcode link arbitrarily picks x86-32 as the ARCH, but the
|
| +# glibc bitcode link line uses native x86-64 libs instead of bitcode
|
| +# stubs, so there is a mismatch:
|
| +# http://code.google.com/p/nativeclient/issues/detail?id=2451
|
| +# Luckily, it can build the x86-32 pexe. That works, mostly because
|
| +# the hello-world example doesn't depend on pso's, etc.
|
| +if env.Bit('nacl_glibc') and env.Bit('target_x86_64'):
|
| + Return()
|
| +
|
| +#----------------------------------------------------------------------
|
| +# Test pexe translation.
|
| +
|
| +# Specify the object file to prevent junk from getting left over
|
| +# in source directory. SCons will default to point "-o" to the source
|
| +# directory if it is an absolute directory.
|
| +test_example_obj = env.ComponentObject(
|
| + 'pnacl_test_example_obj',
|
| + '${SCONSTRUCT_DIR}/tests/ppapi_test_example/ppapi_test_example.cc')
|
| +
|
| +pexe_name = env.ProgramNameForNmf('pnacl_test_example')
|
| +
|
| +test_example_pexe = env.ComponentProgram(
|
| + pexe_name,
|
| + [test_example_obj],
|
| + EXTRA_LIBS=['ppapi',
|
| + 'ppapi_test_lib',
|
| + 'platform', # for CHECK
|
| + 'pthread',
|
| + 'gio',
|
| + ])
|
| +
|
| +# Grab test routines.
|
| +borrowed_file = '${STAGING_DIR}/ppapi_test_example.js',
|
| +
|
| +env.Publish(pexe_name,
|
| + 'run',
|
| + ['pnacl_test_example.html'])
|
| +
|
| +node = env.PPAPIBrowserTester(
|
| + 'pnacl_test_example.out',
|
| + url='pnacl_test_example.html',
|
| + nmf_names=['pnacl_test_example'],
|
| + files=env.ExtractPublishedFiles(pexe_name) + [borrowed_file])
|
| +
|
| +env.AddNodeToTestSuite(node,
|
| + ['chrome_browser_tests'],
|
| + 'run_pnacl_example_browser_test',
|
| + is_broken=env.PPAPIBrowserTesterIsBroken())
|
| +
|
| +#### Test error handling.
|
| +
|
| +# We should add more cases, e.g., try a bad library to crash ld,
|
| +# try a more malicious bitcode, try to exhaust resources, etc.
|
| +# The current llc tests, don't actually crash LLC, they only
|
| +# make llc exit w/ an abnormal status.
|
| +
|
| +pnacl_bad_files = env.Replicate(
|
| + '${STAGING_DIR}',
|
| + ['pnacl_bad_doesnotexist.nmf',
|
| + 'pnacl_bad_doesnotexist_pexe_only.nmf',
|
| + # This one is just a text file that begins with "BC".
|
| + 'bad.pexe',
|
| + 'pnacl_bad_pexe.nmf',
|
| + # This one is the hello world bitcode .ll w/ a missing instruction.
|
| + 'bad2.pexe',
|
| + 'pnacl_bad2_pexe.nmf',
|
| + # Borrow the bitcode file from the test above and treat it as a
|
| + # pexe so that the compile succeeds but linking fails.
|
| + 'pnacl_test_example_obj.bc',
|
| + 'pnacl_bad_pexe_undefined_syms.nmf',
|
| + 'pnacl_bad_test.html',
|
| + ])
|
| +
|
| +env.Depends(pnacl_bad_files, test_example_obj)
|
| +
|
| +# Borrow bad load test harness.
|
| +borrowed_file = '${STAGING_DIR}/ppapi_bad.js',
|
| +
|
| +node = env.PPAPIBrowserTester(
|
| + 'pnacl_bad_test.out',
|
| + url='pnacl_bad_test.html',
|
| + # TODO(jvoung): list "nmfs" without clashing with Replicate.
|
| + # Perhaps just use publish instead of Replicate.
|
| + # There may also be an issue in that the scons manifest generator is picky
|
| + # about nexes that don't exist.
|
| + files=pnacl_bad_files + [borrowed_file],
|
| + args=['--allow_404', '--prefer_portable_in_manifest'])
|
| +
|
| +env.AddNodeToTestSuite(node,
|
| + ['chrome_browser_tests'],
|
| + 'run_pnacl_bad_browser_test',
|
| + is_broken=env.PPAPIBrowserTesterIsBroken())
|
|
|