From f0223a3047d7bfcec73ef1f66231b334bb792e21 Mon Sep 17 00:00:00 2001 From: Elie Richa Date: Thu, 19 Oct 2023 07:55:38 +0000 Subject: [PATCH 1/4] Add check for issue occurence in CI --- .gitlab-ci.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7bd0108dd..2778b8a76 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,21 @@ stages: - build_and_test + - check - run_downstream_ci +issue-check: + services: + - image:e3 + stage: check + needs: [] # Do not wait for the other stages to execute + interruptible: true # Cancel job if the branch is pushed + variables: # do not checkout the git repository, not needed + GIT_STRATEGY: none + rules: # Launch only on merge requests + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + script: + - require_issue # launch the verification + .basic-setup: # Use generic_anod_ci here. - generic_anod_ci From 033176a4f754e3175e6ea0f895b05e6d6bd3e626 Mon Sep 17 00:00:00 2001 From: Elie Richa Date: Wed, 18 Oct 2023 16:25:24 +0000 Subject: [PATCH 2/4] Do not check platform compatibility with external ALS env variable Closes eng/ide/ada_language_server#1189 --- integration/vscode/ada/src/clients.ts | 18 +++-------------- integration/vscode/ada/src/extension.ts | 15 +++++++++++--- integration/vscode/ada/src/helpers.ts | 26 +++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 18 deletions(-) diff --git a/integration/vscode/ada/src/clients.ts b/integration/vscode/ada/src/clients.ts index c2c6e124f..dc9e18a91 100644 --- a/integration/vscode/ada/src/clients.ts +++ b/integration/vscode/ada/src/clients.ts @@ -1,5 +1,5 @@ -import * as vscode from 'vscode'; import { existsSync } from 'fs'; +import * as vscode from 'vscode'; import { Disposable, ExecuteCommandRequest, @@ -7,10 +7,10 @@ import { LanguageClientOptions, ServerOptions, } from 'vscode-languageclient/node'; +import { mainLogChannel } from './extension'; import GnatTaskProvider from './gnatTaskProvider'; import GprTaskProvider from './gprTaskProvider'; -import { getEvaluatedCustomEnv, logErrorAndThrow } from './helpers'; -import { mainLogChannel } from './extension'; +import { logErrorAndThrow } from './helpers'; export class ContextClients { public readonly gprClient: LanguageClient; @@ -147,18 +147,6 @@ function createClient( // If the extension is launched in debug mode then the debug server options are used // Otherwise the run options are used - // Retrieve the user's custom environment variables if specified in their - // settings/workspace: we'll then launch any child process with this custom - // environment - const custom_env = getEvaluatedCustomEnv(); - - if (custom_env) { - for (const var_name in custom_env) { - const var_value: string = custom_env[var_name]; - process.env[var_name] = var_value; - } - } - // Options to control the server const serverOptions: ServerOptions = { run: { command: serverExecPath, args: extra }, diff --git a/integration/vscode/ada/src/extension.ts b/integration/vscode/ada/src/extension.ts index bbc8a55fb..c76db8626 100644 --- a/integration/vscode/ada/src/extension.ts +++ b/integration/vscode/ada/src/extension.ts @@ -26,7 +26,11 @@ import { ContextClients } from './clients'; import { registerCommands } from './commands'; import { initializeDebugging } from './debugConfigProvider'; import { initializeTestView } from './gnattest'; -import { assertSupportedEnvironments, getEvaluatedCustomEnv } from './helpers'; +import { + assertSupportedEnvironments, + getEvaluatedCustomEnv, + setCustomEnvironment, +} from './helpers'; const ADA_CONTEXT = 'ADA_PROJECT_CONTEXT'; export let contextClients: ContextClients; @@ -39,8 +43,6 @@ export async function activate(context: vscode.ExtensionContext): Promise mainLogChannel = vscode.window.createOutputChannel('Ada Extension'); mainLogChannel.appendLine('Starting Ada extension'); - assertSupportedEnvironments(mainLogChannel); - // Log the environment that the extension (and all VS Code) will be using const customEnv = getEvaluatedCustomEnv(); @@ -52,6 +54,13 @@ export async function activate(context: vscode.ExtensionContext): Promise } } + // Set the custom environment into the current node process. This must be + // done before calling assertSupportedEnvironments in order to set the ALS + // environment variable if provided. + setCustomEnvironment(); + + assertSupportedEnvironments(mainLogChannel); + // Create the Ada and GPR clients. contextClients = new ContextClients(context); diff --git a/integration/vscode/ada/src/helpers.ts b/integration/vscode/ada/src/helpers.ts index 34cbcc2f7..c8dad08d4 100644 --- a/integration/vscode/ada/src/helpers.ts +++ b/integration/vscode/ada/src/helpers.ts @@ -148,7 +148,33 @@ export function getEvaluatedCustomEnv() { return custom_env; } +/** + * Read the environment variables specified in the vscode setting + * `terminal.integrated.env.` and set them in the current node process so + * that they become inherited by any child processes. + */ +export function setCustomEnvironment() { + // Retrieve the user's custom environment variables if specified in their + // settings/workspace: we'll then launch any child process with this custom + // environment + const custom_env = getEvaluatedCustomEnv(); + + if (custom_env) { + for (const var_name in custom_env) { + const var_value: string = custom_env[var_name]; + process.env[var_name] = var_value; + } + } +} + export function assertSupportedEnvironments(mainChannel: vscode.OutputChannel) { + if (process.env.ALS) { + // The User provided an external ALS executable. Do not perform any + // platform support checks because we may be on an unsupported platform + // where the User built and provided ALS. + return; + } + type Env = { arch: 'arm' | 'arm64' | 'x64'; platform: 'win32' | 'linux' | 'darwin'; From 738f4f17dacde1c342069468f13c1424eb1ec1aa Mon Sep 17 00:00:00 2001 From: Max Reznik Date: Thu, 19 Oct 2023 12:35:41 +0000 Subject: [PATCH 3/4] Avoid overwrite error for `.sid` files --- Makefile | 7 - gnat/codec_test.gpr | 32 -- source/codec_test/codec_test.adb | 366 ------------------- testsuite/README.md | 8 - testsuite/codecs/apply_ws_edit_response.json | 6 - testsuite/codecs/code_action_response.json | 12 - testsuite/codecs/completion_response.json | 18 - testsuite/codecs/highlight_response.json | 18 - testsuite/codecs/hover_response.json | 9 - testsuite/codecs/index.txt | 7 - testsuite/codecs/initialize_response.json | 14 - testsuite/codecs/symbol_response.json | 1 - testsuite/codecs/test.yaml | 1 - testsuite/drivers/codecs.py | 26 -- testsuite/testsuite.py | 3 - 15 files changed, 528 deletions(-) delete mode 100644 gnat/codec_test.gpr delete mode 100644 source/codec_test/codec_test.adb delete mode 100644 testsuite/codecs/apply_ws_edit_response.json delete mode 100644 testsuite/codecs/code_action_response.json delete mode 100644 testsuite/codecs/completion_response.json delete mode 100644 testsuite/codecs/highlight_response.json delete mode 100644 testsuite/codecs/hover_response.json delete mode 100644 testsuite/codecs/index.txt delete mode 100644 testsuite/codecs/initialize_response.json delete mode 100644 testsuite/codecs/symbol_response.json delete mode 100644 testsuite/codecs/test.yaml delete mode 100644 testsuite/drivers/codecs.py diff --git a/Makefile b/Makefile index 80b166ccd..97dacea91 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,6 @@ export ALS=$(ROOTDIR)/.obj/server/ada_language_server$(EXE) # Tester files TESTER=$(ROOTDIR)/.obj/tester/tester-run$(EXE) -CODEC_TEST=.obj/codec_test/codec_test$(EXE) # Env variable to set for update VS Code test references MOCHA_ALS_UPDATE= @@ -97,7 +96,6 @@ all: coverage-instrument $(GPRBUILD) -d -ws -c -u -P gnat/lsp_server.gpr -p $(BUILD_FLAGS) s-memory.adb $(GPRBUILD) -P gnat/lsp_server.gpr -p $(COVERAGE_BUILD_FLAGS) \ -XVERSION=$(VERSION) -XBUILD_DATE=$(BUILD_DATE) - $(GPRBUILD) -P gnat/codec_test.gpr -p $(COVERAGE_BUILD_FLAGS) $(GPRBUILD) -P gnat/lsp_client.gpr -p $(COVERAGE_BUILD_FLAGS) ifdef NODE mkdir -p integration/vscode/ada/$(NODE_ARCH)/$(NODE_PLATFORM) @@ -117,15 +115,12 @@ ifneq ($(COVERAGE),) rm -rf .obj/*/gnatcov-instr $(COVERAGE_INSTR) -XVERSION=$(VERSION) -XBUILD_DATE=$(BUILD_DATE) \ -Pgnat/lsp_server.gpr --projects lsp_server --projects lsp_3_17 - $(COVERAGE_INSTR) -Pgnat/tester.gpr --projects lsp - $(COVERAGE_INSTR) -Pgnat/codec_test.gpr --projects lsp endif install: gprinstall -f -P gnat/lsp_server.gpr -p -r --mode=usage \ --prefix=$(DESTDIR) $(LIBRARY_FLAGS) gprinstall -f -P gnat/tester.gpr -p --prefix=$(DESTDIR) $(LIBRARY_FLAGS) - gprinstall -f -P gnat/codec_test.gpr -p --prefix=$(DESTDIR) $(LIBRARY_FLAGS) gprinstall -f -P gnat/lsp_client.gpr -p -r \ --mode=dev \ --prefix=$(DESTDIR) \ @@ -140,7 +135,6 @@ clean: -$(GPRCLEAN) -P gnat/lsp_3_17.gpr $(LIBRARY_FLAGS) -$(GPRCLEAN) -P gnat/lsp_server.gpr $(LIBRARY_FLAGS) -$(GPRCLEAN) -P gnat/tester.gpr $(LIBRARY_FLAGS) - -$(GPRCLEAN) -P gnat/codec_test.gpr $(LIBRARY_FLAGS) -rm -rf integration/vscode/ada/$(NODE_ARCH)/$(NODE_PLATFORM) vscode: @@ -173,7 +167,6 @@ check: all (cd `dirname $$a ` ; $(TESTER) `basename $$a`) ;\ done; \ fi - ${CODEC_TEST} < testsuite/codecs/index.txt deploy: check integration/$(USER)/deploy.sh $(NODE_PLATFORM) diff --git a/gnat/codec_test.gpr b/gnat/codec_test.gpr deleted file mode 100644 index 9f1c7c77f..000000000 --- a/gnat/codec_test.gpr +++ /dev/null @@ -1,32 +0,0 @@ ------------------------------------------------------------------------------- --- Language Server Protocol -- --- -- --- Copyright (C) 2019, AdaCore -- --- -- --- This is free software; you can redistribute it and/or modify it under -- --- terms of the GNU General Public License as published by the Free Soft- -- --- ware Foundation; either version 3, or (at your option) any later ver- -- --- sion. This software is distributed in the hope that it will be useful, -- --- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- --- TABILITY 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 distributed with this software; see file -- --- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy -- --- of the license. -- ------------------------------------------------------------------------------- - -with "lsp_client"; - -project Codec_Test is - - for Source_Dirs use ("../source/codec_test"); - for Object_Dir use "../.obj/codec_test"; - for Main use ("codec_test.adb"); - - package Compiler renames LSP_Client.Compiler; - - package Binder is - for Switches ("ada") use ("-E"); - end Binder; - -end Codec_Test; diff --git a/source/codec_test/codec_test.adb b/source/codec_test/codec_test.adb deleted file mode 100644 index 3d4e98615..000000000 --- a/source/codec_test/codec_test.adb +++ /dev/null @@ -1,366 +0,0 @@ ------------------------------------------------------------------------------- --- Language Server Protocol -- --- -- --- Copyright (C) 2018-2021, AdaCore -- --- -- --- This is free software; you can redistribute it and/or modify it under -- --- terms of the GNU General Public License as published by the Free Soft- -- --- ware Foundation; either version 3, or (at your option) any later ver- -- --- sion. This software is distributed in the hope that it will be useful, -- --- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- --- TABILITY 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 distributed with this software; see file -- --- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy -- --- of the license. -- ------------------------------------------------------------------------------- - -with LSP.Messages; -with LSP.Messages.Client_Responses; -with LSP.Messages.Server_Responses; -with LSP.JSON_Streams; - -with Ada.Command_Line; -with Ada.Containers.Indefinite_Hashed_Maps; -with Ada.Strings.Fixed; -with Ada.Strings.Hash; -with Ada.Text_IO; -with Ada.Streams.Stream_IO; - -with GNATCOLL.JSON; - -with VSS.Stream_Element_Vectors.Conversions; -with VSS.Text_Streams.Memory_UTF8_Input; -with VSS.Text_Streams.Memory_UTF8_Output; -with VSS.JSON.Pull_Readers.Simple; - -procedure Codec_Test is - - type Test_Access is access function - (Input : VSS.Stream_Element_Vectors.Stream_Element_Vector) - return VSS.Stream_Element_Vectors.Stream_Element_Vector; - -- A function that converts Input to an Ada type and then converts it back - -- to Stream_Element_Buffer. - - procedure Process_File - (File_Name : String; - Type_Name : String); - -- Process one test file. Read JSON from File_Name and deserialize it into - -- an object of given type, then serialize it tab and compare with origin. - -- It prints found differences and set failure exit status if test fails. - - function Read_File (File_Name : String) - return VSS.Stream_Element_Vectors.Stream_Element_Vector; - -- Read content of the file and return it as a string - - procedure Register_Tests; - -- Register all known codec test in Test_Map - - function Compare (Input, Output : GNATCOLL.JSON.JSON_Value) return Boolean; - -- Compare two JSONs and raise error is they differ - - generic - type Response is new LSP.Messages.ResponseMessage with private; - function Generic_Response_Test - (Input : VSS.Stream_Element_Vectors.Stream_Element_Vector) - return VSS.Stream_Element_Vectors.Stream_Element_Vector; - -- Generic codec for a response. - - package Test_Maps is new Ada.Containers.Indefinite_Hashed_Maps - (Key_Type => String, - Element_Type => Test_Access, - Hash => Ada.Strings.Hash, - Equivalent_Keys => "="); - - Test_Map : Test_Maps.Map; - -- A map from Ada type name to corresponding codec test - - --------------------------- - -- Generic_Response_Test -- - --------------------------- - - function Generic_Response_Test - (Input : VSS.Stream_Element_Vectors.Stream_Element_Vector) - return VSS.Stream_Element_Vectors.Stream_Element_Vector - is - Text_Input : aliased - VSS.Text_Streams.Memory_UTF8_Input.Memory_UTF8_Input_Stream; - Reader : aliased - VSS.JSON.Pull_Readers.Simple.JSON_Simple_Pull_Reader; - In_JS : aliased LSP.JSON_Streams.JSON_Stream (False, Reader'Access); - begin - Text_Input.Set_Data (Input); - Reader.Set_Stream (Text_Input'Unchecked_Access); - Reader.Read_Next; - pragma Assert (Reader.Is_Start_Document); - Reader.Read_Next; - pragma Assert (Reader.Is_Start_Object); - - declare - Out_JS : aliased LSP.JSON_Streams.JSON_Stream; - Output : aliased - VSS.Text_Streams.Memory_UTF8_Output.Memory_UTF8_Output_Stream; - Object : Response (Is_Error => False); - - begin - Out_JS.Set_Stream (Output'Unchecked_Access); - Response'Read (In_JS'Access, Object); - Response'Write (Out_JS'Access, Object); - - return Output.Buffer; - end; - end Generic_Response_Test; - - ------------- - -- Compare -- - ------------- - - function Compare - (Input, Output : GNATCOLL.JSON.JSON_Value) return Boolean - is - use type GNATCOLL.JSON.JSON_Value_Type; - - Fields_Match : Boolean := True; - - procedure Check_Input_Field - (Field : String; - Value : GNATCOLL.JSON.JSON_Value); - - procedure Check_Output_Field - (Field : String; - Value : GNATCOLL.JSON.JSON_Value); - - ----------------------- - -- Check_Input_Field -- - ----------------------- - - procedure Check_Input_Field - (Field : String; - Value : GNATCOLL.JSON.JSON_Value) is - begin - if Output.Has_Field (Field) then - if not Compare (Value, Output.Get (Field)) then - Fields_Match := False; - Ada.Text_IO.Put_Line ("Unmatched JSON field: " & Field); - end if; - else - Ada.Text_IO.Put_Line ("No JSON field: " & Field); - end if; - end Check_Input_Field; - - ------------------------ - -- Check_Output_Field -- - ------------------------ - - procedure Check_Output_Field - (Field : String; - Value : GNATCOLL.JSON.JSON_Value) - is - pragma Unreferenced (Value); - begin - if not Output.Has_Field (Field) then - Ada.Text_IO.Put_Line ("Extra JSON field: " & Field); - end if; - end Check_Output_Field; - - begin - if Input.Kind /= Output.Kind then - Ada.Text_IO.Put_Line ("Unmatched JSON value kind"); - return False; - end if; - - case Input.Kind is - when GNATCOLL.JSON.JSON_Null_Type => - null; - - when GNATCOLL.JSON.JSON_Boolean_Type => - if Boolean'(Input.Get) /= Output.Get then - Ada.Text_IO.Put_Line ("Unmatched JSON boolean value"); - return False; - end if; - - when GNATCOLL.JSON.JSON_Int_Type => - if Integer'(Input.Get) /= Output.Get then - Ada.Text_IO.Put_Line ("Unmatched JSON Integer value"); - return False; - end if; - - when GNATCOLL.JSON.JSON_Float_Type => - if Float'(Input.Get) /= Output.Get then - Ada.Text_IO.Put_Line ("Unmatched JSON Float value"); - return False; - end if; - - when GNATCOLL.JSON.JSON_String_Type => - if String'(Input.Get) /= String'(Output.Get) then - Ada.Text_IO.Put_Line ("Unmatched JSON String value"); - return False; - end if; - - when GNATCOLL.JSON.JSON_Array_Type => - declare - Left : constant GNATCOLL.JSON.JSON_Array := Input.Get; - Right : constant GNATCOLL.JSON.JSON_Array := Output.Get; - begin - if GNATCOLL.JSON.Length (Left) /= - GNATCOLL.JSON.Length (Right) - then - Ada.Text_IO.Put_Line ("Unmatched JSON Array length"); - return False; - end if; - - for J in 1 .. GNATCOLL.JSON.Length (Left) loop - if not Compare - (GNATCOLL.JSON.Get (Left, J), - GNATCOLL.JSON.Get (Right, J)) - then - Ada.Text_IO.Put_Line - ("Unmatched JSON Array element:" & J'Img); - return False; - end if; - end loop; - end; - - when GNATCOLL.JSON.JSON_Object_Type => - Input.Map_JSON_Object (Check_Input_Field'Access); - Output.Map_JSON_Object (Check_Output_Field'Access); - - if not Fields_Match then - Ada.Text_IO.Put_Line ("Unmatched JSON Object"); - end if; - - return Fields_Match; - end case; - - return True; - end Compare; - - ------------------ - -- Process_File -- - ------------------ - - procedure Process_File - (File_Name : String; - Type_Name : String) - is - In_Buffer : constant VSS.Stream_Element_Vectors.Stream_Element_Vector - := Read_File (File_Name); - - Out_Buffer : VSS.Stream_Element_Vectors.Stream_Element_Vector; - begin - Out_Buffer := Test_Map (Type_Name).all (In_Buffer); - - declare - Input : constant GNATCOLL.JSON.JSON_Value := - GNATCOLL.JSON.Read - (VSS.Stream_Element_Vectors.Conversions.Unchecked_To_String - (In_Buffer), File_Name); - - Output : constant GNATCOLL.JSON.JSON_Value := - GNATCOLL.JSON.Read - (VSS.Stream_Element_Vectors.Conversions.Unchecked_To_String - (Out_Buffer)); - begin - if not Compare (Input, Output) then - Ada.Text_IO.Put_Line - ("Test FAILED: " & File_Name & " " & Type_Name); - Ada.Text_IO.Put_Line (Output.Write); - Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); - end if; - end; - end Process_File; - - --------------- - -- Read_File -- - --------------- - - function Read_File (File_Name : String) - return VSS.Stream_Element_Vectors.Stream_Element_Vector - is - use type Ada.Streams.Stream_Element_Count; - - Input : Ada.Streams.Stream_IO.File_Type; - Result : VSS.Stream_Element_Vectors.Stream_Element_Vector; - Data : Ada.Streams.Stream_Element_Array (1 .. 256); - Last : Ada.Streams.Stream_Element_Count; - begin - Ada.Streams.Stream_IO.Open - (Input, Ada.Streams.Stream_IO.In_File, File_Name); - - loop - Ada.Streams.Stream_IO.Read (Input, Data, Last); - exit when Last = 0; - - for J of Data (1 .. Last) loop - Result.Append (J); - end loop; - end loop; - - Ada.Streams.Stream_IO.Close (Input); - - return Result; - end Read_File; - - function ApplyWorkspaceEdit_Response_Test is new Generic_Response_Test - (LSP.Messages.Client_Responses.ApplyWorkspaceEdit_Response); - - function CodeAction_Response_Test is new Generic_Response_Test - (LSP.Messages.Server_Responses.CodeAction_Response); - - function Completion_Response_Test is new Generic_Response_Test - (LSP.Messages.Server_Responses.Completion_Response); - - function Highlight_Response_Test is new Generic_Response_Test - (LSP.Messages.Server_Responses.Highlight_Response); - - function Hover_Response_Test is - new Generic_Response_Test (LSP.Messages.Server_Responses.Hover_Response); - - function Initialize_Response_Test is new Generic_Response_Test - (LSP.Messages.Server_Responses.Initialize_Response); - - function Location_Response_Test is new Generic_Response_Test - (LSP.Messages.Server_Responses.Location_Response); - - function SignatureHelp_Response_Test is new Generic_Response_Test - (LSP.Messages.Server_Responses.SignatureHelp_Response); - - function Symbol_Response_Test is new Generic_Response_Test - (LSP.Messages.Server_Responses.Symbol_Response); - - -------------------- - -- Register_Tests -- - -------------------- - - procedure Register_Tests is - begin - Test_Map.Insert - ("ApplyWorkspaceEdit_Response", - ApplyWorkspaceEdit_Response_Test'Access); - Test_Map.Insert ("CodeAction_Response", CodeAction_Response_Test'Access); - Test_Map.Insert ("Completion_Response", Completion_Response_Test'Access); - Test_Map.Insert ("Highlight_Response", Highlight_Response_Test'Access); - Test_Map.Insert ("Hover_Response", Hover_Response_Test'Access); - Test_Map.Insert ("Initialize_Response", Initialize_Response_Test'Access); - Test_Map.Insert ("Location_Response", Location_Response_Test'Access); - Test_Map.Insert - ("SignatureHelp_Response", SignatureHelp_Response_Test'Access); - Test_Map.Insert ("Symbol_Response", Symbol_Response_Test'Access); - end Register_Tests; - -begin - Register_Tests; - - while not Ada.Text_IO.End_Of_File loop - declare - Line : constant String := Ada.Text_IO.Get_Line; - Space : constant Natural := Ada.Strings.Fixed.Index (Line, " "); - begin - if Line'Length > 0 and then Line (1) /= '#' then - Process_File - (File_Name => Line (1 .. Space - 1), - Type_Name => Line (Space + 1 .. Line'Last)); - end if; - end; - end loop; -end Codec_Test; diff --git a/testsuite/README.md b/testsuite/README.md index a73c0287c..cc16aa0c7 100644 --- a/testsuite/README.md +++ b/testsuite/README.md @@ -9,11 +9,3 @@ This project has several testsuite tools It reads commands from JSON file and executes them. See more details in [Tester](ada_lsp/README.md). -## Codec_Test - -Codec_Test checks errors in encoders/decoders of LSP messages. -It reads LSP message from JSON file, converts it to an Ada object, then -it converts the Ada object back to JSON and compares result with origin -JSON object. Codec_Test has no command line arguments. Instead it reads -lines from the standard input. Each line has file name and Ada type name -separated by space. Empty lines and lines started with '#' are ignored. diff --git a/testsuite/codecs/apply_ws_edit_response.json b/testsuite/codecs/apply_ws_edit_response.json deleted file mode 100644 index a82becc88..000000000 --- a/testsuite/codecs/apply_ws_edit_response.json +++ /dev/null @@ -1,6 +0,0 @@ -{"id":1, - "jsonrpc":"2.0", - "result": { - "applied": false - } -} diff --git a/testsuite/codecs/code_action_response.json b/testsuite/codecs/code_action_response.json deleted file mode 100644 index fbd7c52ed..000000000 --- a/testsuite/codecs/code_action_response.json +++ /dev/null @@ -1,12 +0,0 @@ -{"id":1, - "jsonrpc":"2.0", - "result": [ - { - "title": "Disable no-unused-vars for this line", - "command": "eslint.applyDisableLine", - "arguments": [ - "no-unused-vars" - ] - } - ] -} diff --git a/testsuite/codecs/completion_response.json b/testsuite/codecs/completion_response.json deleted file mode 100644 index 1db0a5933..000000000 --- a/testsuite/codecs/completion_response.json +++ /dev/null @@ -1,18 +0,0 @@ -{"id":1, - "jsonrpc":"2.0", - "result": { - "isIncomplete": false, - "items": [ - { - "label": "Set_Col", - "kind": 3, - "detail": "(subprogram) " - }, - { - "label": "Set_Col", - "kind": 3, - "detail": "(subprogram) " - } - ] - } -} diff --git a/testsuite/codecs/highlight_response.json b/testsuite/codecs/highlight_response.json deleted file mode 100644 index 1e163263d..000000000 --- a/testsuite/codecs/highlight_response.json +++ /dev/null @@ -1,18 +0,0 @@ -{"id":1, - "jsonrpc":"2.0", - "result": [ - { - "range": { - "start": { - "line": 2, - "character": 12 - }, - "end": { - "line": 2, - "character": 13 - } - }, - "kind": 2 - } - ] -} diff --git a/testsuite/codecs/hover_response.json b/testsuite/codecs/hover_response.json deleted file mode 100644 index 32cd4e50f..000000000 --- a/testsuite/codecs/hover_response.json +++ /dev/null @@ -1,9 +0,0 @@ -{"id":1, - "jsonrpc":"2.0", - "result": { - "contents": { - "language": "java", - "value": "void java.io.PrintStream.println(String x)" - } - } -} diff --git a/testsuite/codecs/index.txt b/testsuite/codecs/index.txt deleted file mode 100644 index 96c38a824..000000000 --- a/testsuite/codecs/index.txt +++ /dev/null @@ -1,7 +0,0 @@ -testsuite/codecs/apply_ws_edit_response.json ApplyWorkspaceEdit_Response -testsuite/codecs/code_action_response.json CodeAction_Response -testsuite/codecs/completion_response.json Completion_Response -testsuite/codecs/highlight_response.json Highlight_Response -testsuite/codecs/hover_response.json Hover_Response -testsuite/codecs/initialize_response.json Initialize_Response -testsuite/codecs/symbol_response.json Symbol_Response diff --git a/testsuite/codecs/initialize_response.json b/testsuite/codecs/initialize_response.json deleted file mode 100644 index 5a9fbe5cc..000000000 --- a/testsuite/codecs/initialize_response.json +++ /dev/null @@ -1,14 +0,0 @@ -{"id":1, - "jsonrpc":"2.0", - "result": { - "capabilities": { - "textDocumentSync": { - "openClose": true, - "change": 2, - "willSave": true, - "willSaveWaitUntil": true, - "save": {} - } - } - } -} diff --git a/testsuite/codecs/symbol_response.json b/testsuite/codecs/symbol_response.json deleted file mode 100644 index 8e4453048..000000000 --- a/testsuite/codecs/symbol_response.json +++ /dev/null @@ -1 +0,0 @@ -{"id":1,"jsonrpc":"2.0","result":[{"name":"Aaa","kind":4,"location":{"uri":"file:///tmp/aaa.ads","range":{"start":{"line":0,"character":8},"end":{"line":0,"character":11}}}}]} diff --git a/testsuite/codecs/test.yaml b/testsuite/codecs/test.yaml deleted file mode 100644 index 9f378f735..000000000 --- a/testsuite/codecs/test.yaml +++ /dev/null @@ -1 +0,0 @@ -driver: codecs diff --git a/testsuite/drivers/codecs.py b/testsuite/drivers/codecs.py deleted file mode 100644 index 7d0351b3b..000000000 --- a/testsuite/drivers/codecs.py +++ /dev/null @@ -1,26 +0,0 @@ -import os.path - -from e3.testsuite.result import TestStatus - -from drivers import ALSTestDriver - - -class CodecsTestDriver(ALSTestDriver): - """ - Run the "codec_test" test program. - - Each test must have an "index.txt" file and the corresponding "*.json" - files. - """ - - def run(self, previous_values, slot): - # Check whether the test should be skipped - if self.should_skip(): - return False - - index = os.path.abspath(os.path.join(self.test_env["test_dir"], "index.txt")) - p = self.run_and_log([self.env.codec_test], cwd=self.env.repo_base, input=index) - self.result.out += p.out - - self.result.set_status(TestStatus.PASS if p.status == 0 else TestStatus.FAIL) - self.push_result() diff --git a/testsuite/testsuite.py b/testsuite/testsuite.py index 044f0267b..5d20a1861 100644 --- a/testsuite/testsuite.py +++ b/testsuite/testsuite.py @@ -9,7 +9,6 @@ from e3.testsuite.driver.diff import DiffTestDriver from drivers.basic import JsonTestDriver -from drivers.codecs import CodecsTestDriver from drivers.shell import ShellTestDriver from drivers.gnatcov import GNATcov @@ -78,7 +77,6 @@ def set_up(self): self.env.als_home = os.path.join(self.env.repo_base, 'testsuite') self.env.tester_run = self.lookup_program('tester', 'tester-run') - self.env.codec_test = self.lookup_program('codec_test', 'codec_test') # If code coverage is requested, initialize our helper and build # instrumented programs. @@ -101,7 +99,6 @@ def tear_down(self): @property def test_driver_map(self): return {'ada_lsp': JsonTestDriver, - 'codecs': CodecsTestDriver, 'shell': ShellTestDriver} @property From c085ca308ca009f9e42b7c0bb862bf5345640d9e Mon Sep 17 00:00:00 2001 From: Maxim Reznik Date: Wed, 11 Oct 2023 18:35:27 +0300 Subject: [PATCH 4/4] GitHub CI: Use GCC 13 to build ALS Switch to 24.0.x numbering. Force Alire use preinstalled MSYS2 on Windows. --- .github/workflows/build-binaries.sh | 18 +++++++---- .github/workflows/build-binaries.yml | 41 +++++++++++------------- .github/workflows/pack-binaries.sh | 2 +- Makefile | 1 + gnat/lsp_3_17.gpr | 2 ++ integration/vscode/ada/package-lock.json | 4 +-- integration/vscode/ada/package.json | 2 +- 7 files changed, 37 insertions(+), 33 deletions(-) diff --git a/.github/workflows/build-binaries.sh b/.github/workflows/build-binaries.sh index 5dbf98598..ff58e4c98 100755 --- a/.github/workflows/build-binaries.sh +++ b/.github/workflows/build-binaries.sh @@ -5,14 +5,22 @@ set -x -e DEBUG=$1 # Value is '' or 'debug' RUNNER_OS=$2 # ${{ runner.os }} is Linux, Windiws, maxOS -TAG=$3 # For master it's 23.0.999, while for tag it's the tag itself +TAG=$3 # For master it's 24.0.999, while for tag it's the tag itself NO_REBASE=$4 # Specify this to skip the rebase over the edge branch. Used for local debugging. prefix=/tmp/ADALIB_DIR +export CPATH=/usr/local/include +export LIBRARY_PATH=/usr/local/lib +export DYLD_LIBRARY_PATH=/usr/local/lib +export PATH=`ls -d $PWD/cached_gnat/*/bin |tr '\n' ':'`$PATH +export ADAFLAGS=-g1 + if [ $RUNNER_OS = Windows ]; then prefix=/opt/ADALIB_DIR - mount `cygpath -w $RUNNER_TEMP|cut -d: -f1`:/opt /opt + export CPATH=`cygpath -w /c/msys64/mingw64/include` + export LIBRARY_PATH=`cygpath -w /c/msys64/mingw64/lib` + mount D:/opt /opt fi export GPR_PROJECT_PATH=$prefix/share/gpr:\ @@ -22,11 +30,6 @@ $PWD/subprojects/lal-refactor/gnat:\ $PWD/subprojects/libadalang-tools/src:\ $PWD/subprojects/spawn/gnat:\ $PWD/subprojects/stubs -export CPATH=/usr/local/include:/mingw64/include -export LIBRARY_PATH=/usr/local/lib:/mingw64/lib -export DYLD_LIBRARY_PATH=/usr/local/lib -export PATH=`ls -d $PWD/cached_gnat/*/bin |tr '\n' ':'`$PATH -export ADAFLAGS=-g1 echo PATH=$PATH BRANCH=master @@ -57,6 +60,7 @@ FILE=libadalang-$RUNNER_OS-$BRANCH${DEBUG:+-dbg}-static.tar.gz # and we don't delete it after use. if [ ! -f "$FILE" ]; then aws s3 cp s3://adacore-gha-tray-eu-west-1/libadalang/$FILE . --sse=AES256 + umask 0 # To avoid permission errors on MSYS2 tar xzf $FILE -C $prefix rm -f -v $FILE else diff --git a/.github/workflows/build-binaries.yml b/.github/workflows/build-binaries.yml index 926dd6779..aba94e988 100644 --- a/.github/workflows/build-binaries.yml +++ b/.github/workflows/build-binaries.yml @@ -6,7 +6,7 @@ on: - 2*.*.* name: Build binaries env: - DEFAULT_TAG: 23.0.999 + DEFAULT_TAG: 24.0.999 AWS_DEFAULT_REGION: eu-west-1 jobs: build: @@ -18,10 +18,10 @@ jobs: os: [macos-11, ubuntu-20.04, windows-latest] runs-on: ${{ matrix.os }} steps: - - name: Setup Python 3.8 + - name: Setup Python uses: actions/setup-python@v4 with: - python-version: '3.8' + python-version: '3.10' - name: Initialize TAG and git autocrlf shell: bash run: | @@ -31,15 +31,19 @@ jobs: else echo "TAG=$DEFAULT_TAG" >> $GITHUB_ENV fi + - name: Force Alire use preinstalled MSYS2 + shell: bash + if: ${{ runner.os == 'Windows' }} + run: | + mkdir -p ~/.config/alire + echo '[msys2]' >> ~/.config/alire/config.toml + echo 'install_dir = "C:\\msys64"' >> ~/.config/alire/config.toml - name: Install iconv and gmp (Windows only) + run: pacman --noconfirm -S mingw64/mingw-w64-x86_64-libiconv mingw64/mingw-w64-x86_64-gmp if: ${{ runner.os == 'Windows' }} - uses: msys2/setup-msys2@v2 - with: - path-type: inherit - update: true - install: >- - mingw64/mingw-w64-x86_64-libiconv - mingw64/mingw-w64-x86_64-gmp + shell: c:\msys64\usr\bin\bash.exe -l -e -o pipefail {0} + env: + MSYSTEM: MINGW64 - name: Get als uses: actions/checkout@v3 with: @@ -79,16 +83,15 @@ jobs: - uses: actions/cache@v3 with: path: ./cached_gnat - key: ${{ runner.os }}-alire-2022 - restore-keys: ${{ runner.os }}-alire-2022 + key: ${{ runner.os }}-alire-2023 + restore-keys: ${{ runner.os }}-alire-2023 - name: Get GNAT toolchain with alire uses: alire-project/setup-alire@v2 with: - toolchain: gnat_native^12 gprbuild^22 + toolchain: gnat_native^13 gprbuild^22 toolchain_dir: ./cached_gnat - - name: Build (Windows) - if: ${{ runner.os == 'Windows' }} - shell: msys2 {0} + - name: Build + shell: bash env: AWS_ACCESS_KEY_ID: ${{secrets.GHA_CACHE_ACCESS_KEY_ID}} AWS_SECRET_ACCESS_KEY: ${{secrets.GHA_CACHE_SECRET}} @@ -96,12 +99,6 @@ jobs: # This is to avoid locking .sh on win that prevents its updating cp .github/workflows/build-binaries.sh .github/workflows/build-binaries.sh_ .github/workflows/build-binaries.sh_ "${{ matrix.debug }}" ${{ runner.os }} ${{ env.TAG }} - - name: Build (non-Windows) - env: - AWS_ACCESS_KEY_ID: ${{secrets.GHA_CACHE_ACCESS_KEY_ID}} - AWS_SECRET_ACCESS_KEY: ${{secrets.GHA_CACHE_SECRET}} - if: ${{ runner.os != 'Windows' }} - run: .github/workflows/build-binaries.sh "${{ matrix.debug }}" ${{ runner.os }} ${{ env.TAG }} - name: Archive ALS binary if: ${{ github.event_name == 'push' }} uses: actions/upload-artifact@v3 diff --git a/.github/workflows/pack-binaries.sh b/.github/workflows/pack-binaries.sh index e7f3b6510..1bfe1fc2d 100755 --- a/.github/workflows/pack-binaries.sh +++ b/.github/workflows/pack-binaries.sh @@ -3,7 +3,7 @@ set -x -e DEBUG=$1 # Value is '' or 'debug' VSCE_TOKEN=$2 OVSX_TOKEN=$3 -TAG=$4 # For master it's 23.0.999, while for tag it's the tag itself +TAG=$4 # For master it's 24.0.999, while for tag it's the tag itself function make_change_log() { diff --git a/Makefile b/Makefile index 97dacea91..5e00fa13e 100644 --- a/Makefile +++ b/Makefile @@ -91,6 +91,7 @@ else endif all: coverage-instrument + $(GPRBUILD) -P gnat/lsp_3_17.gpr -p $(COVERAGE_BUILD_FLAGS) -c lsp-inputs.adb $(GPRBUILD) -P gnat/lsp_3_17.gpr -p $(COVERAGE_BUILD_FLAGS) $(GPRBUILD) -P gnat/tester.gpr -p $(BUILD_FLAGS) $(GPRBUILD) -d -ws -c -u -P gnat/lsp_server.gpr -p $(BUILD_FLAGS) s-memory.adb diff --git a/gnat/lsp_3_17.gpr b/gnat/lsp_3_17.gpr index b2a4ba586..ce763f56e 100644 --- a/gnat/lsp_3_17.gpr +++ b/gnat/lsp_3_17.gpr @@ -106,6 +106,8 @@ project LSP_3_17 is package Compiler is for Default_Switches ("Ada") use Common_Ada_Switches & Ada_Switches; + for Switches ("lsp-inputs.adb") use + Common_Ada_Switches & Ada_Switches & ("-O0"); for Local_Configuration_Pragmas use "gnat.adc"; end Compiler; diff --git a/integration/vscode/ada/package-lock.json b/integration/vscode/ada/package-lock.json index f27bb2841..a129f2a61 100644 --- a/integration/vscode/ada/package-lock.json +++ b/integration/vscode/ada/package-lock.json @@ -1,12 +1,12 @@ { "name": "ada", - "version": "23.0.999", + "version": "24.0.999", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "ada", - "version": "23.0.999", + "version": "24.0.999", "cpu": [ "arm64", "x64" diff --git a/integration/vscode/ada/package.json b/integration/vscode/ada/package.json index 3905c82f4..319837524 100644 --- a/integration/vscode/ada/package.json +++ b/integration/vscode/ada/package.json @@ -2,7 +2,7 @@ "name": "ada", "displayName": "Language Support for Ada", "description": "A Language Server providing Ada and SPARK support in Visual Studio Code", - "version": "23.0.999", + "version": "24.0.999", "publisher": "AdaCore", "license": "GPL-3.0", "engines": {