Skip to content

Commit

Permalink
Merge branch 'mr/boris/ci' into 'master'
Browse files Browse the repository at this point in the history
Update CI to use improved anod spec

See merge request eng/toolchain/gnatcoll-bindings!15
  • Loading branch information
yakobowski committed Jul 11, 2024
2 parents 49e7c4f + fde2b3e commit 10ea9f5
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 189 deletions.
66 changes: 10 additions & 56 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,70 +45,24 @@ default:
echo "sourcing the generic CI environment"
. /tmp/ci_env.sh
# generic_anod_ci modifies the rebuild strategy of anod.
# Set it back to full, so we do not rebuild the packages depending
# on gnatcoll-core and contained in GNAT.
exec anod tune --full
exec anod vcs --list
########
# JOBS #
########

build_and_test_py39:
build_and_test:
services:
- image:e3
- cpu:2
stage: build
interruptible: true
parallel:
matrix:
- PYTHON: ["3.9", "3.10", "3.11", "3.12"]
script:
- anod vcs --add-repo gnatcoll-bindings $CI_PROJECT_DIR
- anod build --latest gnatcoll-bindings -Qpython=3.9
- BS=`anod info build gnatcoll-bindings -Qpython=3.9 --show build_space`
- eval `anod printenv gnatcoll-bindings -Qpython=3.9 --build-env`
- export GPR_PROJECT_PATH=/tmp/it/wave/x86_64-linux/$BS/install/share/gpr:$GPR_PROJECT_PATH
- export ADA_PYTHON_HOME=/tmp/it/wave/x86_64-linux/tp-python_3.9/install
- ls /tmp/it/wave/x86_64-linux/$BS/install/share/gpr || ls -R /tmp/it/wave/x86_64-linux/
- cd $CI_PROJECT_DIR/python3/tests && /it/e3/bin/python ./testsuite.py -v

build_and_test_py310:
services:
- image:e3
- cpu:2
stage: build
script:
- anod vcs --add-repo gnatcoll-bindings $CI_PROJECT_DIR
- anod build --latest gnatcoll-bindings -Qpython=3.10
- BS=`anod info build gnatcoll-bindings -Qpython=3.10 --show build_space`
- eval `anod printenv gnatcoll-bindings -Qpython=3.10 --build-env`
- export GPR_PROJECT_PATH=/tmp/it/wave/x86_64-linux/$BS/install/share/gpr:$GPR_PROJECT_PATH
- export ADA_PYTHON_HOME=/tmp/it/wave/x86_64-linux/tp-python_3.10/install
- cd $CI_PROJECT_DIR/python3/tests && /it/e3/bin/python ./testsuite.py -v

build_and_test_py311:
services:
- image:e3
- cpu:2
stage: build
script:
- anod vcs --add-repo gnatcoll-bindings $CI_PROJECT_DIR
- anod build --latest gnatcoll-bindings -Qpython=3.11
- BS=`anod info build gnatcoll-bindings -Qpython=3.11 --show build_space`
- eval `anod printenv gnatcoll-bindings -Qpython=3.11 --build-env`
- export GPR_PROJECT_PATH=/tmp/it/wave/x86_64-linux/$BS/install/share/gpr:$GPR_PROJECT_PATH
- export ADA_PYTHON_HOME=/tmp/it/wave/x86_64-linux/tp-python/install
- cd $CI_PROJECT_DIR/python3/tests && /it/e3/bin/python ./testsuite.py -v

build_and_test_py312:
services:
- image:e3
- cpu:2
stage: build
script:
- anod vcs --add-repo gnatcoll-bindings $CI_PROJECT_DIR
- anod build --latest gnatcoll-bindings -Qpython=3.12
- BS=`anod info build gnatcoll-bindings -Qpython=3.12 --show build_space`
- eval `anod printenv gnatcoll-bindings -Qpython=3.12 --build-env`
- export GPR_PROJECT_PATH=/tmp/it/wave/x86_64-linux/$BS/install/share/gpr:$GPR_PROJECT_PATH
- export ADA_PYTHON_HOME=/tmp/it/wave/x86_64-linux/tp-python_3.12/install
- cd $CI_PROJECT_DIR/python3/tests && /it/e3/bin/python ./testsuite.py -v

- anod test --latest gnatcoll-bindings -Qpython=$PYTHON
- testsuite_reports
artifacts:
reports:
junit: xunit-*.xml
1 change: 0 additions & 1 deletion testsuite/support/test.gpr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
-- The scenario variable TEST_SOURCES is automatically set by the
-- driver to point to the test sources.
with "gnatcoll_core";
with "gnatcoll_iconv";

