Giter Club home page Giter Club logo

autotest's People

Contributors

abiramen avatar andrew-taylor avatar dylan-brotherston avatar hexdoor avatar sschreyer avatar xaviercooney avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

autotest's Issues

add styleguide

A well-defined style guide should be created and enforced to help in the maintenance and/or improvement of autotest.

bundled autotest portability unchecked

bundle_autotests.sh generates a single autotest executable which can contain embedded tests for a set of exercises

This could convenient be delivered to a students as a single file to run autotests on their own hardware

But portability to platforms other than Linux has not been checked - and may require further work

Add CI for testing

  • Create a test suite to ensure that autotest functions as expected
  • Set up a CI action to run tests on push

autotest attempts to run tests when no files were supplied

Autotest attempts to run tests when no files were supplied, e.g.:


$ mkdir tmp
$ cat >tmp/tests.txt <<eof
files=a.sh
program=a.sh

1 args=1
2 args=2
3 args=3
eof 
$ autotest.py -a tmp
Test 1 (a.sh 1) - could not be run because these files are missing: a.sh
Test 2 (a.sh 2) - could not be run because these files are missing: a.sh
Test 3 (a.sh 3) - could not be run because these files are missing: a.sh
Test 4 (a.sh 4) - could not be run because these files are missing: a.sh
0 tests passed 0 tests failed  4 tests could not be run

better would be

$ autotest.py -a tmp
autotest.py: no files found to test,  expected these files: a.sh

--generate_expected_output adds quotation marks around -DFOO instances in compiler_args

When a test defines macros as part of compiler_args (e.g to replace a main function) and --generate_expected_output is used, it surrounds the -DFOO with single quotes. This is treated as a syntax error in autotest.

❯ cat autotest/tests.txt
files=test.c
command=./test

compiler_args=-DFOO=1 test.c -o test

1
❯ autotest -g -a autotest
files=test.c
command=./test

compiler_args='-DFOO=1' test.c -o test

1
### generated by: autotest --generate_expected_output - see https://github.com/COMP1511UNSW/autotest
1 expected_stdout='Hello, world!\n'
❯ autotest -g update -a autotest
❯ autotest -a autotest
autotest: /tmp/tmp.ihUpssD2nV/autotest/tests.txt:4: syntax error in assignment

Test specification documentation & source at: https://github.com/COMP1511UNSW/autotest - issues welcome

add typehints

Typehints serve as a form of documentation, making the code easier to read and maintain. They also enable static type-checking.

autotest can not runs tests in parallel

Proposed approach - add these variables:

test_threads_max default value of number of cores
test_threads_n default value 1
tests_threads_files_copied default value list of supplied files

tests would be run in min(test_threads_max, test_threads_n) threads

if tests_threads_files_copied is non-empty run each test in a new directory,
after copying the specified files to the directory.

explain_output_differences escape unicode is needlessly restrictive

https://github.com/COMP1511UNSW/autotest/blob/main/explain_output_differences.py#L379

# ...
        if len(line) > max_line_length_shown:
            line = line[0:max_line_length_shown] + " ..."
        line = line.encode("unicode_escape").decode("ascii")
        if leave_colorization:
            line = line.replace(r"\x1b", "\x1b")
        if leave_tabs:
            line = line.replace(r"\t", "\t")
            line = line.replace(r"\\", "\\")
# ...

I would like to see the line line = line.encode("unicode_escape").decode("ascii") removed ideally,
but @hexDoor has pointed out that this may be necessary to escape things away such as ANSI colour codes.

Unfortunately it escapes normal characters that are of multi-byte width (eg. other language codepoints, emojis, etc.)

Can we make it less restrictive, i.e. normally render displayable characters, and just escape dangerous/non-displayable bytes away?

autotest --generate_expected_output could be more readable

auto --generate uses repr to output expected output which is robust
but can be difficult to read

multi-line strings would be readable with triple-quotes

also probably more readable if non-ASCII characters replaced with code-points:

e.g. '\u597d' instead of '好'

non-unicode input and output can not be specified

Non unicode-output produces an error currently.

It is not possible to specify non-unicode output is expected

Non-unicode input also can not be specified directly.

There are workarounds, e.g: test_program | xxd

But it would be preferable to be able to specify non-unicode input/output, e.g

stdin=b'\xff'

no way to specify a list of compiler alternative

There is no way to specify that for example,
if clang can be found in $PATH compile with it,
and if not and gcc can be found in $PATH compile with it.
and if not ...

This would be allow more flexible use of tests

Add additional acceptance pytest cases

Standard tests have been included in the pytest test suite but it is currently lacking in real world examples.

Suggestion:
Perhaps extract some autotests from courses such as COMP2041 and COMP1521 for added assurance

Document all requirements

  • Requirements are currently presumed to be installed
  • termcolor has literally been included via copy-pasta
  • requirements.txt could be added

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.