Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
|
binji
2016/03/11 19:30:39
huh, why wasn't this detected as a copy?
bradnelson
2016/03/11 23:26:11
Dunno, too many little changes.
| |
| 2 * Copyright (c) 2014 The Native Client Authors. All rights reserved. | |
| 3 * Use of this source code is governed by a BSD-style license that can be | |
| 4 * found in the LICENSE file. | |
| 5 */ | |
| 6 | |
| 7 /* globals TEST_F, ASSERT_EQ, ASSERT_TRUE, chrometest, DevEnvTest */ | |
| 8 | |
| 9 'use strict'; | |
| 10 | |
| 11 // Install the default packages. | |
| 12 // This test must be run before any tests that use these packages. | |
| 13 TEST_F(DevEnvTest, 'testDefaultPackageInstall', function() { | |
| 14 var self = this; | |
| 15 return Promise.resolve().then(function() { | |
| 16 return self.installDefaultPackages(); | |
| 17 }); | |
| 18 }); | |
| 19 | |
| 20 // Test of the Google I/O 2014 tutorial at: | |
| 21 // https://developer.chrome.com/native-client/io2014 | |
| 22 TEST_F(DevEnvTest, 'testIO2014', function() { | |
| 23 var self = this; | |
| 24 var pid; | |
| 25 var bashrc = 'git config --global user.name "John Doe"\n' + | |
| 26 'git config --global user.email johndoe@example.com\n'; | |
| 27 return Promise.resolve().then(function() { | |
| 28 return self.initFileSystem(); | |
| 29 }).then(function() { | |
| 30 return self.writeFile('/home/user/.bashrc', bashrc); | |
| 31 }).then(function() { | |
| 32 return self.checkCommand('source ~/.bashrc'); | |
| 33 }).then(function() { | |
| 34 return self.checkCommand('mkdir work'); | |
| 35 }).then(function() { | |
| 36 return self.checkCommand( | |
| 37 'cd work && ' + | |
| 38 'curl http://nacltools.storage.googleapis.com/io2014/voronoi.zip -O'); | |
| 39 }).then(function() { | |
| 40 return self.checkCommand('cd work && ls', 0, 'voronoi.zip\n'); | |
| 41 }).then(function() { | |
| 42 return self.checkCommand('cd work && unzip voronoi.zip'); | |
| 43 }).then(function() { | |
| 44 return self.checkCommand('cd work/voronoi && ls Makefile', 0, 'Makefile\n'); | |
| 45 }).then(function() { | |
| 46 return self.checkCommand('cd work/voronoi && git init'); | |
| 47 }).then(function() { | |
| 48 return self.checkCommand('cd work/voronoi && git add .'); | |
| 49 }).then(function() { | |
| 50 return self.checkCommand( | |
| 51 'cd work/voronoi && git commit -m "imported voronoi demo"'); | |
| 52 }).then(function() { | |
| 53 if (self.params['TOOLCHAIN'] === 'glibc' && | |
| 54 self.params['SYS_ARCH'] === 'x86_64') { | |
| 55 return Promise.resolve().then(function() { | |
| 56 return self.checkCommand('cd work/voronoi && make voronoi.nexe'); | |
| 57 }).then(function() { | |
| 58 chrometest.info('spawn voronoi'); | |
| 59 return self.spawnCommand('cd work/voronoi && make voronoi'); | |
| 60 }).then(function(msg) { | |
| 61 pid = msg.pid; | |
| 62 chrometest.info('got pid ' + pid); | |
| 63 return chrometest.sleep(3000); | |
| 64 }).then(function(msg) { | |
| 65 chrometest.info('killing'); | |
| 66 self.sigint(); | |
| 67 return self.waitCommand(pid); | |
| 68 }).then(function(msg) { | |
| 69 chrometest.info('done killing'); | |
| 70 ASSERT_EQ(2, msg.status, 'Expect 2 from make'); | |
| 71 }); | |
| 72 } else { | |
| 73 // TODO(bradnelson): Fix other combinations. | |
| 74 chrometest.info('skipping unsupported toolchain / arch to build on'); | |
| 75 } | |
| 76 }); | |
| 77 }); | |
| 78 | |
| 79 // Test of the Chrome Dev Summit cpp tutorial at: | |
| 80 // https://developer.chrome.com/native-client/cds2014/cpp | |
| 81 TEST_F(DevEnvTest, 'testCDS2014', function() { | |
| 82 var self = this; | |
| 83 var pid; | |
| 84 var bashrc = 'git config --global user.name "John Doe"\n' + | |
| 85 'git config --global user.email johndoe@example.com\n'; | |
| 86 return Promise.resolve().then(function() { | |
| 87 return self.initFileSystem(); | |
| 88 }).then(function() { | |
| 89 return self.writeFile('/home/user/.bashrc', bashrc); | |
| 90 }).then(function() { | |
| 91 return self.checkCommand('source ~/.bashrc'); | |
| 92 }).then(function() { | |
| 93 return self.checkCommand('mkdir work2'); | |
| 94 }).then(function() { | |
| 95 return self.checkCommand( | |
| 96 'cd work2 && ' + | |
| 97 'curl https://nacltools.storage.googleapis.com/' + | |
| 98 'cds2014/cds2014_cpp.zip -O'); | |
| 99 }).then(function() { | |
| 100 return self.checkCommand('cd work2 && ls', 0, 'cds2014_cpp.zip\n'); | |
| 101 }).then(function() { | |
| 102 return self.checkCommand('cd work2 && unzip cds2014_cpp.zip'); | |
| 103 }).then(function() { | |
| 104 return self.checkCommand( | |
| 105 'cd work2/cds2014_cpp && ls Makefile', 0, 'Makefile\n'); | |
| 106 }).then(function() { | |
| 107 return self.checkCommand('cd work2/cds2014_cpp && git init'); | |
| 108 }).then(function() { | |
| 109 return self.checkCommand('cd work2/cds2014_cpp && git add .'); | |
| 110 }).then(function() { | |
| 111 return self.checkCommand( | |
| 112 'cd work2/cds2014_cpp && git commit -m "imported cds2014_cpp demo"'); | |
| 113 }).then(function() { | |
| 114 if (self.params['TOOLCHAIN'] === 'glibc' && | |
| 115 self.params['SYS_ARCH'] === 'x86_64') { | |
| 116 return Promise.resolve().then(function() { | |
| 117 return self.checkCommand('cd work2/cds2014_cpp && make'); | |
| 118 }).then(function() { | |
| 119 chrometest.info('spawn fire'); | |
| 120 return self.spawnCommand('cd work2/cds2014_cpp && make fire'); | |
| 121 }).then(function(msg) { | |
| 122 pid = msg.pid; | |
| 123 chrometest.info('got pid ' + pid); | |
| 124 return chrometest.sleep(3000); | |
| 125 }).then(function(msg) { | |
| 126 chrometest.info('killing'); | |
| 127 self.sigint(); | |
| 128 return self.waitCommand(pid); | |
| 129 }).then(function(msg) { | |
| 130 chrometest.info('done killing'); | |
| 131 ASSERT_EQ(2, msg.status, 'Expect 2 from make'); | |
| 132 }); | |
| 133 } else { | |
| 134 // TODO(bradnelson): Fix other combinations. | |
| 135 chrometest.info('skipping unsupported toolchain / arch to build on'); | |
| 136 } | |
| 137 }); | |
| 138 }); | |
| OLD | NEW |