Re: Review Request 129197: Fix tests on FreeBSD

2016-10-31 Thread Gleb Popov


> On Oct. 16, 2016, 4:12 p.m., Tobias Berner wrote:
> > I'm kind of unsure if this is right. Yes, the tests run now, but isn't the 
> > issue rather in the way kpty works (or fails to work on FreeBSD)?
> 
> Gleb Popov wrote:
> From what i've understood, this boils down to 
> `KPtyDevicePrivate::_k_canRead()` method in kptydevice.cpp. The line 284
> 
> if (!::ioctl(q->masterFd(), PTY_BYTES_AVAILABLE, (char *) &available))
> 
> returns 0 in `available` and this makes method return `false`. This, in 
> turn, make `waitFor*` methods return false too.
> 
> Now you mention it, i'm also unsure if this `ioctl` behaves different on 
> Linux.
> 
> Oswald Buddenhagen wrote:
> i've been trying to make sense of the freebsd pts layer, and utterly 
> failed. the documentation is anything between abysmal and non-existing. i 
> suggest you find and invite an actual expert.
> 
> kptyprocess keeps both ends of the pty open, so whether the child process 
> is running or not should be irrelevant. apparently, it's not. maybe this is 
> somehow related to whether the tty is the process' controlling terminal.
> 
> you can try the following:
> - remove the freebsd case from the PTY_BYTES_AVAILABLE definition near 
> the top. this was introduced 2008, before freebsd 8's release, which got an 
> entirely new pts layer. it may just work with the generic code now.
> - try replacing the masterFd() with slaveFd() in the above ioctl. that 
> would be kinda broken, but at least it would be a data point.

This turned out to be a bug in Qt itself. `QProcess` unit tests are also 
failing with the same `.waitForFinished()` error. So, we'll first deal with it 
and then i'll get back on this.


- Gleb


---
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/129197/#review100039
---


On Oct. 16, 2016, 2:44 p.m., Gleb Popov wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/129197/
> ---
> 
> (Updated Oct. 16, 2016, 2:44 p.m.)
> 
> 
> Review request for KDE Frameworks, Adriaan de Groot, Tobias Berner, Oswald 
> Buddenhagen, and Martin Tobias Holmedahl Sandsmark.
> 
> 
> Repository: kpty
> 
> 
> Description
> ---
> 
> Apparently, KPtyDevice can't be operated on after KPtyProcess finishes. Tweak 
> tests accordingly, so they actually test things while the process is still 
> running.
> 
> 
> Diffs
> -
> 
>   autotests/kptyprocesstest.cpp 8b0b5b0 
> 
> Diff: https://git.reviewboard.kde.org/r/129197/diff/
> 
> 
> Testing
> ---
> 
> make test on FreeBSD
> 
> 
> Thanks,
> 
> Gleb Popov
> 
>



Re: Review Request 129197: Fix tests on FreeBSD

2016-10-29 Thread Oswald Buddenhagen

---
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/129197/#review100148
---




autotests/kptyprocesstest.cpp (line 123)


just use QStandardPaths::findExecutable()

anyway, that's for a separate commit.


- Oswald Buddenhagen


On Oct. 16, 2016, 11:44 a.m., Gleb Popov wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/129197/
> ---
> 
> (Updated Oct. 16, 2016, 11:44 a.m.)
> 
> 
> Review request for KDE Frameworks, Adriaan de Groot, Tobias Berner, Oswald 
> Buddenhagen, and Martin Tobias Holmedahl Sandsmark.
> 
> 
> Repository: kpty
> 
> 
> Description
> ---
> 
> Apparently, KPtyDevice can't be operated on after KPtyProcess finishes. Tweak 
> tests accordingly, so they actually test things while the process is still 
> running.
> 
> 
> Diffs
> -
> 
>   autotests/kptyprocesstest.cpp 8b0b5b0 
> 
> Diff: https://git.reviewboard.kde.org/r/129197/diff/
> 
> 
> Testing
> ---
> 
> make test on FreeBSD
> 
> 
> Thanks,
> 
> Gleb Popov
> 
>



Re: Review Request 129197: Fix tests on FreeBSD

2016-10-29 Thread Oswald Buddenhagen


> On Oct. 16, 2016, 1:12 p.m., Tobias Berner wrote:
> > I'm kind of unsure if this is right. Yes, the tests run now, but isn't the 
> > issue rather in the way kpty works (or fails to work on FreeBSD)?
> 
> Gleb Popov wrote:
> From what i've understood, this boils down to 
> `KPtyDevicePrivate::_k_canRead()` method in kptydevice.cpp. The line 284
> 
> if (!::ioctl(q->masterFd(), PTY_BYTES_AVAILABLE, (char *) &available))
> 
> returns 0 in `available` and this makes method return `false`. This, in 
> turn, make `waitFor*` methods return false too.
> 
> Now you mention it, i'm also unsure if this `ioctl` behaves different on 
> Linux.

