aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/bun.js/bun.lockbbin9014 -> 9014 bytes
-rw-r--r--test/bun.js/esbuild-child_process.test.ts29
-rw-r--r--test/bun.js/test-programs/bigpipe-r.c26
-rw-r--r--test/bun.js/test-programs/bigpipe-w.c26
4 files changed, 68 insertions, 13 deletions
diff --git a/test/bun.js/bun.lockb b/test/bun.js/bun.lockb
index ec2e87900..e7242571f 100755
--- a/test/bun.js/bun.lockb
+++ b/test/bun.js/bun.lockb
Binary files differ
diff --git a/test/bun.js/esbuild-child_process.test.ts b/test/bun.js/esbuild-child_process.test.ts
index 0d357a940..a7eb4f079 100644
--- a/test/bun.js/esbuild-child_process.test.ts
+++ b/test/bun.js/esbuild-child_process.test.ts
@@ -12,11 +12,14 @@ describe("child_process.spawn - esbuild", () => {
it("works for input exceeding the pipe capacity", async () => {
const hugeString = `console.log(${JSON.stringify("a".repeat(1000000))});`;
- const result = await transform(hugeString, {
- loader: "js",
- target: "node12",
- });
- expect(result.code).toBe(hugeString + "\n");
+
+ for (let i = 0; i < 2; i++) {
+ const result = await transform(hugeString, {
+ loader: "js",
+ target: "node12",
+ });
+ expect(result.code).toBe(hugeString + "\n");
+ }
});
});
@@ -35,12 +38,12 @@ describe("child_process.spawnSync - esbuild", () => {
// code: "13"
// syscall: "spawnSync"
// errno: -1
- // it("works for input exceeding the pipe capacity", () => {
- // const hugeString = `console.log(${JSON.stringify("a".repeat(100000))});`;
- // const result = transformSync(hugeString, {
- // loader: "js",
- // target: "node12",
- // });
- // expect(result.code).toBe(hugeString + "\n");
- // });
+ it("works for input exceeding the pipe capacity", () => {
+ const hugeString = `console.log(${JSON.stringify("a".repeat(100000))});`;
+ const result = transformSync(hugeString, {
+ loader: "js",
+ target: "node12",
+ });
+ expect(result.code).toBe(hugeString + "\n");
+ });
});
diff --git a/test/bun.js/test-programs/bigpipe-r.c b/test/bun.js/test-programs/bigpipe-r.c
new file mode 100644
index 000000000..1acd94f7b
--- /dev/null
+++ b/test/bun.js/test-programs/bigpipe-r.c
@@ -0,0 +1,26 @@
+#include <unistd.h>
+
+char one_mb_pipe_buf_1[1024 * 1024];
+
+ int main(int argc, char* argv[])
+ {
+ for (int i = 0; i < sizeof(one_mb_pipe_buf_1); i++) {
+ one_mb_pipe_buf_1[i] = i % 256;
+ }
+
+ while (1) {
+
+
+ size_t amt = 0;
+ size_t cnt = 0;
+
+ cnt = 0;
+ while (cnt < sizeof(one_mb_pipe_buf_1)) {
+ amt = read(0, one_mb_pipe_buf_1 + cnt, sizeof(one_mb_pipe_buf_1) - cnt);
+ if (amt == 0) {
+ break;
+ }
+ cnt += amt;
+ }
+ }
+ } \ No newline at end of file
diff --git a/test/bun.js/test-programs/bigpipe-w.c b/test/bun.js/test-programs/bigpipe-w.c
new file mode 100644
index 000000000..1acd94f7b
--- /dev/null
+++ b/test/bun.js/test-programs/bigpipe-w.c
@@ -0,0 +1,26 @@
+#include <unistd.h>
+
+char one_mb_pipe_buf_1[1024 * 1024];
+
+ int main(int argc, char* argv[])
+ {
+ for (int i = 0; i < sizeof(one_mb_pipe_buf_1); i++) {
+ one_mb_pipe_buf_1[i] = i % 256;
+ }
+
+ while (1) {
+
+
+ size_t amt = 0;
+ size_t cnt = 0;
+
+ cnt = 0;
+ while (cnt < sizeof(one_mb_pipe_buf_1)) {
+ amt = read(0, one_mb_pipe_buf_1 + cnt, sizeof(one_mb_pipe_buf_1) - cnt);
+ if (amt == 0) {
+ break;
+ }
+ cnt += amt;
+ }
+ }
+ } \ No newline at end of file