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 a test for the recent glew accessor functionality #42

Merged
merged 1 commit into from Feb 25, 2017

Conversation

wchristian
Copy link
Collaborator

I can't test this usefully myself, but this adds a test for your recent glew accessor work and, if run on a non-4.5 machine, should be able to verify whether #38 is fixed.

@wchristian
Copy link
Collaborator Author

Are unprovided versions supposed to die like this, and not return 0 instead?

GLEW_VERSION_4_1 not available on this machine at t/02_glew_version_accessors.t line 16.

@devel-chm
Copy link
Collaborator

devel-chm commented Feb 20, 2017 via email

@wchristian
Copy link
Collaborator Author

Ah, cool. :) Changed the test and pushed, let's see what Travis thinks.

@wchristian wchristian force-pushed the glew_acc_test branch 3 times, most recently from 47e7c38 to 5cc73ad Compare February 20, 2017 15:37
@wchristian
Copy link
Collaborator Author

Looks like the most recent change doesn't quite do it:

ok 1 - glew version 1.1 reported correctly as 1 for 2.1
ok 2 - glew version 1.2 reported correctly as 1 for 2.1
ok 3 - glew version 1.3 reported correctly as 1 for 2.1
ok 4 - glew version 1.4 reported correctly as 1 for 2.1
ok 5 - glew version 1.5 reported correctly as 1 for 2.1
ok 6 - glew version 2.0 reported correctly as 1 for 2.1
ok 7 - glew version 2.1 reported correctly as 1 for 2.1
not ok 8 - glew version 3.0 reported correctly as 0 for 2.1
#   Failed test 'glew version 3.0 reported correctly as 0 for 2.1'
#   at t/02_glew_version_accessors.t line 39.
#          got: '1'
#     expected: '0'
not ok 9 - glew version 3.1 reported correctly as 0 for 2.1
#   Failed test 'glew version 3.1 reported correctly as 0 for 2.1'
#   at t/02_glew_version_accessors.t line 39.
#          got: '1'
#     expected: '0'
not ok 10 - glew version 3.2 reported correctly as 0 for 2.1
#   Failed test 'glew version 3.2 reported correctly as 0 for 2.1'
#   at t/02_glew_version_accessors.t line 39.
#          got: '1'
#     expected: '0'
not ok 11 - glew version 3.3 reported correctly as 0 for 2.1
#   Failed test 'glew version 3.3 reported correctly as 0 for 2.1'
#   at t/02_glew_version_accessors.t line 39.
#          got: '1'
#     expected: '0'
not ok 12 - glew version 4.0 reported correctly as 0 for 2.1
#   Failed test 'glew version 4.0 reported correctly as 0 for 2.1'
#   at t/02_glew_version_accessors.t line 39.
#          got: '1'
#     expected: '0'
ok 13 - glew version 4.1 reported correctly as 0 for 2.1
ok 14 - glew version 4.2 reported correctly as 0 for 2.1
ok 15 - glew version 4.3 reported correctly as 0 for 2.1
ok 16 - glew version 4.4 reported correctly as 0 for 2.1
not ok 17 - glew version 4.5 reported correctly as 0 for 2.1
#   Failed test 'glew version 4.5 reported correctly as 0 for 2.1'
#   at t/02_glew_version_accessors.t line 39.
#          got: '1'
#     expected: '0'

@devel-chm
Copy link
Collaborator

The code for all the GLEW_* accessors is identical. My guess is the answer depends on what type of context you requested. The default is back compatible but that may not be compatible with the latest core functionality. I'll continue to investigate here.

@devel-chm
Copy link
Collaborator

@wchristian: Could you please clarify---for the incorrectly reported GLEW_VERSION_M_N, does the functionality actually work even though the state variable is claiming not?

@wchristian
Copy link
Collaborator Author

What happens is that the gl version is 2.1, so i'd expect only things below that to be there. However surprisingly for 3.1 - 4.0 it gets 1 from the GLEW calls, unexpectedly, then the 4.1 - 4.4 ones behave as expected and return 0, and the 4.5 call again returns 1; despite the GL version being only 2.1.

@wchristian
Copy link
Collaborator Author

That aside i'm not sure what you mean with "functionality works". If you look at the test code it only calls the GLEW version calls and compares their output.

@devel-chm
Copy link
Collaborator

This may have to do with the use of the glewExperimental = GL_TRUE for the glewInit call. What happens if you change that to GL_FALSE and rebuild?

@wchristian
Copy link
Collaborator Author

Ok, tried deleting the line to see if it helps, didn't, just now pushed a branch where it's explicitly set to GL_FALSE, maybe that helps.

@wchristian
Copy link
Collaborator Author

No change in outcome.

@devel-chm
Copy link
Collaborator

Thanks for the followup. On my machine, the results are the same as from the glewinfo program that comes with the GLEW distribution. Since I'm not in a position to check the GLEW_VERSION_N_M result with attempts to use the relevant OpenGL API functions, I'm going to assume this is a potential issue that appears to come from the GLEW sources and not from our bindings.

@wchristian
Copy link
Collaborator Author

I'm not even sure if it's incorrect though. Maybe some higher version subsets can be available despite low gl version?

@wchristian
Copy link
Collaborator Author

I asked a friend with some experience with GL and it seems like the version is just a bound on what's guaranteed, but not a limit of what's not provided. So i guess i'll just have to have the test check all the variables below the version for 1, and the ones above for "not a crash".

I'll make the appropiate changes tomorrow.

@wchristian wchristian force-pushed the glew_acc_test branch 2 times, most recently from 6bb4a98 to 5b8ace6 Compare February 24, 2017 13:04
@wchristian
Copy link
Collaborator Author

Ok, fixed it up and the test should have some use now at least.

@devel-chm
Copy link
Collaborator

Is this request still valid? My understanding is that checking the specific numbers is not 100% reliable. A test that the GLEW_* accessors return values is probably sufficient for a test (sort of an existence proof test).

@wchristian
Copy link
Collaborator Author

It is, see my last two messages before yours, also the changes i made to the code since. :)

@devel-chm
Copy link
Collaborator

Sorry, the test generation code wasn't clear as to whether it was fixed or not.

@wchristian
Copy link
Collaborator Author

Want me to add some comments to explain what it's doing?

@devel-chm
Copy link
Collaborator

Nope, still fails which doesn't mean the code is broken, just that the OpenGL context/implementation is not reporting things correctly. How about wrapping the whole thing in a TODO block so we can monitor the success or failure without generating false fails from CPAN Testers?

@wchristian
Copy link
Collaborator Author

Paste the fail here please for future reference. And sure, TODO wrapping should be interesting. Want me to do it?

@devel-chm
Copy link
Collaborator

make test
Running Mkbootstrap for OpenGL::Modern ()
chmod 644 "Modern.bs"
PERL_DL_NONLAZY=1 "/usr/bin/perl.exe" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/.t
t/00_basic.t ................... ok
t/01_context.t ................. ok
t/02_glew_version_accessors.t .. 1/?
# Failed test 'glew version 4.5 reported as 1 for 4.5'
# at t/02_glew_version_accessors.t line 41.
# got: '0'
# expected: '1'
# Looks like you failed 1 test of 17.
t/02_glew_version_accessors.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/17 subtests
t/02_glGetShaderInfoLog.t ...... ok
t/0999_tidy.t .................. ok

Test Summary Report
-------------------
t/02_glew_version_accessors.t (Wstat: 256 Tests: 17 Failed: 1)
Failed test: 17
Non-zero exit status: 1
Files=5, Tests=26, 3 wallclock secs ( 0.03 usr 0.05 sys + 1.65 cusr 0.68 csys = 2.41 CPU)
Result: FAIL
Failed 1/5 test programs. 1/26 subtests failed.
make: *** [Makefile:1058: test_dynamic] Error 255

@devel-chm
Copy link
Collaborator

I would appreciated it.

@wchristian
Copy link
Collaborator Author

Added comments and marked the tests todo.

@devel-chm
Copy link
Collaborator

Is there a reason the test number begins with 02_ instead of 03_?

@wchristian
Copy link
Collaborator Author

The numbers just specify phasing, outside of being run after the context check i don't particularly care in which order they're run. Feel free to modify if you have an opinion on the order. :)

@devel-chm devel-chm merged commit e3fe7b5 into master Feb 25, 2017
@wchristian wchristian deleted the glew_acc_test branch February 25, 2017 22:20
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.

None yet

2 participants