about summary refs log tree commit diff
path: root/src/etc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-11-28 17:58:58 +0000
committerbors <bors@rust-lang.org>2017-11-28 17:58:58 +0000
commit71340ca4e181b824bcefa887f1be60dd0b7352ce (patch)
treedfff87c0583208025944813532cbe3f0361926f0 /src/etc
parent5a59704525963a135359fdbcba78da796b64ab5c (diff)
parent73970bf6f287b93ebd9775783652217e1aca02d3 (diff)
downloadrust-71340ca4e181b824bcefa887f1be60dd0b7352ce.tar.gz
rust-71340ca4e181b824bcefa887f1be60dd0b7352ce.zip
Auto merge of #46291 - alexcrichton:wasm-tests, r=kennytm
ci: Start running wasm32 tests on Travis

This commit allocates a builder to running wasm32 tests on Travis. Not all test
suites pass right now so this is starting out with just the run-pass and the
libcore test suites. This'll hopefully give us a pretty broad set of coverage
for integration in rustc itself as well as a somewhat broad coverage of the llvm
backend itself through integration/unit tests.
Diffstat (limited to 'src/etc')
-rw-r--r--src/etc/wasm32-shim.js16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/etc/wasm32-shim.js b/src/etc/wasm32-shim.js
index b595cc12053..d55083e0f8e 100644
--- a/src/etc/wasm32-shim.js
+++ b/src/etc/wasm32-shim.js
@@ -45,8 +45,8 @@ imports.env = {
   exp2f: function(x) { return Math.pow(2, x); },
   ldexp: function(x, y) { return x * Math.pow(2, y); },
   ldexpf: function(x, y) { return x * Math.pow(2, y); },
-  log10: function(x) { return Math.log10(x); },
-  log10f: function(x) { return Math.log10(x); },
+  log10: Math.log10,
+  log10f: Math.log10,
 
   // These are called in src/libstd/sys/wasm/stdio.rs and are used when
   // debugging is enabled.
@@ -71,14 +71,12 @@ imports.env = {
     return process.argv.length - 2;
   },
   rust_wasm_args_arg_size: function(i) {
-    return process.argv[i + 2].length;
+    return Buffer.byteLength(process.argv[i + 2]);
   },
   rust_wasm_args_arg_fill: function(idx, ptr) {
     let arg = process.argv[idx + 2];
     let view = new Uint8Array(memory.buffer);
-    for (var i = 0; i < arg.length; i++) {
-      view[ptr + i] = arg.charCodeAt(i);
-    }
+    Buffer.from(arg).copy(view, ptr);
   },
 
   // These are called in src/libstd/sys/wasm/os.rs and are used when
@@ -91,15 +89,13 @@ imports.env = {
     if (!(key in process.env)) {
       return -1;
     }
-    return process.env[key].length;
+    return Buffer.byteLength(process.env[key]);
   },
   rust_wasm_getenv_data: function(a, b, ptr) {
     let key = copystr(a, b);
     let value = process.env[key];
     let view = new Uint8Array(memory.buffer);
-    for (var i = 0; i < value.length; i++) {
-      view[ptr + i] = value.charCodeAt(i);
-    }
+    Buffer.from(value).copy(view, ptr);
   },
 };