diff options
author | jvoung@chromium.org <jvoung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-24 21:34:27 +0000 |
---|---|---|
committer | jvoung@chromium.org <jvoung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-24 21:34:27 +0000 |
commit | 6ecccd51ef0544b6b46a283702af40c8b2adcaef (patch) | |
tree | 2b434c7a26c7f2311241d61febfe99320574b131 /ppapi/native_client | |
parent | 5c7fa301276bca5d6cf16d93a7514bed94bab215 (diff) | |
download | chromium_src-6ecccd51ef0544b6b46a283702af40c8b2adcaef.zip chromium_src-6ecccd51ef0544b6b46a283702af40c8b2adcaef.tar.gz chromium_src-6ecccd51ef0544b6b46a283702af40c8b2adcaef.tar.bz2 |
Port PNaCl error handling test from scons to gyp / browser_tests.
We stopped running PNaCl scons nacl_integration, so these
tests were no longer being run. Port so that they run.
BUG=http://code.google.com/p/nativeclient/issues/detail?id=3364
Review URL: https://chromiumcodereview.appspot.com/14212004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196240 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/native_client')
11 files changed, 0 insertions, 306 deletions
diff --git a/ppapi/native_client/chrome_main.scons b/ppapi/native_client/chrome_main.scons index 3cf97ae..115d44a 100644 --- a/ppapi/native_client/chrome_main.scons +++ b/ppapi/native_client/chrome_main.scons @@ -56,7 +56,6 @@ ppapi_scons_files['irt_variant_test_scons_files'] = [ # Disabled by Brad Chen 4 Sep to try to green Chromium # nacl_integration tests #'tests/nacl_browser/fault_injection/nacl.scons', - 'tests/nacl_browser/pnacl_client_translator/nacl.scons', ] ppapi_scons_files['untrusted_scons_files'] = [ diff --git a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/bad.pexe b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/bad.pexe deleted file mode 100644 index 27fe62a..0000000 --- a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/bad.pexe +++ /dev/null @@ -1 +0,0 @@ -BC this is not really a bitcode file. diff --git a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/bad2.pexe b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/bad2.pexe deleted file mode 100644 index 41bc8b2..0000000 --- a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/bad2.pexe +++ /dev/null @@ -1,36 +0,0 @@ -;; For now, we are using a .ll file as a "pexe". This is only a bad pexe -;; in the sense that it shouldn't compile (missing instruction), -;; not that it will crash LLC. Eventually we should make this into -;; a bitcode file w/ the proper pexe metadata. - -;; To actually crash LLC (and do so reliably), perhaps we could add -;; an SRPC method to LLC to ask it to crash itself. -;; That seems much more reliable than trying to find a bitcode file that -;; for version X will crash LLC, but for version Y it has been fixed. - -@.str = private unnamed_addr constant [12 x i8] c"Hello world\00", align 4 - -define i32 @main(i32 %argc, i8** %argv) nounwind { -entry: - %argc_addr = alloca i32, align 4 - %argv_addr = alloca i8**, align 4 - %retval = alloca i32 - %0 = alloca i32 - %"alloca point" = bitcast i32 0 to i32 - store i32 %argc, i32* %argc_addr - store i8** %argv, i8*** %argv_addr - %1 = call i32 @puts(i8* getelementptr inbounds ([12 x i8]* @.str, i32 0, i32 0)) nounwind - store i32 0, i32* %0, align 4 - -;; Intentionally comment this line out to make it fail to compile. -;; %2 = load i32* %0, align 4 - - store i32 %2, i32* %retval, align 4 - br label %return - -return: ; preds = %entry - %retval1 = load i32* %retval - ret i32 %retval1 -} - -declare i32 @puts(i8*) 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 deleted file mode 100644 index 126642b..0000000 --- a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/nacl.scons +++ /dev/null @@ -1,62 +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. - -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 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. - -program_fragment_obj = env.ComponentObject('program_fragment.cc') - -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', - program_fragment_obj, - 'pnacl_bad_pexe_undefined_syms.nmf', - 'pnacl_bad_test.html', - ]) - -# 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()) diff --git a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad2_pexe.nmf b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad2_pexe.nmf deleted file mode 100644 index 7a1956e..0000000 --- a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad2_pexe.nmf +++ /dev/null @@ -1,8 +0,0 @@ -{ - "program": { - "x86-32": {"url": "non_existent.nexe"}, - "x86-64": {"url": "non_existent.nexe"}, - "arm": {"url": "non_existent.nexe"}, - "portable": {"pnacl-translate": {"url": "bad2.pexe"} } - } -} diff --git a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_doesnotexist.nmf b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_doesnotexist.nmf deleted file mode 100644 index c84136e..0000000 --- a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_doesnotexist.nmf +++ /dev/null @@ -1,8 +0,0 @@ -{ - "program": { - "x86-32": {"url": "non_existent.nexe"}, - "x86-64": {"url": "non_existent.nexe"}, - "arm": {"url": "non_existent.nexe"}, - "portable": {"pnacl-translate": {"url": "non_existent.pexe"} } - } -} diff --git a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_doesnotexist_pexe_only.nmf b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_doesnotexist_pexe_only.nmf deleted file mode 100644 index 8448232..0000000 --- a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_doesnotexist_pexe_only.nmf +++ /dev/null @@ -1,5 +0,0 @@ -{ - "program": { - "portable": {"pnacl-translate": {"url": "non_existent.pexe"} } - } -} diff --git a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_pexe.nmf b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_pexe.nmf deleted file mode 100644 index 1ce311b..0000000 --- a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_pexe.nmf +++ /dev/null @@ -1,8 +0,0 @@ -{ - "program": { - "x86-32": {"url": "non_existent.nexe"}, - "x86-64": {"url": "non_existent.nexe"}, - "arm": {"url": "non_existent.nexe"}, - "portable": {"pnacl-translate": {"url": "bad.pexe"} } - } -} diff --git a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_pexe_undefined_syms.nmf b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_pexe_undefined_syms.nmf deleted file mode 100644 index 8fe0bed..0000000 --- a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_pexe_undefined_syms.nmf +++ /dev/null @@ -1,8 +0,0 @@ -{ - "program": { - "x86-32": {"url": "non_existent.nexe"}, - "x86-64": {"url": "non_existent.nexe"}, - "arm": {"url": "non_existent.nexe"}, - "portable": {"pnacl-translate": {"url": "program_fragment.bc"} } - } -} diff --git a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_test.html b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_test.html deleted file mode 100644 index 2627d87..0000000 --- a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_test.html +++ /dev/null @@ -1,159 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<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" /> - <script type="text/javascript" src="nacltest.js"></script> - <script type="text/javascript" src="ppapi_bad.js"></script> - <title>PNACL bad pexe/libraries Test</title> - <style type="text/css"> - .naclModule { background-color: gray; margin: 2px 2px; } - </style> -</head> -<body id="body"> -<script type="text/javascript"> -//<![CDATA[ - -function declareTests(tester) { - // 'bad_pexe' loads a manifest, then loads a pexe that is invalid. - badLoadTest( - tester, - 'bad_pexe', - 'pnacl_bad_pexe.nmf', - 'NaCl module load failed: PnaclCoordinator: compile failed.'); - - // 'bad_pexe' loads a manifest, then loads a pexe that is truncated. - badLoadTest( - tester, - 'bad2_pexe', - 'pnacl_bad2_pexe.nmf', - 'NaCl module load failed: PnaclCoordinator: compile failed.'); - - // 'bad_pexe_undefined' loads a manifest, then loads a pexe that compiles - // but will result in undefined symbols, causing the link to fail. - badLoadTest( - tester, - 'bad_pexe_undefined_syms', - 'pnacl_bad_pexe_undefined_syms.nmf', - 'NaCl module load failed: PnaclCoordinator: link failed.'); - - // 'nonexistent_pexe loads a manifest, then tries to load a nonexistent pexe, - // given both a nexe and a portable program to choose from. - badLoadTest( - tester, - 'nonexistent_pexe', - 'pnacl_bad_doesnotexist.nmf', - 'NaCl module load failed: PnaclCoordinator: ' + - 'pexe load failed (pp_error=-2).'); - - // 'nonexistent_pexe_only' loads a manifest, then tries to load a nonexistent - // pexe, given only a pexe to choose from. - badLoadTest( - tester, - 'nonexistent_pexe_only', - 'pnacl_bad_doesnotexist_pexe_only.nmf', - 'NaCl module load failed: PnaclCoordinator: ' + - 'pexe load failed (pp_error=-2).'); - - tester.addAsyncTest('Test clean directory', - // All that should be left after all tests run is empty directories. - // This means we will need to update this test with a whitelist, - // if we start adding metadata files or things like that. - function(test_status) { - - var errorHandler = test_status.wrap(function() { - test_status.fail('Unexpected failure in intermediate steps'); - }); - - function toArray(list) { - return Array.prototype.slice.call(list || [], 0); - } - - function CheckDirectoriesRecursively(dir, doneCallback) { - var dirReader = dir.createReader(); - var entries = []; - - var checkMoreEntries = test_status.wrap(function(entries) { - // Done when it's actually an empty directory. - if (entries.length == 0) { - doneCallback(); - return; - } - - var expected_callbacks = entries.length; - var current_callbacks = 0; - var nextCallback = test_status.wrap(function() { - current_callbacks += 1; - if (current_callbacks == expected_callbacks) { - doneCallback(); - } - }); - - entries.forEach(test_status.wrap(function(entry, i) { - if (entry.isDirectory) { - CheckDirectoriesRecursively(entry, nextCallback); - } else { - test_status.fail('Found a left over file ' + entry.name); - } - })); - }); - - // Call the reader.readEntries() until no more results are returned. - var readEntries = test_status.wrap(function() { - dirReader.readEntries ( - test_status.wrap(function(results) { - if (!results.length) { - checkMoreEntries(entries); - } else { - entries = entries.concat(toArray(results)); - readEntries(); - } - }), errorHandler); - }); - - readEntries(); // Start reading dirs. - } - - var onInitFs = test_status.wrap(function(fs) { - var doneCallback = test_status.wrap(function() { - test_status.pass(); - }); - CheckDirectoriesRecursively(fs.root, doneCallback); - }); - - // Note: The file system has been prefixed as of Google Chrome 12: - window.requestFileSystem = - window.requestFileSystem || window.webkitRequestFileSystem; - window.requestFileSystem(window.TEMPORARY, - 1024*1024, onInitFs, errorHandler); - } - ); -} - - -// The driver invoked when the body has finished loading. -function runTests() { - var tester = new Tester($('body')); - tester.loadErrorsAreOK(); - declareTests(tester); - tester.run(); -} -//]]> -</script> - -<!-- The tests will create and remove embeds from this div. --> -<div id="embeds"></div> - -<script type="text/javascript"> -//<![CDATA[ -runTests(); -//]]> -</script> -</body> -</html> diff --git a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/program_fragment.cc b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/program_fragment.cc deleted file mode 100644 index 8dafe92..0000000 --- a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/program_fragment.cc +++ /dev/null @@ -1,10 +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. - -// Never defined. This will end badly when we try to link. -extern void bar(); - -void foo() { - bar(); -} |