summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common.h19
-rw-r--r--test/spec/binary.txt42
-rw-r--r--test/spec/custom_section.txt14
-rw-r--r--test/spec/float_exprs.txt2
-rw-r--r--test/spec/float_misc.txt2
-rw-r--r--test/spec/names.txt2
m---------third_party/testsuite0
7 files changed, 58 insertions, 23 deletions
diff --git a/src/common.h b/src/common.h
index 3692aa45..9560cd1c 100644
--- a/src/common.h
+++ b/src/common.h
@@ -17,14 +17,13 @@
#ifndef WABT_COMMON_H_
#define WABT_COMMON_H_
-#include <assert.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
+#include <cassert>
+#include <cstdarg>
+#include <cstddef>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <string>
#include <type_traits>
#include <vector>
@@ -236,7 +235,9 @@ static WABT_INLINE char* wabt_strndup(const char* s, size_t len) {
static WABT_INLINE StringSlice dup_string_slice(StringSlice str) {
StringSlice result;
- result.start = wabt_strndup(str.start, str.length);
+ char* new_data = new char[str.length];
+ memcpy(new_data, str.start, str.length);
+ result.start = new_data;
result.length = str.length;
return result;
}
diff --git a/test/spec/binary.txt b/test/spec/binary.txt
index 5dd13df6..42346495 100644
--- a/test/spec/binary.txt
+++ b/test/spec/binary.txt
@@ -15,17 +15,47 @@ out/third_party/testsuite/binary.wast:11: assert_malformed passed:
error: @0x00000004: bad magic value
out/third_party/testsuite/binary.wast:12: assert_malformed passed:
error: @0x00000004: bad magic value
+out/third_party/testsuite/binary.wast:13: assert_malformed passed:
+ error: @0x00000004: bad magic value
out/third_party/testsuite/binary.wast:14: assert_malformed passed:
- error: @0x00000004: unable to read uint32_t: version
+ error: @0x00000004: bad magic value
out/third_party/testsuite/binary.wast:15: assert_malformed passed:
- error: @0x00000004: unable to read uint32_t: version
+ error: @0x00000004: bad magic value
out/third_party/testsuite/binary.wast:16: assert_malformed passed:
- error: @0x00000004: unable to read uint32_t: version
+ error: @0x00000004: bad magic value
out/third_party/testsuite/binary.wast:17: assert_malformed passed:
- error: @0x00000008: bad wasm file version: 0xd (expected 0x1)
+ error: @0x00000004: bad magic value
out/third_party/testsuite/binary.wast:18: assert_malformed passed:
+ error: @0x00000004: bad magic value
+out/third_party/testsuite/binary.wast:21: assert_malformed passed:
+ error: @0x00000004: bad magic value
+out/third_party/testsuite/binary.wast:24: assert_malformed passed:
+ error: @0x00000004: bad magic value
+out/third_party/testsuite/binary.wast:25: assert_malformed passed:
+ error: @0x00000004: bad magic value
+out/third_party/testsuite/binary.wast:28: assert_malformed passed:
+ error: @0x00000004: bad magic value
+out/third_party/testsuite/binary.wast:31: assert_malformed passed:
+ error: @0x00000004: bad magic value
+out/third_party/testsuite/binary.wast:34: assert_malformed passed:
+ error: @0x00000004: bad magic value
+out/third_party/testsuite/binary.wast:36: assert_malformed passed:
+ error: @0x00000004: unable to read uint32_t: version
+out/third_party/testsuite/binary.wast:37: assert_malformed passed:
+ error: @0x00000004: unable to read uint32_t: version
+out/third_party/testsuite/binary.wast:38: assert_malformed passed:
+ error: @0x00000004: unable to read uint32_t: version
+out/third_party/testsuite/binary.wast:39: assert_malformed passed:
+ error: @0x00000008: bad wasm file version: 0 (expected 0x1)
+out/third_party/testsuite/binary.wast:40: assert_malformed passed:
+ error: @0x00000008: bad wasm file version: 0xd (expected 0x1)
+out/third_party/testsuite/binary.wast:41: assert_malformed passed:
error: @0x00000008: bad wasm file version: 0xe (expected 0x1)
-out/third_party/testsuite/binary.wast:19: assert_malformed passed:
+out/third_party/testsuite/binary.wast:42: assert_malformed passed:
+ error: @0x00000008: bad wasm file version: 0x100 (expected 0x1)
+out/third_party/testsuite/binary.wast:43: assert_malformed passed:
+ error: @0x00000008: bad wasm file version: 0x10000 (expected 0x1)
+out/third_party/testsuite/binary.wast:44: assert_malformed passed:
error: @0x00000008: bad wasm file version: 0x1000000 (expected 0x1)
-13/13 tests passed.
+28/28 tests passed.
;;; STDOUT ;;)
diff --git a/test/spec/custom_section.txt b/test/spec/custom_section.txt
index 1f4797fa..4d094f60 100644
--- a/test/spec/custom_section.txt
+++ b/test/spec/custom_section.txt
@@ -1,13 +1,17 @@
;;; TOOL: run-interp-spec
;;; STDIN_FILE: third_party/testsuite/custom_section.wast
(;; STDOUT ;;;
-out/third_party/testsuite/custom_section.wast:58: assert_malformed passed:
+out/third_party/testsuite/custom_section.wast:61: assert_malformed passed:
+ error: @0x00000009: unable to read u32 leb128: section size
+out/third_party/testsuite/custom_section.wast:69: assert_malformed passed:
error: @0x0000000a: unable to read u32 leb128: string length
-out/third_party/testsuite/custom_section.wast:66: assert_malformed passed:
+out/third_party/testsuite/custom_section.wast:77: assert_malformed passed:
error: @0x0000000a: invalid section size: extends past end
-out/third_party/testsuite/custom_section.wast:74: assert_malformed passed:
+out/third_party/testsuite/custom_section.wast:85: assert_malformed passed:
error: @0x00000031: invalid section code: 36; max is 11
-out/third_party/testsuite/custom_section.wast:83: assert_malformed passed:
+out/third_party/testsuite/custom_section.wast:94: assert_malformed passed:
error: @0x0000003e: function signature count != function body count
-4/4 tests passed.
+out/third_party/testsuite/custom_section.wast:107: assert_malformed passed:
+ error: @0x0000000a: invalid section size: extends past end
+6/6 tests passed.
;;; STDOUT ;;)
diff --git a/test/spec/float_exprs.txt b/test/spec/float_exprs.txt
index 609ea23f..871dbca5 100644
--- a/test/spec/float_exprs.txt
+++ b/test/spec/float_exprs.txt
@@ -11,5 +11,5 @@ init(i32:8, f64:15.200000) =>
init(i32:16, f64:15.300000) =>
init(i32:24, f64:15.400000) =>
run(i32:32, f64:3.000000) =>
-800/800 tests passed.
+804/804 tests passed.
;;; STDOUT ;;)
diff --git a/test/spec/float_misc.txt b/test/spec/float_misc.txt
index b7255b2b..f5700ac1 100644
--- a/test/spec/float_misc.txt
+++ b/test/spec/float_misc.txt
@@ -1,5 +1,5 @@
;;; TOOL: run-interp-spec
;;; STDIN_FILE: third_party/testsuite/float_misc.wast
(;; STDOUT ;;;
-434/434 tests passed.
+440/440 tests passed.
;;; STDOUT ;;)
diff --git a/test/spec/names.txt b/test/spec/names.txt
index 303fe83a..03ae2893 100644
--- a/test/spec/names.txt
+++ b/test/spec/names.txt
@@ -4,5 +4,5 @@
called host spectest.print(i32:42) =>
called host spectest.print(i32:123) =>
print32(i32:42, i32:123) =>
-16/16 tests passed.
+475/475 tests passed.
;;; STDOUT ;;)
diff --git a/third_party/testsuite b/third_party/testsuite
-Subproject 4d6d74d6b51e998b8fe965e5fd298a099d1ea9b
+Subproject c4ec0044b99feb322fc63708907d0be0a3088ed