project Test is
Test_Sources := External("TEST_SOURCES");
Expand Down
98 changes: 0 additions & 98 deletions testsuite/support/test_assert.adb
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,10 @@
-- --
------------------------------------------------------------------------------

with Ada.Exceptions;
with Ada.Strings.Unbounded;
with Ada.Text_IO;
with GNATCOLL.Iconv;

package body Test_Assert is
package IO renames Ada.Text_IO;
package Iconv renames GNATCOLL.Iconv;

------------
-- Assert --
Expand Down Expand Up @@ -81,100 +77,6 @@ package body Test_Assert is
end if;
end Assert;

------------
-- Assert --
------------

function Bytes_Image (Input : String) return String;
function Bytes_Image (Input : String) return String
is
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
for C in Input'Range loop
Ada.Strings.Unbounded.Append (Result, Character'Pos (Input (C))'Img);
end loop;
return Ada.Strings.Unbounded.To_String (Result);
end Bytes_Image;

procedure Assert_Iconv
(Input : String;
Expected : String;
From_Code : String;
To_Code : String;
Transliteration : Boolean := False;
Ignore : Boolean := False;
Msg : String := "";
Location : String := SI.Source_Location)
is
begin
declare
Result : constant String := Iconv.Iconv
(Input => Input,
To_Code => To_Code,
From_Code => From_Code,
Transliteration => Transliteration,
Ignore => Ignore);
Success : constant Boolean := Result = Expected;
begin
Assert (Success, Msg, Location);
if not Success then
IO.Put_Line ("iconv(" & Bytes_Image (Input) &
", to_code => " & To_Code &
", from_code => " & From_code &
", transliteration => " & Transliteration'Img &
", ignore => " & Ignore'Img);
IO.Put_Line ("- expect: " & Bytes_Image (Expected));

IO.Put_Line ("- got: " & Bytes_Image (Result));
end if;
end;
exception
when E : others =>
Assert (False, Msg, Location);
IO.Put_Line ("got exception: " & ASCII.LF &
Ada.Exceptions.Exception_Information (E));
end Assert_Iconv;

procedure Assert_Invalid_Sequence
(Input : String;
From_Code : String;
To_Code : String;
Transliteration : Boolean := False;
Ignore : Boolean := False;
Msg : String := "";
Location : String := SI.Source_Location)
is
begin
declare
Result : constant String := Iconv.Iconv
(Input => Input,
To_Code => To_Code,
From_Code => From_Code,
Transliteration => Transliteration,
Ignore => Ignore);
begin
Assert (False, Msg, Location);
IO.Put_Line ("iconv(" & Input &
", to_code => " & To_Code &
", from_code => " & From_code &
", transliteration => " & Transliteration'Img &
", ignore => " & Ignore'Img);
IO.Put_Line ("- expect: Invalid_Sequence_Error ");
IO.Put ("- got: ");
for C in Result'Range loop
IO.Put (Character'Pos (Result (C))'Img);
end loop;
IO.New_Line;
end;
exception
when Iconv.Invalid_Sequence_Error =>
Assert (True, Msg, Location);
when E : others =>
Assert (False, Msg, Location);
IO.Put_Line ("got exception: " & ASCII.LF &
Ada.Exceptions.Exception_Information (E));
end Assert_Invalid_Sequence;

------------
-- Report --
------------
Expand Down
23 changes: 0 additions & 23 deletions testsuite/support/test_assert.ads
Original file line number Diff line number Diff line change
Expand Up @@ -46,29 +46,6 @@ package Test_Assert is
-- If Left = Right then test case is considered PASSED, otherwise
-- the test status is FAILED and Final_Status set to 1.

procedure Assert_Iconv
(Input : String;
Expected : String;
From_Code : String;
To_Code : String;
Transliteration : Boolean := False;
Ignore : Boolean := False;
Msg : String := "";
Location : String := SI.Source_Location);
-- Transform Input using Iconv and expect Expected as a result
-- The other parameters are for GNATCOLL.Iconv.Iconv

procedure Assert_Invalid_Sequence
(Input : String;
From_Code : String;
To_Code : String;
Transliteration : Boolean := False;
Ignore : Boolean := False;
Msg : String := "";
Location : String := SI.Source_Location);
-- Assert that input sequence will be considered by Iconv as an invalid
-- sequence.

function Report return Natural;
-- Report should be called the following way at the end of a test
-- program main function:
Expand Down
1 change: 0 additions & 1 deletion testsuite/tests/coders/test.gpr
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
with "gnatcoll_core";
with "gnatcoll_iconv";
with "gnatcoll_lzma";
with "gnatcoll_zlib";

Expand Down
Loading

0 comments on commit 10ea9f5

Please sign in to comment.