From 152a52054b8ebf86f5046c370b6d8a9b9e2c48e3 Mon Sep 17 00:00:00 2001 From: xicilion Date: Thu, 26 May 2022 12:53:55 +0000 Subject: [PATCH] test, bugfix: test error on mips64 linux. --- test/http_test.js | 15 ++++++++++----- test/test_util.js | 3 ++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/test/http_test.js b/test/http_test.js index 8418e7c539..8b9e3d8ad6 100644 --- a/test/http_test.js +++ b/test/http_test.js @@ -2052,11 +2052,15 @@ describe("http", () => { describe("head", () => { before(() => { - http.request("HEAD", "https://localhost:" + (8883 + base_port) + "/clear_cookie"); + try { + http.request("HEAD", "https://localhost:" + (8883 + base_port) + "/clear_cookie"); + } catch (e) { } }) after(() => { - http.request("HEAD", "https://localhost:" + (8883 + base_port) + "/clear_cookie"); + try { + http.request("HEAD", "https://localhost:" + (8883 + base_port) + "/clear_cookie"); + } catch (e) { } }) it("simple", () => { @@ -2081,9 +2085,10 @@ describe("http", () => { it("async", (done) => { http.request('HEAD', "https://localhost:" + (8883 + base_port) + "/request", (e, r) => { - assert.equal(r.data, null); - assert.equal(r.headers['no_test_header'], "true"); - done(); + done(() => { + assert.equal(r.data, null); + assert.equal(r.headers['no_test_header'], "true"); + }); }); }); }); diff --git a/test/test_util.js b/test/test_util.js index fabc53d9b9..c965410a46 100644 --- a/test/test_util.js +++ b/test/test_util.js @@ -40,7 +40,8 @@ exports.makeid = length => { } exports.gc = () => { - for (var i = 0; i < 20; i++) { + var t1 = new Date(); + while (new Date() - t1 < 1000) { coroutine.sleep(1); GC(); }