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

Add tests #16

Open
flucknugget opened this issue Jul 4, 2018 · 12 comments
Open

Add tests #16

flucknugget opened this issue Jul 4, 2018 · 12 comments

Comments

@flucknugget
Copy link

flucknugget commented Jul 4, 2018

I'd be happy to write them. Here's what I think should be included:

  • OS
    • Linux
    • Mac
    • Windows
  • Python
    • Official: 3.x
    • Other: ???
  • Tests
    • mount the example rar
    • code style? If so I vote for Black enforce pep8
@KOLANICH
Copy link
Contributor

KOLANICH commented Jul 4, 2018

code style? If so I vote for Black

this project already uses pep8

mount the example rar

👍

python, OS

Everything can be used in CI configs. You can use https://github.com/KOLANICH/mol2scad.py/blob/master/.travis.yml and https://github.com/KOLANICH/mol2scad.py/blob/master/.gitlab-ci.yml as boilerplates.

@flucknugget
Copy link
Author

Bummer, so that then. Do you have any ideas for tests besides mounting the rar?

@KOLANICH
Copy link
Contributor

KOLANICH commented Jul 4, 2018

@fluknugget, you can mount other files formats too. But what we need, is to verify that the result is the same, I guess a shell script hashing the contents recursively, sorting the result and hashing again and then comparing the hash may help.

@flucknugget
Copy link
Author

Of the ones available here I only know about rar. But yeah, mount and then check contents sounds great. I guess we'd need a rar file with a bunch of files and folders in it. Maybe use a separate repo like kaitai_tests does? Or I guess just use really small files. I'll look into it.

What about Jython and all that?

@KOLANICH
Copy link
Contributor

KOLANICH commented Jul 4, 2018

Jython
GraalVM
IronPython

Not sure if it is suported by fusepy. It needs FFI, they have them, but with very different APIs. Again, if there is no suport in fusepy, you can always implement it, the community will be happy if you do it.

Or I guess just use really small files.

Small file, there is no sense to use large ones imho.

@flucknugget
Copy link
Author

flucknugget commented Jul 4, 2018

Not sure if it is suported by fusepy. It needs FFI, they have them, but with very different APIs. Again, if there is no suport in fusepy, you can always implement it, the community will be happy if you do it.

Hm, I don't think so. I only use official, I just thought if they are already supported out of the box we might as well test them.

BTW you have old open PRs on this repo.

@GreyCat
Copy link
Member

GreyCat commented Jul 4, 2018

There are several categories of tests we can do. I suggest that we'll start with basic integration tests, i.e. it's not that important what is going on inside the application, it's just the test that will:

  1. Set up proper environment (providing FUSE kernel / APIs, etc)
  2. Run kaitaifs to mount a single, well-known and supported FS module + single and well-known reference data file => rar would be just perfect, simple .rar file for test purposes can be easily created and maintained in the repository
  3. Check using normal OS mechanisms (i.e. not by doing any internal kaitaifs calls) that we can:
  • Traverse the directories
  • List the files and get expected names, sizes & attributes
  • Get file contents (whole or partial)

That's it. If we could do that for Linux, OSX and Windows, that alone would be truly awesome.

However, CI for anything but Linux is relatively tricky. For Windows, one can try AppVeyor, but I'm not sure if they would allow to set up proper FUSE environment. For OS X, I have no idea, unfortunately. Travis indeed supports OS X builds, but AFAIU they don't provide any root access and/or means to install kernel-level stuff such as FUSE.

@flucknugget
Copy link
Author

Cool, I'll start looking into step 1 and just use the example rar for steps 2 and 3 for now.

Sounds like it's possible.

@KOLANICH
Copy link
Contributor

KOLANICH commented Jul 5, 2018

simple .rar file for test purposes can be easily created and maintained in the repository

I guess we should enable git lfs and rewrite the history before it's too late. For now travis doesn't have lfs, so installing it manually and triggering it manually may be required.

@GreyCat
Copy link
Member

GreyCat commented Jul 5, 2018

@KOLANICH I don't see any legitimate reason to use git lfs here. The whole purpose of these tests is to test that it works at all, we don't need any big files for that. Regular git would surely accomodate a meager 200 bytes of a binary rar file.

@KOLANICH
Copy link
Contributor

KOLANICH commented Jul 5, 2018

LFS should be better called "BFS", it's not for large files, it's for any non-text files

@flucknugget
Copy link
Author

Basic Windows integration tests will work once fusepy is updated, hopefully soon. I'll do Travis now which should work with the current fusepy.

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

No branches or pull requests

3 participants