Giter VIP home page Giter VIP logo

e3-testsuite's People

Contributors

brobecke avatar elsaferrara avatar enzbang avatar fabien-chouteau avatar flingure avatar glacambre avatar helflym avatar kokkonisd avatar liaiss avatar nikokrock avatar pmderodat avatar ptroja avatar victorverbeke avatar yakobowski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

e3-testsuite's Issues

Use of Python 3.8 features

Specifically, of typing.Protocol in a couple of places:

class FragmentCallback(Protocol):
def __call__(self, previous_values: Dict[str, Any], slot: int) -> None:
...

class SupportsLessThan(Protocol):
def __lt__(self, other: SupportsLessThan) -> bool:
...

There doesn't seem to be any specifically defined minimum Python version in this repo, but libadalang/langkit/e3-core do specify 3.7, so I guess this would inherit from that?

Can't run e3-testsuite under GHA's windows platform

I'm facing an issue on GitHub Actions, when running e3-testsuite on windows. The issue concerns the rlimit tool from e3-core, I get the following message:

rlimit: cannot spawn process (error 0x5)

Looks like it's a known issue:

# Add windows-latest once the rlimit problem is fixed
# (T608-018).
, which seems to have been partially addressed by AdaCore/e3-core@ed39720.

Is there something I should set in the GHA runner to make it work?

Thanks!

AdaCoreLegacyTestDriver does not always use self.default_encoding

Dear e3-testsuite maintainer (😉),

Our main testsuite's driver is inheriting from the AdaCoreLegacyTestDriver and overrides its self.default_encoding with UTF-8. This makes sense for our usecase, we do not deal with binary data but we do deal with UTF-8 characters, hence having properly rendered UTF-8 characters is better than having \x[0-F][0-F] strings in our outputs.

Unfortunately, this does not work well on windows, some of our tests fail with the following backtrace:

Traceback (most recent call last):
  File "C:\it\sbx\wave\x86_64-windows64\e3-for-testing\install\lib\site-packages\e3\testsuite\fragment.py", line 187, in run
    self.return_value = self.data(self.previous_values, self.slot)
  File "C:\it\sbx\wave\x86_64-windows64\e3-for-testing\install\lib\site-packages\e3\testsuite\driver\classic.py", line 478, in run_wrapper
    self.set_up()
  File "C:\it\sbx\wave\x86_64-windows64\e3-for-testing\install\lib\site-packages\e3\testsuite\driver\adacore.py", line 91, in set_up
    self.argv = self.get_script_command_line()
  File "C:\it\sbx\wave\x86_64-windows64\e3-for-testing\install\lib\site-packages\e3\testsuite\driver\adacore.py", line 170, in get_script_command_line
    for line in f:
  File "C:\it\sbx\wave\x86_64-windows64\e3-for-testing\install\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 193: character maps to <undefined>

This is because the test.sh contains UTF-8 characters, but the AdaCoreLegacyTestDriver opens test.sh files using the platform's default encoding.

The following patch seems to make things work again:

diff --git "a/C:\\it\\local\\e3\\lib\\site-packages\\e3\\testsuite\\driver\\adacore.py" b/tmp/driver.py
index 8625a50c9..af3e01642 100644
--- "a/C:\\it\\local\\e3\\lib\\site-packages\\e3\\testsuite\\driver\\adacore.py"
+++ b/tmp/driver.py
@@ -164,7 +164,7 @@ class AdaCoreLegacyTestDriver(DiffTestDriver):
                 new_script.append(". $TEST_SUPPORT_DIR/support.sh")

             # Read all lines in the original test script
-            with open(self.script_file) as f:
+            with open(self.script_file, encoding=self.default_encoding) as f:
                 # Get rid of potential whitespaces and CR at the end of
                 # each line.
                 for line in f:
@@ -177,10 +177,10 @@ class AdaCoreLegacyTestDriver(DiffTestDriver):

             # Write the shell script and schedule its execution with "bash"
             new_script_filename = self.working_dir("__test.sh")
-            with open(new_script_filename, "w") as f:
+            with open(new_script_filename, "wb") as f:
                 for line in new_script:
-                    f.write(line)
-                    f.write("\n")
+                    f.write(line.encode(self.default_encoding))
+                    f.write(b"\n")
             return ["bash", new_script_filename]

         else:  # os-specific

Since I'm not sure I have a complete understanding of the situation, I thought I'd open an issue instead of a PR, let me know if you need more information :)

Issue with output_refiners for AdaCoreLegacyTestDriver

In the following code:

PatternSubstitute(
rb"[^ '\"]*"
+ os.path.basename(self.working_dir()).encode("ascii")
+ rb"/src/",
rb""
),

The pattern substitute for the replacement of the path is buggy.
If the path is at the start of the line, it will replace some part of the previous line.

The issue comes from the first part of the regex:
rb"[^ '\"]*"

I suggest replacing this with:

rb"\S*"

Which takes care of whitespaces including the start of the line.

xunit output: escape output text when adding it to the .xml

The text put in the <system-out> node is already escaped for XML inclusion, but it needs to be stripped from control characters as well, such as �^[2J�^[H which can be used to print coloured output in terminal. (Observed in the gnatfuzz testsuite)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.