tmt icon indicating copy to clipboard operation
tmt copied to clipboard

tmt expects scripts to be executable

Open hadess opened this issue 10 months ago • 5 comments

In tests/tests.fmf:

summary: Check basic command line options
discover:
    how: shell
execute:
    script: tests/run_tests.sh

tests/run_tests.sh exists as a 0644 file, but tmt complains about not being able to execute it.

The script being executable a requirement in STI, and it probably shouldn't be one in tmt, as one would expect scripts to be executed by a shell.

At the very least, the migration documentation should mention this: https://tmt.readthedocs.io/en/stable/questions.html#how-do-i-migrate-sti-tests-to-tmt

hadess avatar Apr 29 '25 09:04 hadess

The documentation might be misleading or unclear, but yes, tmt does expect that whatever script is set to, is executable.

happz avatar Apr 29 '25 11:04 happz

The documentation might be misleading or unclear, but yes, tmt does expect that whatever script is set to, it's executable.

It can be a set to a shell code as well. See https://tmt.readthedocs.io/en/stable/spec/tests.html#test

script: |
   echo hello world...

lukaszachy avatar Apr 29 '25 13:04 lukaszachy

The documentation might be misleading or unclear, but yes, tmt does expect that whatever script is set to, it's executable.

It can be a set to a shell code as well. See https://tmt.readthedocs.io/en/stable/spec/tests.html#test

script: |
   echo hello world...

Hm, better to say "... executable command"?

happz avatar Apr 29 '25 14:04 happz

It can be a set to a shell code as well. See https://tmt.readthedocs.io/en/stable/spec/tests.html#test

script: |
   echo hello world..

is that "shell code" or would it just run /bin/echo and the | is for a multi-line format?

Either way, the migration documentation should mention that the script should be executable, unlike in STI where this wasn't needed.

hadess avatar Apr 29 '25 14:04 hadess

It can be a set to a shell code as well. See https://tmt.readthedocs.io/en/stable/spec/tests.html#test

script: |
   echo hello world..

is that "shell code" or would it just run /bin/echo and the | is for a multi-line format?

Yes, and yes - it is a multiline string, "echo hello world..\n".

happz avatar Apr 29 '25 14:04 happz

So the needed action is to update the documentation here:

  • https://tmt.readthedocs.io/en/stable/questions.html#how-do-i-migrate-sti-tests-to-tmt
  • https://tmt.readthedocs.io/en/stable/spec/tests.html#test

And explicitly mention that scripts used in the script or test field need to be executable.

psss avatar Sep 23 '25 08:09 psss

Let's cover #3703 as part of this as well. Adding as a child issue.

psss avatar Sep 29 '25 11:09 psss