Skip to content

[llvm-lit] Expand and Rewrite Tests for FileNotFoundError for compiler-rt tests in lit internal shell #106111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
4 tasks done
Harini0924 opened this issue Aug 26, 2024 · 0 comments · Fixed by #106115
Closed
4 tasks done

Comments

@Harini0924
Copy link
Contributor

Harini0924 commented Aug 26, 2024

When using the internal shell with this command LIT_USE_INTERNAL_SHELL=1 an FileNotFoundError is displayed.
Error displayed:

File "/usr/local/google/home/harinidonthula/llvm-project/llvm/utils/lit/lit/TestRunner.py", line 656, in processRedirects
    fd = open(redir_filename, mode)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: b'/usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/test/profile/Profile-i386/Linux/(llvm-profdata'

Affected Tests:

  • -compiler-rt/test/profile/Linux/counter_promo_for.c
  • compiler-rt/test/profile/Linux/counter_promo_nest.c
  • compiler-rt/test/profile/Linux/counter_promo_while.c
  • compiler-rt/test/profile/Linux/instrprof-debug-info-correlate.c

These files need to be expanded to resolve the issue.

@Harini0924 Harini0924 self-assigned this Aug 26, 2024
Harini0924 added a commit that referenced this issue Aug 27, 2024
…ompatibility (#106115)

This patch addresses compatibility issues with the lit internal shell by
expanding and rewriting test scripts in the compiler-rt subproject.
These changes were prompted by the FileNotFound unresolved errors
encountered during the testing process, specifically when running the
command `LIT_USE_INTERNAL_SHELL=1 ninja check compiler-rt`.

**Why the error occurred:**
The error occurred because the original test scripts used process
substitution `(<(...))` in their diff commands. Process substitution
creates temporary files or FIFOs to hold command output, and these are
then passed to `diff`. However, the lit internal shell, which is more
limited than a typical shell like `bash`, does not support process
substitution. When lit tries to execute these commands, it is unable to
create or access the temporary files or FIFOs generated by process
substitution. As a result, lit attempts to open a file or directory that
doesn't exist, leading to the `FileNotFoundError`.

**Changes Made:**

- Instead of using process substitution, the commands now explicitly
redirect the output of `llvm-profdata show` to temporary files before
performing the `diff` comparison. This ensures that the lit internal
shell can correctly find and open these files, resolving the
`FileNotFoundError`.

[This change is relevant [RFC] Enabling the lit internal shell by
Default](https://discourse.llvm.org/t/rfc-enabling-the-lit-internal-shell-by-default/80179)
fixes: #106111
Harini0924 added a commit that referenced this issue Aug 27, 2024
…or-loop (#106150)

This patch adds `REQUIRES: shell` to the `focus-function.test` because
the lit internal shell does not support the for loop syntax. This will
make the test file unsupported when running llvm-lit with its internal
shell implementation, which is enabled by turning on the
`LIT_USE_INTERNAL_SHELL=1`.

fixes: #106111
@Harini0924 Harini0924 changed the title [llvm-lit] FileNotFoundError in lit internal shell [llvm-lit] FileNotFoundError in lit internal shell in compiler-rt Aug 28, 2024
@Harini0924 Harini0924 changed the title [llvm-lit] FileNotFoundError in lit internal shell in compiler-rt Expand and Rewrite Tests for FileNotFoundError for compiler-rt tests in lit internal shell Aug 28, 2024
@Harini0924 Harini0924 changed the title Expand and Rewrite Tests for FileNotFoundError for compiler-rt tests in lit internal shell [llvm-lit] Expand and Rewrite Tests for FileNotFoundError for compiler-rt tests in lit internal shell Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
@EugeneZelenko @Harini0924 and others