From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id oEK3KeA18Gb48QAAe85BDQ:P1 (envelope-from ) for ; Sun, 22 Sep 2024 17:21:04 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id oEK3KeA18Gb48QAAe85BDQ (envelope-from ) for ; Sun, 22 Sep 2024 17:21:04 +0200 X-Envelope-To: patches@johnnyrichard.com Authentication-Results: aspmx1.migadu.com; none Received: from mail-a.sr.ht (mail-a.sr.ht [46.23.81.152]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9A86834E2B for ; Sun, 22 Sep 2024 17:21:04 +0200 (CEST) DKIM-Signature: a=rsa-sha256; bh=30TpuVgW9hR27GdvZUVbTx1QcP/oCiu2u+tUbhzKqC4=; c=simple/simple; d=lists.sr.ht; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Unsubscribe:List-Subscribe:List-Archive:List-Post:List-ID; q=dns/txt; s=20240113; t=1727018463; v=1; b=Ts8z8SRYJMEtArYjOVGj1sQOboDDqC0uqBT+xCqdaxEGO+TH8P8AWeRtw9n+yU5qodnnx8Xs 7npqp4A8sYyrQpHF63mtlNlbRNfOo571OFVDJH+jbg7CwzIhr6UdjiD9KnBiEy9WfXLrgM8CZ8F 5WL3pXOJsu9CofR3ZV0mYUbzoyGzeWtINcE5NB4+TncZr083SKVylV0hsZMhbz4mJOdXAvu2oxF shbcKip51xX6taEHV4ACsQHSZYVp9wm20vj/GBczlyno33a4IhSS9Fs/TOiu6zJiVFvNbg6AR0M dXLJCK3xuPHI6Xtc+SDn8k2pxgO/gnwuu1qjH7kIKC5bg== Received: from lists.sr.ht (unknown [46.23.81.154]) by mail-a.sr.ht (Postfix) with ESMTPSA id 7A3C22027E for ; Sun, 22 Sep 2024 15:21:03 +0000 (UTC) Received: from out-187.mta1.migadu.com (out-187.mta1.migadu.com [95.215.58.187]) by mail-a.sr.ht (Postfix) with ESMTPS id BA6F420186 for <~johnnyrichard/olang-devel@lists.sr.ht>; Sun, 22 Sep 2024 15:21:02 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=johnnyrichard.com; s=key1; t=1727018462; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z5i+BE+O33Qj/Wu4arzHor/JFwSgBVIKvP8lahhf6Ok=; b=X9rS7mf6wId+C/1tvkw2L2x3X3m27D91SbVTVb72hLJn+LLJlIENL0M7rVWg2TlMPUG8DI mvTgwwDutKcHE3of8GfsigaqGRWr8YTZGwFqgMxXVFz7KtZEw6I0qdnGWjg51Xby5sak9s aYo0ebc0jEdrASv8sjjFmoT6I42D42PwpvSfQeN/u6KKvcQc0rs4VndyArkxJotrvIU6MU 285EZw4NwWSZqmmnYYb0AWmoXExA/Z6MZXnSAddbsxGYUw6ZShkxzGOvyZWyzc8p5PB5Tv dwQm3dRjN+IeDcrrKIrPCUnv/LZE5v8ffnMZjnYZaCO95pcCE+VGt+mksFrW/g== From: Johnny Richard To: ~johnnyrichard/olang-devel@lists.sr.ht Cc: Johnny Richard Subject: [PATCH olang v2 2/3] tests: build: enhance compiler tests Date: Sun, 22 Sep 2024 17:15:55 +0200 Message-ID: <20240922152119.1214443-3-johnny@johnnyrichard.com> In-Reply-To: <20240922152119.1214443-1-johnny@johnnyrichard.com> References: <20240922152119.1214443-1-johnny@johnnyrichard.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Sourcehut-Patchset-Status: UNKNOWN List-Unsubscribe: List-Subscribe: List-Archive: Archived-At: List-Post: List-ID: ~johnnyrichard/olang-devel <~johnnyrichard/olang-devel.lists.sr.ht> Sender: ~johnnyrichard/olang-devel <~johnnyrichard/olang-devel@lists.sr.ht> X-Migadu-Flow: FLOW_IN X-Migadu-Country: NL X-Migadu-Spam-Score: -4.00 X-Spam-Score: -4.00 X-Migadu-Queue-Id: 9A86834E2B X-Migadu-Scanner: mx10.migadu.com X-TUID: +YjHaYpBNc+D There was two problem with the current state of our integration tests: 1) The folder structure is very annoying and long to navigate, the last tests folder mess with the shell autocomplete because it has almost the same name as the tests.sh script. 2) When we run the make all for integration tests, we are not using the make how it was intended to be used. We have inline shell script that loop over all tests and we cannot run tests in parallel. This change will enable the parallelization and reduce the folder structure so we can have a better development experience. Signed-off-by: Johnny Richard --- Makefile | 10 +++---- tests/integration/Makefile | 9 ------- .../tests => olc}/0001_main_exit.ol | 24 ++++++++--------- .../0002_binary_operator_addition.ol | 0 .../0003_binary_operator_multiplication.ol | 0 .../0004_binary_operator_division.ol | 0 .../0005_binary_operator_reminder.ol | 0 .../0006_binary_operator_subtraction.ol | 0 .../tests => olc}/0007_binary_operator_eq.ol | 0 .../tests => olc}/0008_binary_operator_lt.ol | 0 .../tests => olc}/0009_binary_operator_gt.ol | 0 .../tests => olc}/0010_binary_operator_neq.ol | 0 .../tests => olc}/0011_binary_operator_leq.ol | 0 .../tests => olc}/0012_binary_operator_geq.ol | 0 .../0013_binary_operator_lshift.ol | 0 .../0014_binary_operator_rshift.ol | 0 .../tests => olc}/0015_binary_operator_xor.ol | 2 +- .../tests => olc}/0016_binary_operator_and.ol | 0 .../tests => olc}/0017_binary_operator_or.ol | 0 .../0018_binary_operator_logical_and.ol | 0 .../0019_binary_operator_logical_or.ol | 0 .../tests => olc}/0020_if_statement.ol | 2 +- .../tests => olc}/0021_if_statement_failed.ol | 0 .../0022_if_statement_literal.ol | 0 .../tests => olc}/0023_else_statement.ol | 2 +- .../tests => olc}/0024_var_definition.ol | 2 +- .../0025_var_definition_nested.ol | 0 .../tests => olc}/0026_primitive_unsigneds.ol | 0 tests/olc/0026_primitive_unsigneds.ol.orig | 27 +++++++++++++++++++ tests/olc/Makefile | 15 +++++++++++ tests/{integration/test.sh => olc/run.sh} | 0 31 files changed, 62 insertions(+), 31 deletions(-) delete mode 100644 tests/integration/Makefile rename tests/{integration/tests => olc}/0001_main_exit.ol (66%) rename tests/{integration/tests => olc}/0002_binary_operator_addition.ol (100%) rename tests/{integration/tests => olc}/0003_binary_operator_multiplication.ol (100%) rename tests/{integration/tests => olc}/0004_binary_operator_division.ol (100%) rename tests/{integration/tests => olc}/0005_binary_operator_reminder.ol (100%) rename tests/{integration/tests => olc}/0006_binary_operator_subtraction.ol (100%) rename tests/{integration/tests => olc}/0007_binary_operator_eq.ol (100%) rename tests/{integration/tests => olc}/0008_binary_operator_lt.ol (100%) rename tests/{integration/tests => olc}/0009_binary_operator_gt.ol (100%) rename tests/{integration/tests => olc}/0010_binary_operator_neq.ol (100%) rename tests/{integration/tests => olc}/0011_binary_operator_leq.ol (100%) rename tests/{integration/tests => olc}/0012_binary_operator_geq.ol (100%) rename tests/{integration/tests => olc}/0013_binary_operator_lshift.ol (100%) rename tests/{integration/tests => olc}/0014_binary_operator_rshift.ol (100%) rename tests/{integration/tests => olc}/0015_binary_operator_xor.ol (96%) rename tests/{integration/tests => olc}/0016_binary_operator_and.ol (100%) rename tests/{integration/tests => olc}/0017_binary_operator_or.ol (100%) rename tests/{integration/tests => olc}/0018_binary_operator_logical_and.ol (100%) rename tests/{integration/tests => olc}/0019_binary_operator_logical_or.ol (100%) rename tests/{integration/tests => olc}/0020_if_statement.ol (96%) rename tests/{integration/tests => olc}/0021_if_statement_failed.ol (100%) rename tests/{integration/tests => olc}/0022_if_statement_literal.ol (100%) rename tests/{integration/tests => olc}/0023_else_statement.ol (96%) rename tests/{integration/tests => olc}/0024_var_definition.ol (96%) rename tests/{integration/tests => olc}/0025_var_definition_nested.ol (100%) rename tests/{integration/tests => olc}/0026_primitive_unsigneds.ol (100%) create mode 100644 tests/olc/0026_primitive_unsigneds.ol.orig create mode 100644 tests/olc/Makefile rename tests/{integration/test.sh => olc/run.sh} (100%) diff --git a/Makefile b/Makefile index 0603526..7dbde3e 100644 --- a/Makefile +++ b/Makefile @@ -89,10 +89,9 @@ format-fix: $(SRCS) $(HEADERS) clang-format -i $? $(MAKE) -C tests/unit/ format-fix -.PHONY: integration-test -integration-test: - $(MAKE) - $(MAKE) -C tests/integration/ +.PHONY: check-olc +check-olc: $(TARGET) + $(MAKE) -C tests/olc/ .PHONY: unit-test unit-test: @@ -106,9 +105,8 @@ clean: @rm -rf build/ $(TARGET) .PHONY: check -check: +check: check-olc $(MAKE) - $(MAKE) -C tests/integration/ $(MAKE) -C tests/unit/ .PHONY: docs diff --git a/tests/integration/Makefile b/tests/integration/Makefile deleted file mode 100644 index bda51af..0000000 --- a/tests/integration/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -TESTER_SRC := ./test.sh -TESTS := $(wildcard ./tests/*.ol) - -.PHONY: all -all: - @set -e; \ - for file in $(TESTS); do \ - $(TESTER_SRC) "$$file"; \ - done diff --git a/tests/integration/tests/0001_main_exit.ol b/tests/olc/0001_main_exit.ol similarity index 66% rename from tests/integration/tests/0001_main_exit.ol rename to tests/olc/0001_main_exit.ol index 9068434..b8abf45 100644 --- a/tests/integration/tests/0001_main_exit.ol +++ b/tests/olc/0001_main_exit.ol @@ -31,16 +31,16 @@ fn main(): u32 { # END # # TEST test_contains_tokens WITH -# ./tests/0001_main_exit.ol:17:1: -# ./tests/0001_main_exit.ol:17:4: -# ./tests/0001_main_exit.ol:17:8: <(> -# ./tests/0001_main_exit.ol:17:9: <)> -# ./tests/0001_main_exit.ol:17:10: <:> -# ./tests/0001_main_exit.ol:17:12: -# ./tests/0001_main_exit.ol:17:16: <{> -# ./tests/0001_main_exit.ol:17:17: -# ./tests/0001_main_exit.ol:18:3: -# ./tests/0001_main_exit.ol:18:10: -# ./tests/0001_main_exit.ol:18:11: -# ./tests/0001_main_exit.ol:19:1: <}> +# ./0001_main_exit.ol:17:1: +# ./0001_main_exit.ol:17:4: +# ./0001_main_exit.ol:17:8: <(> +# ./0001_main_exit.ol:17:9: <)> +# ./0001_main_exit.ol:17:10: <:> +# ./0001_main_exit.ol:17:12: +# ./0001_main_exit.ol:17:16: <{> +# ./0001_main_exit.ol:17:17: +# ./0001_main_exit.ol:18:3: +# ./0001_main_exit.ol:18:10: +# ./0001_main_exit.ol:18:11: +# ./0001_main_exit.ol:19:1: <}> # END diff --git a/tests/integration/tests/0002_binary_operator_addition.ol b/tests/olc/0002_binary_operator_addition.ol similarity index 100% rename from tests/integration/tests/0002_binary_operator_addition.ol rename to tests/olc/0002_binary_operator_addition.ol diff --git a/tests/integration/tests/0003_binary_operator_multiplication.ol b/tests/olc/0003_binary_operator_multiplication.ol similarity index 100% rename from tests/integration/tests/0003_binary_operator_multiplication.ol rename to tests/olc/0003_binary_operator_multiplication.ol diff --git a/tests/integration/tests/0004_binary_operator_division.ol b/tests/olc/0004_binary_operator_division.ol similarity index 100% rename from tests/integration/tests/0004_binary_operator_division.ol rename to tests/olc/0004_binary_operator_division.ol diff --git a/tests/integration/tests/0005_binary_operator_reminder.ol b/tests/olc/0005_binary_operator_reminder.ol similarity index 100% rename from tests/integration/tests/0005_binary_operator_reminder.ol rename to tests/olc/0005_binary_operator_reminder.ol diff --git a/tests/integration/tests/0006_binary_operator_subtraction.ol b/tests/olc/0006_binary_operator_subtraction.ol similarity index 100% rename from tests/integration/tests/0006_binary_operator_subtraction.ol rename to tests/olc/0006_binary_operator_subtraction.ol diff --git a/tests/integration/tests/0007_binary_operator_eq.ol b/tests/olc/0007_binary_operator_eq.ol similarity index 100% rename from tests/integration/tests/0007_binary_operator_eq.ol rename to tests/olc/0007_binary_operator_eq.ol diff --git a/tests/integration/tests/0008_binary_operator_lt.ol b/tests/olc/0008_binary_operator_lt.ol similarity index 100% rename from tests/integration/tests/0008_binary_operator_lt.ol rename to tests/olc/0008_binary_operator_lt.ol diff --git a/tests/integration/tests/0009_binary_operator_gt.ol b/tests/olc/0009_binary_operator_gt.ol similarity index 100% rename from tests/integration/tests/0009_binary_operator_gt.ol rename to tests/olc/0009_binary_operator_gt.ol diff --git a/tests/integration/tests/0010_binary_operator_neq.ol b/tests/olc/0010_binary_operator_neq.ol similarity index 100% rename from tests/integration/tests/0010_binary_operator_neq.ol rename to tests/olc/0010_binary_operator_neq.ol diff --git a/tests/integration/tests/0011_binary_operator_leq.ol b/tests/olc/0011_binary_operator_leq.ol similarity index 100% rename from tests/integration/tests/0011_binary_operator_leq.ol rename to tests/olc/0011_binary_operator_leq.ol diff --git a/tests/integration/tests/0012_binary_operator_geq.ol b/tests/olc/0012_binary_operator_geq.ol similarity index 100% rename from tests/integration/tests/0012_binary_operator_geq.ol rename to tests/olc/0012_binary_operator_geq.ol diff --git a/tests/integration/tests/0013_binary_operator_lshift.ol b/tests/olc/0013_binary_operator_lshift.ol similarity index 100% rename from tests/integration/tests/0013_binary_operator_lshift.ol rename to tests/olc/0013_binary_operator_lshift.ol diff --git a/tests/integration/tests/0014_binary_operator_rshift.ol b/tests/olc/0014_binary_operator_rshift.ol similarity index 100% rename from tests/integration/tests/0014_binary_operator_rshift.ol rename to tests/olc/0014_binary_operator_rshift.ol diff --git a/tests/integration/tests/0015_binary_operator_xor.ol b/tests/olc/0015_binary_operator_xor.ol similarity index 96% rename from tests/integration/tests/0015_binary_operator_xor.ol rename to tests/olc/0015_binary_operator_xor.ol index c5c0568..07b6b4a 100644 --- a/tests/integration/tests/0015_binary_operator_xor.ol +++ b/tests/olc/0015_binary_operator_xor.ol @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# spec: Binary operator ^ +# spec: Binary operator ^ fn main(): u32 { return 10 ^ 11 } diff --git a/tests/integration/tests/0016_binary_operator_and.ol b/tests/olc/0016_binary_operator_and.ol similarity index 100% rename from tests/integration/tests/0016_binary_operator_and.ol rename to tests/olc/0016_binary_operator_and.ol diff --git a/tests/integration/tests/0017_binary_operator_or.ol b/tests/olc/0017_binary_operator_or.ol similarity index 100% rename from tests/integration/tests/0017_binary_operator_or.ol rename to tests/olc/0017_binary_operator_or.ol diff --git a/tests/integration/tests/0018_binary_operator_logical_and.ol b/tests/olc/0018_binary_operator_logical_and.ol similarity index 100% rename from tests/integration/tests/0018_binary_operator_logical_and.ol rename to tests/olc/0018_binary_operator_logical_and.ol diff --git a/tests/integration/tests/0019_binary_operator_logical_or.ol b/tests/olc/0019_binary_operator_logical_or.ol similarity index 100% rename from tests/integration/tests/0019_binary_operator_logical_or.ol rename to tests/olc/0019_binary_operator_logical_or.ol diff --git a/tests/integration/tests/0020_if_statement.ol b/tests/olc/0020_if_statement.ol similarity index 96% rename from tests/integration/tests/0020_if_statement.ol rename to tests/olc/0020_if_statement.ol index 460a05e..9756bb1 100644 --- a/tests/integration/tests/0020_if_statement.ol +++ b/tests/olc/0020_if_statement.ol @@ -24,7 +24,7 @@ fn main(): u32 { # TEST test_run_binary(exit_code=0) # # TEST test_contains_tokens WITH -# ./tests/0020_if_statement.ol:17:3: +# ./0020_if_statement.ol:17:3: # END # TEST test_ast WITH diff --git a/tests/integration/tests/0021_if_statement_failed.ol b/tests/olc/0021_if_statement_failed.ol similarity index 100% rename from tests/integration/tests/0021_if_statement_failed.ol rename to tests/olc/0021_if_statement_failed.ol diff --git a/tests/integration/tests/0022_if_statement_literal.ol b/tests/olc/0022_if_statement_literal.ol similarity index 100% rename from tests/integration/tests/0022_if_statement_literal.ol rename to tests/olc/0022_if_statement_literal.ol diff --git a/tests/integration/tests/0023_else_statement.ol b/tests/olc/0023_else_statement.ol similarity index 96% rename from tests/integration/tests/0023_else_statement.ol rename to tests/olc/0023_else_statement.ol index f3ddc64..389e0d4 100644 --- a/tests/integration/tests/0023_else_statement.ol +++ b/tests/olc/0023_else_statement.ol @@ -26,7 +26,7 @@ fn main(): u32 { # TEST test_run_binary(exit_code=0) # TEST test_contains_tokens WITH -# ./tests/0023_else_statement.ol:19:5: +# ./0023_else_statement.ol:19:5: # END # TEST test_ast WITH diff --git a/tests/integration/tests/0024_var_definition.ol b/tests/olc/0024_var_definition.ol similarity index 96% rename from tests/integration/tests/0024_var_definition.ol rename to tests/olc/0024_var_definition.ol index ebbcda4..65deffc 100644 --- a/tests/integration/tests/0024_var_definition.ol +++ b/tests/olc/0024_var_definition.ol @@ -23,7 +23,7 @@ fn main(): u32 { # TEST test_run_binary(exit_code=0) # TEST test_contains_tokens WITH -# ./tests/0024_var_definition.ol:17:3: +# ./0024_var_definition.ol:17:3: # END # TEST test_ast WITH diff --git a/tests/integration/tests/0025_var_definition_nested.ol b/tests/olc/0025_var_definition_nested.ol similarity index 100% rename from tests/integration/tests/0025_var_definition_nested.ol rename to tests/olc/0025_var_definition_nested.ol diff --git a/tests/integration/tests/0026_primitive_unsigneds.ol b/tests/olc/0026_primitive_unsigneds.ol similarity index 100% rename from tests/integration/tests/0026_primitive_unsigneds.ol rename to tests/olc/0026_primitive_unsigneds.ol diff --git a/tests/olc/0026_primitive_unsigneds.ol.orig b/tests/olc/0026_primitive_unsigneds.ol.orig new file mode 100644 index 0000000..25f0f7e --- /dev/null +++ b/tests/olc/0026_primitive_unsigneds.ol.orig @@ -0,0 +1,27 @@ +# Copyright (C) 2024 olang mantainers +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +fn main(): u64 { + var a: u8 = 255 + var b: u16 = 65535 + var c: u32 = 4294967295 + var d: u64 = 4294967296 + + return a + b + c + d - a - b - c - d +} + +# TEST test_compile(exit_code=0) + +# TEST test_run_binary(exit_code=0) diff --git a/tests/olc/Makefile b/tests/olc/Makefile new file mode 100644 index 0000000..c736a78 --- /dev/null +++ b/tests/olc/Makefile @@ -0,0 +1,15 @@ +.POSIX: + +RUNNER := ./run.sh +SRCS := $(wildcard *.ol) +TESTS := $(patsubst %.ol, %.run, $(SRCS)) + +.SUFFIXES: +.SUFFIXES: .ol .run + +.PHONY: all +all: $(TESTS) + +.ol.run: + @$(RUNNER) ./$< + diff --git a/tests/integration/test.sh b/tests/olc/run.sh similarity index 100% rename from tests/integration/test.sh rename to tests/olc/run.sh -- 2.46.0