From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id E16746EC40; Fri, 24 Sep 2021 16:58:19 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E16746EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1632491900; bh=BIbyNmFapjEnhl/8Wq0ps404qwQhfHIzBHHGpzhtRjc=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=UIxUMqKZczZtrg+shE39mpYdLn9Q5nHcvmER88WG5ADMXHvD1oeCJKeZW7snlHHqN o9TcKA3MkdKLKU5zOCKAtFrCcxagE9ZVf/rt9H/SUCQ1ajlLqgpnk/EkCWEHPyf0U5 0h7HhLE2jA8Ubm6P/B/LUKWluHQafG8MlgLXcgyc= Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 7AD026EC40 for ; Fri, 24 Sep 2021 16:58:18 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 7AD026EC40 Received: by mail-lf1-f52.google.com with SMTP id g41so40611845lfv.1 for ; Fri, 24 Sep 2021 06:58:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=j/KRUPzCr8D+t71D79iFGK6iPjvox00k0fJk/Jde3Eg=; b=4Hf+NcV9yf3ckUj08Utrj+KkxkZx3Xf08NMsAJQvHEtJUOuRDPjei1Ho/PILcDVSu7 w+17VnXMdUb+Q9EcJhfFyIYR2tV06sj+pvmEoKcAHkzcdSbzxKsdTP6ug41VjM6vA3OP IFAy+g4x407Mp8CQfquSaYmtXStXuQLJ9aLbGFSP88B9G3pKbT6eWz1cK8Svpg6PrdqL +luGdimGVZ3po24U0PJOoGpLIS/+ivrxPSBxUd198CNKrFv/A8GEDd8fGWnHPbKssPRW 9Abb9CC1UleoR31yKdky9bbcFOjBY3fmUtgWForBTvrNq+q3xaZkobe22uZhYVO9t/WK Zr9w== X-Gm-Message-State: AOAM531RPpK6cnA6Zskgd052omoeF9xKrdyM7U512fWqF1j1qVx0DBi1 tn21UNCwaLFfQXiXReyRltGjp3TRC4F9Otm1 X-Google-Smtp-Source: ABdhPJzdgqCbFU02W8irRb+VWDiLyB57/E2jhkdjNwxJZxxr058lgvAv7j/yQ5yRCYVw9ZMNDJolCA== X-Received: by 2002:a05:6512:13a9:: with SMTP id p41mr6792318lfa.648.1632491897418; Fri, 24 Sep 2021 06:58:17 -0700 (PDT) Received: from localhost.localdomain ([93.175.11.199]) by smtp.gmail.com with ESMTPSA id f9sm762252lfp.273.2021.09.24.06.58.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Sep 2021 06:58:17 -0700 (PDT) X-Google-Original-From: Maxim Kokryashkin To: tarantool-patches@dev.tarantool.org, imun@tarantool.org, skaplun@tarantool.org Date: Fri, 24 Sep 2021 16:58:14 +0300 Message-Id: <20210924135814.58102-1-m.kokryashkin@tarantool.org> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH luajit] test: adapt disabled tests from PUC-Rio X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Maxim Kokryashkin via Tarantool-patches Reply-To: Maxim Kokryashkin Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Version and status are printed in stdout instead stderr since LuaJIT-2.0.0-beta11 (as it is not an error message). This behavior is the same as in Lua 5.2, so necessary changes in tests can be adapted from PUC-Rio Lua 5.2 test suite. Closes tarantool/tarantool#5687 --- Issue: https://github.com/tarantool/tarantool/issues/5687 Branch: https://github.com/tarantool/luajit/tree/fckxorg/gh-5687-adapt-tests-output-PUC-Rio test/PUC-Rio-Lua-5.1-tests/main.lua | 53 +++++++++++++++++++---------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/test/PUC-Rio-Lua-5.1-tests/main.lua b/test/PUC-Rio-Lua-5.1-tests/main.lua index 07facc4c..34e028f5 100644 --- a/test/PUC-Rio-Lua-5.1-tests/main.lua +++ b/test/PUC-Rio-Lua-5.1-tests/main.lua @@ -24,11 +24,33 @@ local prepfile = function (s, p) assert(io.close()) end -function checkout (s) +-- Taken from PUC-Rio Lua 5.2 test suite. +-- See comment for checkprogout(). +function getoutput () io.input(out) local t = io.read("*a") io.input():close() assert(os.remove(out)) + return t +end + +-- Version and status are printed in stdout instead stderr since +-- LuaJIT-2.0.0-beta11 (as it is not an error message). +-- See commit 0bd1a66f2f055211ef55834ccebca3b82d03c735 +-- (Print version and JIT status to stdout, not stderr.). +-- This behavior is the same as in Lua 5.2. +-- See also https://github.com/tarantool/tarantool/issues/5687. +-- This function is adapted from PUC-Rio Lua 5.2 test suite. +-- It is used for test commands with -i flag. +function checkprogout (s) + local t = getoutput() + for line in string.gmatch(s, ".-\n") do + assert(string.find(t, line, 1, true)) + end +end + +function checkout (s) + local t = getoutput() if s ~= t then print(string.format("'%s' - '%s'\n", s, t)) end assert(s == t) return t @@ -117,37 +139,32 @@ prepfile[[ RUN("lua - < %s > %s", prog, out) checkout("1\tnil\n") --- FIXME: Version and status are printed to stdout instead of --- stderr since LuaJIT-2.0.0-beta11 (as it is not an error --- message). See commit 0bd1a66f2f055211ef55834ccebca3b82d03c735 --- (Print version and JIT status to stdout, not stderr.). --- This behavior is the same as in Lua 5.2. --- In Lua 5.2 this feature was introduced via commit --- 9e7de9473c65baee1f567852a778f2d33a47ea83. --- See also https://github.com/tarantool/tarantool/issues/5687. +-- Test is adapted from PUC-Rio Lua 5.2 test suite. +-- See comment for checkprogout(). prepfile[[ = (6*2-6) -- === a = 10 print(a) = a]] --- FIXME: Behavior is different for LuaJIT. See the comment above. --- RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out) --- checkout("6\n10\n10\n\n") +RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out) +checkprogout("6\n10\n10\n\n") +-- Test is adapted from PUC-Rio Lua 5.2 test suite. +-- See comment for checkprogout(). prepfile("a = [[b\nc\nd\ne]]\n=a") print(prog) --- FIXME: Behavior is different for LuaJIT. See the comment above. --- RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out) --- checkout("b\nc\nd\ne\n\n") +RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out) +checkprogout("b\nc\nd\ne\n\n") +-- Test is adapted from PUC-Rio Lua 5.2 test suite. +-- See comment for checkprogout(). prompt = "alo" prepfile[[ -- a = 2 ]] --- FIXME: Behavior is different for LuaJIT. See the comment above. --- RUN([[lua "-e_PROMPT='%s'" -i < %s > %s]], prompt, prog, out) --- checkout(string.rep(prompt, 3).."\n") +RUN([[lua "-e_PROMPT='%s'" -i < %s > %s]], prompt, prog, out) +checkprogout(string.rep(prompt, 3).."\n") s = [=[ -- function f ( x ) -- 2.33.0