i've been trying to make sense of the freebsd pts layer, and utterly failed. 
the documentation is anything between abysmal and non-existing. i suggest you 
find and invite an actual expert.

kptyprocess keeps both ends of the pty open, so whether the child process is 
running or not should be irrelevant. apparently, it's not. maybe this is 
somehow related to whether the tty is the process' controlling terminal.

you can try the following:
- remove the freebsd case from the PTY_BYTES_AVAILABLE definition near the top. 
this was introduced 2008, before freebsd 8's release, which got an entirely new 
pts layer. it may just work with the generic code now.
- try replacing the masterFd() with slaveFd() in the above ioctl. that would be 
kinda broken, but at least it would be a data point.


- Oswald


---
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/129197/#review100039
---


On Oct. 16, 2016, 11:44 a.m., Gleb Popov wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/129197/
> ---
> 
> (Updated Oct. 16, 2016, 11:44 a.m.)
> 
> 
> Review request for KDE Frameworks, Adriaan de Groot, Tobias Berner, Oswald 
> Buddenhagen, and Martin Tobias Holmedahl Sandsmark.
> 
> 
> Repository: kpty
> 
> 
> Description
> ---
> 
> Apparently, KPtyDevice can't be operated on after KPtyProcess finishes. Tweak 
> tests accordingly, so they actually test things while the process is still 
> running.
> 
> 
> Diffs
> -
> 
>   autotests/kptyprocesstest.cpp 8b0b5b0 
> 
> Diff: https://git.reviewboard.kde.org/r/129197/diff/
> 
> 
> Testing
> ---
> 
> make test on FreeBSD
> 
> 
> Thanks,
> 
> Gleb Popov
> 
>



Re: Review Request 129197: Fix tests on FreeBSD

2016-10-16 Thread Gleb Popov


> On Oct. 16, 2016, 4:12 p.m., Tobias Berner wrote:
> > I'm kind of unsure if this is right. Yes, the tests run now, but isn't the 
> > issue rather in the way kpty works (or fails to work on FreeBSD)?

>From what i've understood, this boils down to 
>`KPtyDevicePrivate::_k_canRead()` method in kptydevice.cpp. The line 284

if (!::ioctl(q->masterFd(), PTY_BYTES_AVAILABLE, (char *) &available))

returns 0 in `available` and this makes method return `false`. This, in turn, 
make `waitFor*` methods return false too.

Now you mention it, i'm also unsure if this `ioctl` behaves different on Linux.


- Gleb


---
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/129197/#review100039
---


On Oct. 16, 2016, 2:44 p.m., Gleb Popov wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/129197/
> ---
> 
> (Updated Oct. 16, 2016, 2:44 p.m.)
> 
> 
> Review request for KDE Frameworks, Adriaan de Groot, Tobias Berner, Oswald 
> Buddenhagen, and Martin Tobias Holmedahl Sandsmark.
> 
> 
> Repository: kpty
> 
> 
> Description
> ---
> 
> Apparently, KPtyDevice can't be operated on after KPtyProcess finishes. Tweak 
> tests accordingly, so they actually test things while the process is still 
> running.
> 
> 
> Diffs
> -
> 
>   autotests/kptyprocesstest.cpp 8b0b5b0 
> 
> Diff: https://git.reviewboard.kde.org/r/129197/diff/
> 
> 
> Testing
> ---
> 
> make test on FreeBSD
> 
> 
> Thanks,
> 
> Gleb Popov
> 
>



Re: Review Request 129197: Fix tests on FreeBSD

2016-10-16 Thread Tobias Berner

---
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/129197/#review100039
---



I'm kind of unsure if this is right. Yes, the tests run now, but isn't the 
issue rather in the way kpty works (or fails to work on FreeBSD)?

- Tobias Berner


On Oct. 16, 2016, 1:44 p.m., Gleb Popov wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/129197/
> ---
> 
> (Updated Oct. 16, 2016, 1:44 p.m.)
> 
> 
> Review request for KDE Frameworks, Adriaan de Groot, Tobias Berner, Oswald 
> Buddenhagen, and Martin Tobias Holmedahl Sandsmark.
> 
> 
> Repository: kpty
> 
> 
> Description
> ---
> 
> Apparently, KPtyDevice can't be operated on after KPtyProcess finishes. Tweak 
> tests accordingly, so they actually test things while the process is still 
> running.
> 
> 
> Diffs
> -
> 
>   autotests/kptyprocesstest.cpp 8b0b5b0 
> 
> Diff: https://git.reviewboard.kde.org/r/129197/diff/
> 
> 
> Testing
> ---
> 
> make test on FreeBSD
> 
> 
> Thanks,
> 
> Gleb Popov
> 
>