Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1406)

Unified Diff: ports/devenv/tests/demo2014_test.js

Issue 1563073002: Re-enable io2014 + add cds2014 tests for devenv. (Closed) Base URL: https://chromium.googlesource.com/webports.git@master
Patch Set: fix Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ports/devenv/tests/demo2014_test.html ('k') | ports/devenv/tests/devenv_small_test.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ports/devenv/tests/demo2014_test.js
diff --git a/ports/devenv/tests/demo2014_test.js b/ports/devenv/tests/demo2014_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..682da40679a725eca6191d9a7c205ff22db3a06a
--- /dev/null
+++ b/ports/devenv/tests/demo2014_test.js
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2014 The Native Client Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* globals TEST_F, ASSERT_EQ, ASSERT_TRUE, chrometest, DevEnvTest */
+
+'use strict';
+
+// Install the default packages.
+// This test must be run before any tests that use these packages.
+TEST_F(DevEnvTest, 'testDefaultPackageInstall', function() {
+ var self = this;
+ return Promise.resolve().then(function() {
+ return self.installDefaultPackages();
+ });
+});
+
+// Test of the Google I/O 2014 tutorial at:
+// https://developer.chrome.com/native-client/io2014
+TEST_F(DevEnvTest, 'testIO2014', function() {
+ var self = this;
+ var pid;
+ var bashrc = 'git config --global user.name "John Doe"\n' +
+ 'git config --global user.email johndoe@example.com\n';
+ return Promise.resolve().then(function() {
+ return self.initFileSystem();
+ }).then(function() {
+ return self.writeFile('/home/user/.bashrc', bashrc);
+ }).then(function() {
+ return self.checkCommand('source ~/.bashrc');
+ }).then(function() {
+ return self.checkCommand('mkdir work');
+ }).then(function() {
+ return self.checkCommand(
+ 'cd work && ' +
+ 'curl http://nacltools.storage.googleapis.com/io2014/voronoi.zip -O');
+ }).then(function() {
+ return self.checkCommand('cd work && ls', 0, 'voronoi.zip\n');
+ }).then(function() {
+ return self.checkCommand('cd work && unzip voronoi.zip');
+ }).then(function() {
+ return self.checkCommand('cd work/voronoi && ls Makefile', 0, 'Makefile\n');
+ }).then(function() {
+ return self.checkCommand('cd work/voronoi && git init');
+ }).then(function() {
+ return self.checkCommand('cd work/voronoi && git add .');
+ }).then(function() {
+ return self.checkCommand(
+ 'cd work/voronoi && git commit -m "imported voronoi demo"');
+ }).then(function() {
+ if (self.params['TOOLCHAIN'] === 'glibc' &&
+ self.params['SYS_ARCH'] === 'x86_64') {
+ return Promise.resolve().then(function() {
+ return self.checkCommand('cd work/voronoi && make voronoi.nexe');
+ }).then(function() {
+ chrometest.info('spawn voronoi');
+ return self.spawnCommand('cd work/voronoi && make voronoi');
+ }).then(function(msg) {
+ pid = msg.pid;
+ chrometest.info('got pid ' + pid);
+ return chrometest.sleep(3000);
+ }).then(function(msg) {
+ chrometest.info('killing');
+ self.sigint();
+ return self.waitCommand(pid);
+ }).then(function(msg) {
+ chrometest.info('done killing');
+ ASSERT_EQ(2, msg.status, 'Expect 2 from make');
+ });
+ } else {
+ // TODO(bradnelson): Fix other combinations.
+ chrometest.info('skipping unsupported toolchain / arch to build on');
+ }
+ });
+});
+
+// Test of the Chrome Dev Summit cpp tutorial at:
+// https://developer.chrome.com/native-client/cds2014/cpp
+TEST_F(DevEnvTest, 'testCDS2014', function() {
+ var self = this;
+ var pid;
+ var bashrc = 'git config --global user.name "John Doe"\n' +
+ 'git config --global user.email johndoe@example.com\n';
+ return Promise.resolve().then(function() {
+ return self.initFileSystem();
+ }).then(function() {
+ return self.writeFile('/home/user/.bashrc', bashrc);
+ }).then(function() {
+ return self.checkCommand('source ~/.bashrc');
+ }).then(function() {
+ return self.checkCommand('mkdir work2');
+ }).then(function() {
+ return self.checkCommand(
+ 'cd work2 && ' +
+ 'curl https://nacltools.storage.googleapis.com/' +
+ 'cds2014/cds2014_cpp.zip -O');
+ }).then(function() {
+ return self.checkCommand('cd work2 && ls', 0, 'cds2014_cpp.zip\n');
+ }).then(function() {
+ return self.checkCommand('cd work2 && unzip cds2014_cpp.zip');
+ }).then(function() {
+ return self.checkCommand(
+ 'cd work2/cds2014_cpp && ls Makefile', 0, 'Makefile\n');
+ }).then(function() {
+ return self.checkCommand('cd work2/cds2014_cpp && git init');
+ }).then(function() {
+ return self.checkCommand('cd work2/cds2014_cpp && git add .');
+ }).then(function() {
+ return self.checkCommand(
+ 'cd work2/cds2014_cpp && git commit -m "imported cds2014_cpp demo"');
+ }).then(function() {
+ if (self.params['TOOLCHAIN'] === 'glibc' &&
+ self.params['SYS_ARCH'] === 'x86_64') {
+ return Promise.resolve().then(function() {
+ return self.checkCommand('cd work2/cds2014_cpp && make');
+ }).then(function() {
+ chrometest.info('spawn fire');
+ return self.spawnCommand('cd work2/cds2014_cpp && make fire');
+ }).then(function(msg) {
+ pid = msg.pid;
+ chrometest.info('got pid ' + pid);
+ return chrometest.sleep(3000);
+ }).then(function(msg) {
+ chrometest.info('killing');
+ self.sigint();
+ return self.waitCommand(pid);
+ }).then(function(msg) {
+ chrometest.info('done killing');
+ ASSERT_EQ(2, msg.status, 'Expect 2 from make');
+ });
+ } else {
+ // TODO(bradnelson): Fix other combinations.
+ chrometest.info('skipping unsupported toolchain / arch to build on');
+ }
+ });
+});
« no previous file with comments | « ports/devenv/tests/demo2014_test.html ('k') | ports/devenv/tests/devenv_small_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698