Skip to content
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

deal gracefully with OSError from learntris #59

Open
rpoyner-tri opened this issue Sep 10, 2019 · 1 comment
Open

deal gracefully with OSError from learntris #59

rpoyner-tri opened this issue Sep 10, 2019 · 1 comment
Assignees
Labels
tanco related to new test runner

Comments

@rpoyner-tri
Copy link

Example: maximally obtuse TDD programmer does exactly what the error messages indicate, and no more:

$ ./testris.py 

Testris is the test runner for Learntris. Learntris is
the part *you* write, in whatever language you prefer.

If you're seeing this message when you tried to run
testris.py, it means testris can't find your code!

Your first step is to write a *console-mode* program
(one that does absolutely nothing!) and tell testris
where to find it:

    ./testris.py [/path/to/learntris] [arguments]

The path should refer to a physical file on disk, so if
you need command line arguments, create a wrapper program.
The default path is "./learntris".

You can pass extra arguments that will be passed to the
guest learntris program.

If you need more help with setting up, try reading:
https://github.com/LearnProgramming/learntris/wiki/Getting-Set-Up

Once testris is able to launch your program, this message
will be replaced with instructions for implementing your
first feature.

File not found: ./learntris
$ touch learntris
$ ./testris.py 

[Errno 13] Permission denied
Couldn't run './learntris' due to a permission error.
Make sure your program is marked as an executable.
$ chmod a+x learntris 
$ ./testris.py 
--------------------------------------------------
Traceback (most recent call last):
  File "./testris.py", line 168, in main
    run_tests(cmdline, use_shell)
  File "./testris.py", line 134, in run_tests
    program = spawn(program_args, use_shell)
  File "./testris.py", line 84, in spawn
    stdout=subprocess.PIPE)
  File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
    raise child_exception
OSError: [Errno 8] Exec format error
--------------------------------------------------
Oh no! Testris encountered an unexpected problem while
attempting to run your program. Please report the above
traceback in the issue tracker, so that we can help you
with the problem and provide a better error message in
the future.

  https://github.com/LearnProgramming/learntris/issues

There are probably tons of possibilities for OSError, and maybe not all of them can be gracefully handled without risking being misleading. Anyway, food for thought.

@tangentstorm
Copy link
Contributor

Thanks @rpoyner-tri ... Sorry nobody ever responded to this. This is actually a pretty good test script for the runner itself, which I've forked off into the @tangentcode/tanco repository. Will probably duplicate this there and close it here.

@tangentstorm tangentstorm self-assigned this Jan 30, 2024
@tangentstorm tangentstorm added the tanco related to new test runner label Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tanco related to new test runner
Projects
None yet
Development

No branches or pull requests

2 participants