← 输入框|github.com|刷新
Skip to content

Enable run_tests in Windows CI - #1463

Merged
certik merged 5 commits into
lcompilers:mainfrom
Thirumalai-Shaktivel:fix_carriage_return
Feb 1, 2023
Merged

certik merged 5 commits into
lcompilers:mainfrom
Thirumalai-Shaktivel:fix_carriage_return

Conversation

@Thirumalai-Shaktivel

Copy link
Copy Markdown
Collaborator

No description provided.

@Thirumalai-Shaktivel
Thirumalai-Shaktivel force-pushed the fix_carriage_return branch 2 times, most recently from 9e8fd77 to c42501c Compare January 25, 2023 16:34
@certik

certik commented Jan 25, 2023 •

Copy link
Copy Markdown
Contributor

TODO:

  • The windows tests are passing, but the tests are actually failing, so that has to be fixed
  • The \r should be skipped in the tokenizer, then everything should start working, and the change should be quite minimal

@certik

certik commented Jan 25, 2023

Copy link
Copy Markdown
Contributor

Let's add a .gitattributes file and put there something like:

tests/*.py -text

which "unsets" the text attribute, which according to https://www.git-scm.com/docs/gitattributes#_text should preserve the line ends.

Then we should keep all the files as they currently are, only using LF. Then let's commit a few files with CRLF to test that CR also works. And then all tests should behave exactly the same on Linux as on Windows.

@Thirumalai-Shaktivel

Thirumalai-Shaktivel commented Jan 27, 2023 •

Copy link
Copy Markdown
Collaborator Author

The Windows CI fails. But, I think it doesn't return a non-zero number, so the CI passes.
I think the issue is related to the threading or parallel running of run_tests.

cc @certik

@Thirumalai-Shaktivel Thirumalai-Shaktivel changed the title XX Fix Windows run_tests Enable run_tests in Windows CI Jan 27, 2023
@Thirumalai-Shaktivel

Copy link
Copy Markdown
Collaborator Author
 --- Logging error ---
[221](https://github.com/lcompilers/lpython/actions/runs/4022128153/jobs/6911599418#step:13:222)
Traceback (most recent call last):
[222](https://github.com/lcompilers/lpython/actions/runs/4022128153/jobs/6911599418#step:13:223)
  File "C:\Miniconda\envs\test\lib\logging\__init__.py", line 1103, in emit
[223](https://github.com/lcompilers/lpython/actions/runs/4022128153/jobs/6911599418#step:13:224)
    stream.write(msg + self.terminator)
[224](https://github.com/lcompilers/lpython/actions/runs/4022128153/jobs/6911599418#step:13:225)
  File "C:\Miniconda\envs\test\lib\encodings\cp1252.py", line 19, in encode
[225](https://github.com/lcompilers/lpython/actions/runs/4022128153/jobs/6911599418#step:13:226)
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
[226](https://github.com/lcompilers/lpython/actions/runs/4022128153/jobs/6911599418#step:13:227)
UnicodeEncodeError: 'charmap' codec can't encode character '\u2713' in position 27: character maps to <undefined>
[227](https://github.com/lcompilers/lpython/actions/runs/4022128153/jobs/6911599418#step:13:228)
 START TEST:  complex2.py
[228](https://github.com/lcompilers/lpython/actions/runs/4022128153/jobs/6911599418#step:13:229)
Call stack:
[229](https://github.com/lcompilers/lpython/actions/runs/4022128153/jobs/6911599418#step:13:230)
 START TEST:  constants1.py
[230](https://github.com/lcompilers/lpython/actions/runs/4022128153/jobs/6911599418#step:13:231)
  File "D:\a\lpython\lpython\run_tests.py", line 131, in <module>
[231](https://github.com/lcompilers/lpython/actions/runs/4022128153/jobs/6911599418#step:13:232)
    tester_main("LPython", single_test)
[232](https://github.com/lcompilers/lpython/actions/runs/4022128153/jobs/6911599418#step:13:233)
  File "D:\a\lpython\lpython\src\libasr\compiler_tester\tester.py", line 398, in tester_main
[233](https://github.com/lcompilers/lpython/actions/runs/4022128153/jobs/6911599418#step:13:234)
    single_test(test,
[234](https://github.com/lcompilers/lpython/actions/runs/4022128153/jobs/6911599418#step:13:235)
  File "D:\a\lpython\lpython\run_tests.py", line 71, in single_test
[235](https://github.com/lcompilers/lpython/actions/runs/4022128153/jobs/6911599418#step:13:236)
    run_test(
[236](https://github.com/lcompilers/lpython/actions/runs/4022128153/jobs/6911599418#step:13:237)
  File "D:\a\lpython\lpython\src\libasr\compiler_tester\tester.py", line 332, in run_test
[237](https://github.com/lcompilers/lpython/actions/runs/4022128153/jobs/6911599418#step:13:238)
    log.debug(s + " " + check())
[238](https://github.com/lcompilers/lpython/actions/runs/4022128153/jobs/6911599418#step:13:239)
Message: 'complex1.py * asr \x1b[32m\x1b[1m\u2713 \x1b[39m\x1b[0m'
[239](https://github.com/lcompilers/lpython/actions/runs/4022128153/jobs/6911599418#step:13:240)
Arguments: ()

Can the error be related to the check symbol with color?
complex1.py * asr ✓ <---

@Thirumalai-Shaktivel

Copy link
Copy Markdown
Collaborator Author

I see, The error was because of this: ✓ symbol.

Comment thread src/libasr/compiler_tester/tester.py Outdated

def color(value):
return "\033[" + str(int(value)) + "m"
return ""

@czgdp1807 czgdp1807 Jan 27, 2023 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we have the function if we are just going to return an empty string? Can we just replace, color(...) calls with "" instead? Or may be for Windows return an empty string but for other operating systems return "\033[" + str(int(value)) + "m".

@Thirumalai-Shaktivel Thirumalai-Shaktivel Jan 27, 2023 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, this was used for debugging purposes.
If this method is valid for fixing, then I thought to add an option --no-color to print the run_tests output without color and check symbol.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought to add an option --no-color to print the output without color.

I think its already there? I have used it many times before.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean, for run_tests?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

app.add_flag("--no-color", arg_no_color, "Turn off colored AST/ASR");

@Thirumalai-Shaktivel Thirumalai-Shaktivel Jan 27, 2023 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, that is used for AST and ASR. But, I was thinking to add a new option in run_tests. Actually, I had problems with the run_tests output color in Windows and here in the CI, I had a problem with the check symbol. So, adding a new option would be the right choice for fixing both. But, I'm not sure.

@czgdp1807
czgdp1807 force-pushed the fix_carriage_return branch from e2aef23 to ad6b324 Compare January 31, 2023 04:29
@certik
certik merged commit 8fa533a into lcompilers:main Feb 1, 2023
@Thirumalai-Shaktivel
Thirumalai-Shaktivel deleted the fix_carriage_return branch February 2, 2023 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants