Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
3544-features-test-Adjust-tests-to-features-imp...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 3544-features-test-Adjust-tests-to-features-implementatio.patch of Package erlang
From 9675d26a7c96c3f4b6cf20fd608bc2384b5166ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cons=20T=20=C3=85hs?= <cons@erlang.org> Date: Mon, 14 Mar 2022 15:58:31 +0100 Subject: [PATCH 4/7] [features, test] Adjust tests to features implementation * Add knowledge about new Meta chunk * Add knowledge about new macros * Make some tests pass in a Bad Way, by using functions that should not be available at runtime Co-authored-by: Lukas Larsson <garazdawi@gmail.com> --- lib/common_test/test_server/ts_run.erl | 4 +++- lib/compiler/Makefile | 8 +++++++- lib/compiler/test/Makefile | 3 +-- lib/compiler/test/maybe_SUITE.erl | 5 +++++ lib/stdlib/Makefile | 10 +++++++++- lib/stdlib/test/Makefile | 4 +--- lib/stdlib/test/beam_lib_SUITE.erl | 5 +++-- lib/stdlib/test/epp_SUITE.erl | 9 +++++++-- lib/stdlib/test/erl_eval_SUITE.erl | 3 ++- lib/syntax_tools/test/syntax_tools_SUITE.erl | 20 +++++++++----------- 10 files changed, 47 insertions(+), 24 deletions(-) diff --git a/lib/common_test/test_server/ts_run.erl b/lib/common_test/test_server/ts_run.erl index 702e5dea50..a1d20df69d 100644 --- a/lib/common_test/test_server/ts_run.erl +++ b/lib/common_test/test_server/ts_run.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2021. All Rights Reserved. +%% Copyright Ericsson AB 1997-2022. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -255,6 +255,8 @@ make_command(Vars, Spec, State) -> %% " -test_server_format_exception false", " -boot start_sasl -sasl errlog_type error", " -pz \"",Cwd,"\"", + %% FIXME This is too far away from where it is needed. + " -enable-feature maybe_expr", " -ct_test_vars ",TestVars, " -eval \"ts_run:ct_run_test(\\\"",TestDir,"\\\", ", backslashify(lists:flatten(State#state.test_server_args)),")\"" diff --git a/lib/compiler/Makefile b/lib/compiler/Makefile index 2edc743677..a7d896f258 100644 --- a/lib/compiler/Makefile +++ b/lib/compiler/Makefile @@ -1,7 +1,7 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 1996-2021. All Rights Reserved. +# Copyright Ericsson AB 1996-2022. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -39,3 +39,9 @@ include $(ERL_TOP)/make/otp_subdir.mk DIA_PLT_APPS=crypto include $(ERL_TOP)/make/app_targets.mk + +# Enable feature maybe_expr in runtime when running tests +# Note: this overrides, and uses, test target in app_targets.mk +.PHONY: test +test: + $(MAKE) ERL_ARGS="-enable-feature maybe_expr $(ERL_ARGS)" -f $(ERL_TOP)/make/app_targets.mk $@ diff --git a/lib/compiler/test/Makefile b/lib/compiler/test/Makefile index 6fd03d5732..9e57a36bd5 100644 --- a/lib/compiler/test/Makefile +++ b/lib/compiler/test/Makefile @@ -165,9 +165,8 @@ RELSYSDIR = $(RELEASE_PATH)/compiler_test # FLAGS # ---------------------------------------------------- -MAYBE_OPT = '+{enable_feature,maybe_expr}' ERL_MAKE_FLAGS += -ERL_COMPILE_FLAGS += +clint +clint0 +ssalint $(MAYBE_OPT) +ERL_COMPILE_FLAGS += +clint +clint0 +ssalint EBIN = . diff --git a/lib/compiler/test/maybe_SUITE.erl b/lib/compiler/test/maybe_SUITE.erl index c0dd81523a..905bc33584 100644 --- a/lib/compiler/test/maybe_SUITE.erl +++ b/lib/compiler/test/maybe_SUITE.erl @@ -21,6 +21,11 @@ -module(maybe_SUITE). -include_lib("common_test/include/ct.hrl"). +%% Note: also require the feature to be set during runtime as long as +%% the feature is experimental. This is currently done in ../Makefile +%% by overriding the test target. Ugly and very non local. +-feature(enable, maybe_expr). + -export([all/0, groups/0, init_per_suite/1, end_per_suite/1]). -export([basic/1, nested/1]). diff --git a/lib/stdlib/Makefile b/lib/stdlib/Makefile index 7cdc0dd6ff..f1db3c77e3 100644 --- a/lib/stdlib/Makefile +++ b/lib/stdlib/Makefile @@ -1,7 +1,7 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 1996-2021. All Rights Reserved. +# Copyright Ericsson AB 1996-2022. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -40,3 +40,11 @@ DIA_PLT_APPS=compiler crypto TEST_NEEDS_RELEASE=true include $(ERL_TOP)/make/app_targets.mk + +# Enable feature maybe_expr in runtime when running tests. +# This is very non local and somewhat ugly. +.PHONY: test +test: + $(MAKE) TEST_NEEDS_RELEASE=$(TEST_NEEDS_RELEASE) \ + ERL_ARGS="-enable-feature maybe_expr $(ERL_ARGS)" \ + -f $(ERL_TOP)/make/app_targets.mk $@ diff --git a/lib/stdlib/test/Makefile b/lib/stdlib/test/Makefile index 382efd2803..18d3a083a3 100644 --- a/lib/stdlib/test/Makefile +++ b/lib/stdlib/test/Makefile @@ -118,10 +118,8 @@ RELSYSDIR = $(RELEASE_PATH)/stdlib_test # FLAGS # ---------------------------------------------------- -MAYBE_OPT = '+{enable_feature,maybe_expr}' -ERL_MAKE_FLAGS += ERL_COMPILE_FLAGS += -I$(ERL_TOP)/lib/kernel/include \ - -I$(ERL_TOP)/lib/stdlib/include $(MAYBE_OPT) + -I$(ERL_TOP)/lib/stdlib/include EBIN = . diff --git a/lib/stdlib/test/beam_lib_SUITE.erl b/lib/stdlib/test/beam_lib_SUITE.erl index b41cfdd641..a2e4aa6650 100644 --- a/lib/stdlib/test/beam_lib_SUITE.erl +++ b/lib/stdlib/test/beam_lib_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2021. All Rights Reserved. +%% Copyright Ericsson AB 1997-2022. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -453,7 +453,8 @@ strip_add_chunks(Conf) when is_list(Conf) -> compare_chunks(B1, NB1, NBId1), %% Keep all the extra chunks - ExtraChunks = ["Abst" , "Dbgi" , "Attr" , "CInf" , "LocT" , "Atom" ], + ExtraChunks = ["Abst", "Dbgi", "Attr", "CInf", "LocT", "Atom", + "Meta"], {ok, {simple, AB1}} = beam_lib:strip(B1, ExtraChunks), ABId1 = chunk_ids(AB1), true = length(BId1) == length(ABId1), diff --git a/lib/stdlib/test/epp_SUITE.erl b/lib/stdlib/test/epp_SUITE.erl index 8e800f8112..3a62b79135 100644 --- a/lib/stdlib/test/epp_SUITE.erl +++ b/lib/stdlib/test/epp_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2021. All Rights Reserved. +%% Copyright Ericsson AB 1998-2022. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -816,7 +816,8 @@ otp_8130(Config) when is_list(Config) -> "t() -> ?a.\n"), {ok,Epp} = epp:open(File, []), PreDefMacs = macs(Epp), - ['BASE_MODULE','BASE_MODULE_STRING','BEAM','FILE', + ['BASE_MODULE','BASE_MODULE_STRING','BEAM', + 'FEATURE_AVAILABLE', 'FEATURE_ENABLED','FILE', 'FUNCTION_ARITY','FUNCTION_NAME', 'LINE','MACHINE','MODULE','MODULE_STRING', 'OTP_RELEASE'] = PreDefMacs, @@ -2115,7 +2116,11 @@ run_test(Config, Test0, Opts0) -> Opts = [return, {i,PrivDir},{outdir,PrivDir}] ++ Opts0, {ok, epp_test, []} = compile:file(File, Opts), AbsFile = filename:rootname(File, ".erl"), + %% FIXME For now, use firbidden feature at rumtime + erl_features:enable_feature(maybe_expr), {module, epp_test} = code:load_abs(AbsFile, epp_test), + %% FIXME For now, use firbidden feature at rumtime + erl_features:disable_feature(maybe_expr), Reply = epp_test:t(), code:purge(epp_test), Reply. diff --git a/lib/stdlib/test/erl_eval_SUITE.erl b/lib/stdlib/test/erl_eval_SUITE.erl index b60cba9b4d..00a56d8a2b 100644 --- a/lib/stdlib/test/erl_eval_SUITE.erl +++ b/lib/stdlib/test/erl_eval_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2021. All Rights Reserved. +%% Copyright Ericsson AB 1998-2022. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ %% %CopyrightEnd% -module(erl_eval_SUITE). +-feature(enable, maybe_expr). -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_testcase/2, end_per_testcase/2, init_per_group/2,end_per_group/2]). diff --git a/lib/syntax_tools/test/syntax_tools_SUITE.erl b/lib/syntax_tools/test/syntax_tools_SUITE.erl index 2ffec12740..623e79b207 100644 --- a/lib/syntax_tools/test/syntax_tools_SUITE.erl +++ b/lib/syntax_tools/test/syntax_tools_SUITE.erl @@ -412,18 +412,20 @@ test_prettypr([File|Files],DataDir,PrivDir) -> test_epp_dodger([], _, _) -> ok; test_epp_dodger([Filename|Files],DataDir,PrivDir) -> io:format("Parsing ~p~n", [Filename]), + Options = [{enable_feature, maybe_expr}], InFile = filename:join(DataDir, Filename), - Parsers = [{fun epp_dodger:parse_file/1,parse_file}, - {fun epp_dodger:quick_parse_file/1,quick_parse_file}, + Parsers = [{fun(File) -> epp_dodger:parse_file(File, Options) end,parse_file}, + {fun(File) -> epp_dodger:quick_parse_file(File, + Options) end,quick_parse_file}, {fun (File) -> {ok,Dev} = file:open(File,[read]), - Res = epp_dodger:parse(Dev), + Res = epp_dodger:parse(Dev, Options), file:close(File), Res end, parse}, {fun (File) -> {ok,Dev} = file:open(File,[read]), - Res = epp_dodger:quick_parse(Dev), + Res = epp_dodger:quick_parse(Dev, Options), file:close(File), Res end, quick_parse}], @@ -619,11 +621,7 @@ p_run_loop(Test, List, N, Refs0, Errors0) -> end. res_word_option() -> - %% FIXME: When the experimental features EEP has been implemented, we should - %% dig out all keywords defined in all features. - ResWordFun = - fun('maybe') -> true; - ('else') -> true; - (Other) -> erl_scan:reserved_word(Other) - end, + Options = [{enable_feature, maybe_expr}], + {ok, {_Ftrs, ResWordFun}} = + erl_features:keyword_fun(Options, fun erl_scan:f_reserved_word/1), {reserved_word_fun, ResWordFun}. -- 2.34.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor