Skip to content

Add tests for uncastable streams and dataloss streams #10173

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

Merged
merged 2 commits into from
Jul 10, 2023

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented Dec 28, 2022

Moreover, stop using php_stream_can_cast() just before a php_stream_cast()

This is a follow-up from #10093.
I mimicked the online test by using the same set-up as testing the HTTP wrapper locally, as I couldn't seem to trigger a data loss in any other available by default streams wrappers.

However, I think GD is broken somehow, as even prior to the change it was hanging on my non-castable user stream wrapper. Maybe it's because of how I'm trying to pass it as a wrapper?

@Girgias Girgias force-pushed the stream-cast-warnings branch from db06fcf to 23697ec Compare December 28, 2022 17:23
@codecov-commenter
Copy link

codecov-commenter commented Dec 29, 2022

Codecov Report

Merging #10173 (5f42a46) into master (c90c944) will decrease coverage by 0.12%.
The diff coverage is 87.08%.

❗ Current head 5f42a46 differs from pull request most recent head f5fe9f3. Consider uploading reports for the commit f5fe9f3 to get more accurate results

@@            Coverage Diff             @@
##           master   #10173      +/-   ##
==========================================
- Coverage   68.34%   68.21%   -0.13%     
==========================================
  Files         852      852              
  Lines      313348   313345       -3     
==========================================
- Hits       214156   213754     -402     
- Misses      99192    99591     +399     
Impacted Files Coverage Δ
Zend/Optimizer/zend_inference.h 72.72% <ø> (ø)
Zend/zend_alloc.c 74.24% <ø> (ø)
Zend/zend_builtin_functions.c 77.44% <0.00%> (+0.10%) ⬆️
Zend/zend_execute.h 93.75% <ø> (ø)
Zend/zend_hash.c 80.09% <ø> (ø)
Zend/zend_hash.h 90.71% <ø> (ø)
Zend/zend_ini_scanner.l 90.47% <ø> (ø)
Zend/zend_smart_str.h 96.29% <ø> (ø)
Zend/zend_sort.c 100.00% <ø> (ø)
Zend/zend_string.h 85.07% <ø> (ø)
... and 59 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Girgias
Copy link
Member Author

Girgias commented Dec 31, 2022

So the GD stream casting test segfaults on FreeBSD meaning there is likely a bug in it. But I can't reproduce it on Linux :/

@Girgias Girgias force-pushed the stream-cast-warnings branch from 1cab27e to f5fe9f3 Compare January 5, 2023 12:57
@Girgias
Copy link
Member Author

Girgias commented Jan 8, 2023

Okay reverted the can_cast drop, added a test where a stream cast actually loses data based on @arnaud-lb's script and suppress the warnings on the casts which don't actually lose data.

The only thing which I'm still confused by are the new GD tests that are inconsistent between platforms and also segfaults on FreeBSD, but maybe it's best to split those into a new PR so that we can merge all these new tests.

@cmb69
Copy link
Member

cmb69 commented Jan 13, 2023

The only thing which I'm still confused by are the new GD tests that are inconsistent between platforms and also segfaults on FreeBSD, but maybe it's best to split those into a new PR so that we can merge all these new tests.

Yeah, this might be the best solution for now.

@Girgias Girgias force-pushed the stream-cast-warnings branch 2 times, most recently from 15e4eb0 to fc1f94d Compare January 13, 2023 13:10
@Girgias
Copy link
Member Author

Girgias commented Jan 13, 2023

Everything should be green now, but will let CI run and squash/merge afterwards and open the GD changes in it's own PR again.

@cmb69
Copy link
Member

cmb69 commented Jan 13, 2023

Got some "reds" already. :(

@Girgias
Copy link
Member Author

Girgias commented Jan 13, 2023

The failed test is:

 Test posix_fpathconf [ext/posix/tests/posix_fpathconf.phpt]

So I'll have a look at this.

@Girgias Girgias force-pushed the stream-cast-warnings branch from fc1f94d to e3925a5 Compare January 15, 2023 15:22
@Girgias
Copy link
Member Author

Girgias commented Jan 15, 2023

The failed test is:

 Test posix_fpathconf [ext/posix/tests/posix_fpathconf.phpt]

So I'll have a look at this.

The issue seems to be that the $fd = fopen(sys_get_temp_dir(), "r"); line is flacky, so I've used __DIR__ instead.

@Girgias
Copy link
Member Author

Girgias commented Jan 16, 2023

@devnexen do you know why the Test posix_fpathconf [ext/posix/tests/posix_fpathconf.phpt] test is being flaky?

@cmb69
Copy link
Member

cmb69 commented Jan 16, 2023

do you know why the Test posix_fpathconf [ext/posix/tests/posix_fpathconf.phpt] test is being flaky?

Addding a posix_get_last_error() might clarify.

@devnexen
Copy link
Member

@devnexen do you know why the Test posix_fpathconf [ext/posix/tests/posix_fpathconf.phpt] test is being flaky?

not at the moment but will have a look when I get the chance.

Copy link
Member

@bukka bukka left a comment

Choose a reason for hiding this comment

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

@Girgias I had another look on this one and all makes sense to me (the code looks good to me). It just needs rebasing / resolving conflicts and making sure that win jobs also pass.

@Girgias Girgias force-pushed the stream-cast-warnings branch from 7bcb494 to b0cab05 Compare July 7, 2023 11:20
@Girgias
Copy link
Member Author

Girgias commented Jul 7, 2023

I don't understand why the Windows job now hangs compared to 6 months ago.

@iluuu1994
Copy link
Member

@Girgias It would be easiest to just remove the --no-progress flag temporarily.

@bukka
Copy link
Member

bukka commented Jul 9, 2023

Well if GH actions Win jobs don't work, we should maybe put back AppVeyor or something that runs win. I don't really feel comfortable to merge this without any Win tests.

@bukka
Copy link
Member

bukka commented Jul 9, 2023

Specifically I'm talking about sapi_windows_vt100_support test...

@Girgias
Copy link
Member Author

Girgias commented Jul 10, 2023

Well if GH actions Win jobs don't work, we should maybe put back AppVeyor or something that runs win. I don't really feel comfortable to merge this without any Win tests.

Appveyor also doesn't work.

I asked @arnaud-lb as he helped design the test and he told me those are not meant to actually work on Windows, so I'll skip them.
Indeed popen('echo 1; echo 2; rm $file') would be launched in cmd.exe, thus the file never gets deleted and we have an infinite loop.

Girgias added 2 commits July 10, 2023 10:29
Moreover, stop using php_stream_can_cast() just before a php_stream_cast()
@Girgias Girgias force-pushed the stream-cast-warnings branch from 6bd6bf3 to 3e10016 Compare July 10, 2023 09:34
@Girgias Girgias merged commit 39ef5ca into php:master Jul 10, 2023
@Girgias Girgias deleted the stream-cast-warnings branch July 10, 2023 12:24
@iluuu1994
Copy link
Member

@Girgias
Copy link
Member Author

Girgias commented Jul 11, 2023

They do, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants