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

Try to make tests run on Windows #41

Closed
wants to merge 4 commits into from
Closed

Conversation

hustf
Copy link

@hustf hustf commented Oct 17, 2015

This effort stranded on

ccall(:dup, Int32, (Int32,) fd) on GZip.jl:278
could not load symbol "dup" on Windows, not on OSX.

Libz is planned to replace Gzip. This is submitted in case this is picked up again for some reason.

@simonster
Copy link
Member

Travis doesn't support Windows.

@kmsquire
Copy link
Contributor

@hustf, it seems that travis doesn't like tabs in the .travis.yml.

@tkelman tkelman mentioned this pull request Dec 7, 2015
@ranjanan
Copy link

Bump!

Can this PR be rebased? I noticed @tkelman enabled Appveyor, so can we enable it for this PR and then tag a new release?

@bmharsha, is this a fix for #48 ?

@hustf
Copy link
Author

hustf commented Jul 27, 2016

I´ll do that, and see if #48 is affected before and after.

@hustf
Copy link
Author

hustf commented Jul 29, 2016

The first test (line 49) is not mean to be run if gunzip.exe is not present. But is there any point in keeping it around for other OS?

It runs the standalone program gunzip.exe with command line options. On Windows, it could be identified using 'where.exe gunzip.exe', if it happens to be on PATH. Or we could use something like JULIA_HOME..\Git\Gunzip.exe.

The .exe file was included with Julia until 0.4.0 rc4 and possibly a bit longer. Now, it's not included anymore.
The library that is actually used ("zlib1" on Windows) is independent of Gunzip.exe. So this is an irrelevant test as far as I can see. I suppose this is the case for other OSs as well?

@tkelman
Copy link
Contributor

tkelman commented Jul 30, 2016

I think the package only uses the library, but the tests use the executable for verification?

@tkelman
Copy link
Contributor

tkelman commented Jul 30, 2016

on 0.5, you should be able to run busybox gunzip on windows but that won't work elsewhere if busybox is not installed. the git paths changed between 0.4.0 and 0.4.1, they're kind of internal programs but okay for testing.

@hustf
Copy link
Author

hustf commented Jul 30, 2016

Thanks for the info about busybox.
I kept the gunzip test on unix.
Line 57; gzfdio or gzdopen. This is not found in the windows library. This is not a test of the library, so I find it unreasonable to signal a failed check here.

close(gzfile)
close(raw_file)
@test data == data4
end
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like a tab snuck in here...

@kmsquire
Copy link
Contributor

There's a merge conflict, currently, so AppVeyor can't run. Can you rebase on master?

@hustf
Copy link
Author

hustf commented Jul 31, 2016

kmsquire, thanks for input, tabs are replaced with spaces now.
Note to self, next time:

  1. Rebase forked master.
  2. Rebase forked branch with forked master
  3. Make sure everything is totally up to date
  4. Check out branch, work, commit, git push origin

@tkelman
Copy link
Contributor

tkelman commented Jul 31, 2016

A bunch of unrelated commits are now in here. Could you rebase again, check that your local branch only has your commits on top of the current master, then be sure to force push over your fork's branch?

@hustf
Copy link
Author

hustf commented Jul 31, 2016

Tony, that´s right. Like the January 9 committs are now referred here. That´s an uninteded result of rebasing my fork master, then rebasing my brach fixDep. But I´m afraid I don´t know how to force push. It would be easier for me to delete this and start over with a new fork, unless you have the exact commands in front of you?

@tkelman
Copy link
Contributor

tkelman commented Jul 31, 2016

push with the --force flag

- Added Compat for 0.3.11, changed to 0.4 Union syntax line 75
- Revoked travis.yml; now with git config --global core.autocrlf input.
- Added appveyor.yml; copy of Compat appveour replacing package name.
- Removed two tests on Windows, shortened try..catch to intended error messages only.
- Tab changes
- Removed line end spaces
@hustf
Copy link
Author

hustf commented Jul 31, 2016

I guess that is it now....? Merge?

@@ -91,7 +93,9 @@ try
NEW = GZip.GZLIB_VERSION > "1.2.3.9"
pos = position(gzfile)
NEW && (pos2 = position(gzfile,true))
@test_throws ErrorException seek(gzfile, 100) # can't seek backwards on write
try
@test_throws ErrorException seek(gzfile, 100) # can't seek backwards on write
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this in a try?

Copy link
Author

Choose a reason for hiding this comment

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

It used to be in a large try block from line 29/31. Line 97 actually throws an error; the test checks that it throws the correct error. Without a try, the code execution would halt. Correct me if I'm wrong.

Copy link
Contributor

Choose a reason for hiding this comment

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

@test_throws shouldn't halt if the right type of exception gets thrown

Copy link
Contributor

Choose a reason for hiding this comment

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

and try finally without a catch will also terminate on an error, just with the cleanup tasks performed

Copy link
Author

Choose a reason for hiding this comment

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

When commenting out 'catch' line 96 and replacing 98 with 'println("l98") the result is:

julia> include("runtests.jl")
ERROR: LoadError: test failed: seek(gzfile,100) did not throw ErrorException
 in expression: seek(gzfile,100)
 in error at error.jl:21
while loading C:\Users\F\Documents\GitHub\GZip.jl\test\runtests.jl, in expression starting on line 97

This in Julia 0.4.6, Windows 10.

Copy link
Contributor

Choose a reason for hiding this comment

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

so it didn't error at all, but it was supposed to. is this a bug or platform IO difference? I'm not sure.

Copy link
Author

Choose a reason for hiding this comment

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

That is right, I did not notice that at first. But we see in other places that there are differences in the library.

@@ -91,7 +93,9 @@ try
NEW = GZip.GZLIB_VERSION > "1.2.3.9"
pos = position(gzfile)
NEW && (pos2 = position(gzfile,true))
@test_throws ErrorException seek(gzfile, 100) # can't seek backwards on write
try
Copy link
Contributor

Choose a reason for hiding this comment

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

still don't think this should be a try catch. it could be disabled on windows if it's broken there, but do we know why it's broken?

Copy link
Author

Choose a reason for hiding this comment

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

I think only the error message is broken.
seek(gzfile, 100) returns true in all cases, whether the current position can be changed or not.
To test the behaviour on Windows, we could check that the position remains unchanged after running seek(gzfile,100) or seek(gzfile, 1000000)
A more thorough approach might be to actually throw an error in Windows too, around Gzip.jl:328.

Copy link
Contributor

Choose a reason for hiding this comment

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

is it a different exception type on windows then? or no exception at all?

@SimonDanisch SimonDanisch mentioned this pull request Aug 8, 2016
@hustf
Copy link
Author

hustf commented Aug 8, 2016

Simon, thanks, but appveyor was put in this PR and also merged separately while this was still open. I have rebased to make the history as clear as possible. There are many improvements which could be made here, but I believe in making short and uncomplicated pull requests (in cases like this, that is!).

@kmsquire
Copy link
Contributor

Windows tests have been working for a while now.

@kmsquire kmsquire closed this Nov 26, 2019
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.

6 participants