Skip to content

[flang]enable execute_command_line tests #82

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

Merged
merged 1 commit into from
Jan 29, 2024

Conversation

yiwu0b11
Copy link
Contributor

@yiwu0b11 yiwu0b11 commented Jan 26, 2024

build and pass all three tests on Linux, will test it on Windows later today

build and pass all three test on Linux
@yiwu0b11 yiwu0b11 requested review from tblah and tarunprabhu January 26, 2024 15:57
Copy link
Contributor

@tblah tblah left a comment

Choose a reason for hiding this comment

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

LGTM: execute command line was added in llvm/llvm-project#74077

@yiwu0b11
Copy link
Contributor Author

It will compile and run on Windows, but it does not behave the same. This is because Windows has different command, dir <=> ls, timeout <=> sleep.

Copy link
Contributor

@tarunprabhu tarunprabhu left a comment

Choose a reason for hiding this comment

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

Tested on Linux on x86 and it looks to be fine. Thanks for enabling these.

@tarunprabhu
Copy link
Contributor

It will compile and run on Windows, but it does not behave the same. This is because Windows has different command, dir <=> ls, timeout <=> sleep.

Just out of curiosity. What do you mean by this?

@yiwu0b11
Copy link
Contributor Author

yiwu0b11 commented Jan 29, 2024

It will compile and run on Windows, but it does not behave the same. This is because Windows has different command, dir <=> ls, timeout <=> sleep.

Just out of curiosity. What do you mean by this?

This is because execute_command_line calls std::system, and on Windows that is cmd. cmd doesn't have ls, the Windows equivalent command is dir, and for timeout for sleep. It will compile and run correct based on the standard, however, the printout from the execution won't be the same on Linux.
For example:

call execute_command_line ("ls *.f90")

This will compile but will cause:

fatal Fortran runtime error(.......regression\execute_command_line_1.f90:31): Invalid command quit with exit status code: 1

as this is expected based on the standard, if cmdstat is assigned with non-zero value but the CMDSTAT variable is not present, error termination is initiated.
https://github.com/llvm/llvm-project/blob/c9a6e993f7b349405b6c8f9244cd9cf0f56a6a81/flang/docs/Intrinsics.md?plain=1#L905

@yiwu0b11 yiwu0b11 merged commit 3bd693f into llvm:main Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants