public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] Broken Fedora build
@ 2020-10-21 19:35 Petr Vorel
  2020-10-22  2:36 ` Li Wang
  0 siblings, 1 reply; 8+ messages in thread
From: Petr Vorel @ 2020-10-21 19:35 UTC (permalink / raw)
  To: ltp

Hi,

Fedora build is broken due missing <sys/timeb.h> [1].
Quick fix would probably be to use Fedora 33 instead of Rawhide. [2]
But we should port hugetlb.c and trace_sched.c (if used) to gettimeofday or
clock_gettime. [3]

Kind regards,
Petr

[1] https://travis-ci.org/github/linux-test-project/ltp/jobs/737698948
[2] https://www.spinics.net/lists/fedora-devel/msg279551.html
[3] https://www.spinics.net/lists/fedora-devel/msg279545.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [LTP] Broken Fedora build
  2020-10-21 19:35 [LTP] Broken Fedora build Petr Vorel
@ 2020-10-22  2:36 ` Li Wang
  2020-10-22  2:44   ` Yang Xu
  2020-10-22  6:01   ` Jan Stancek
  0 siblings, 2 replies; 8+ messages in thread
From: Li Wang @ 2020-10-22  2:36 UTC (permalink / raw)
  To: ltp

Petr Vorel <pvorel@suse.cz> wrote:

> Fedora build is broken due missing <sys/timeb.h> [1].
> Quick fix would probably be to use Fedora 33 instead of Rawhide. [2]
> But we should port hugetlb.c and trace_sched.c (if used) to gettimeofday or
> clock_gettime. [3]

+1
I prefer to go replace ftime() by gettimeofday() or clock_gettime()
way to solve this from root.

-- 
Regards,
Li Wang


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [LTP] Broken Fedora build
  2020-10-22  2:36 ` Li Wang
@ 2020-10-22  2:44   ` Yang Xu
  2020-10-22  5:18     ` Xiao Yang
  2020-10-22  6:01   ` Jan Stancek
  1 sibling, 1 reply; 8+ messages in thread
From: Yang Xu @ 2020-10-22  2:44 UTC (permalink / raw)
  To: ltp

Hi Li,Petr
> Petr Vorel<pvorel@suse.cz>  wrote:
>
>> Fedora build is broken due missing<sys/timeb.h>  [1].
>> Quick fix would probably be to use Fedora 33 instead of Rawhide. [2]
>> But we should port hugetlb.c and trace_sched.c (if used) to gettimeofday or
>> clock_gettime. [3]
>
> +1
> I prefer to go replace ftime() by gettimeofday() or clock_gettime()
> way to solve this from root.
+1

I have seen the hugetlb.c and trace_sched.c code, they all use the time 
to generate a random value for ftok or sched_priority. So using 
gettimeofday() also looks ok.

I will send a patch to use gettimeofday.

Best Regards
Yang Xu
>




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [LTP] Broken Fedora build
  2020-10-22  2:44   ` Yang Xu
@ 2020-10-22  5:18     ` Xiao Yang
  2020-10-22  5:47       ` Li Wang
  0 siblings, 1 reply; 8+ messages in thread
From: Xiao Yang @ 2020-10-22  5:18 UTC (permalink / raw)
  To: ltp

On 2020/10/22 10:44, Yang Xu wrote:
> Hi Li,Petr
>> Petr Vorel<pvorel@suse.cz>  wrote:
>>
>>> Fedora build is broken due missing<sys/timeb.h>  [1].
>>> Quick fix would probably be to use Fedora 33 instead of Rawhide. [2]
>>> But we should port hugetlb.c and trace_sched.c (if used) to 
>>> gettimeofday or
>>> clock_gettime. [3]
>>
>> +1
>> I prefer to go replace ftime() by gettimeofday() or clock_gettime()
>> way to solve this from root.
> +1
>
> I have seen the hugetlb.c and trace_sched.c code, they all use the 
> time to generate a random value for ftok or sched_priority. So using 
> gettimeofday() also looks ok.
Hi,

It is fine for me to replace ftime(), but I wonder if we can remove 
fime() and srand()/srandom() directly? :-)
It seems unnecessary to set the seed for random number.

Best Regards,
Xiao Yang
>
> I will send a patch to use gettimeofday.
>
> Best Regards
> Yang Xu
>>
>
>
>
>




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [LTP] Broken Fedora build
  2020-10-22  5:18     ` Xiao Yang
@ 2020-10-22  5:47       ` Li Wang
  2020-10-22  6:22         ` Yang Xu
  0 siblings, 1 reply; 8+ messages in thread
From: Li Wang @ 2020-10-22  5:47 UTC (permalink / raw)
  To: ltp

Xiao Yang <yangx.jy@cn.fujitsu.com> wrote:

> >> I prefer to go replace ftime() by gettimeofday() or clock_gettime()
> >> way to solve this from root.
> > +1
> >
> > I have seen the hugetlb.c and trace_sched.c code, they all use the
> > time to generate a random value for ftok or sched_priority. So using
> > gettimeofday() also looks ok.
> Hi,
>
> It is fine for me to replace ftime(), but I wonder if we can remove
> fime() and srand()/srandom() directly? :-)
> It seems unnecessary to set the seed for random number.

That's true, but random() will generate the same number each time.
I slightly tend to keep setting the seed by srandom() to get a different
randomized number for test variety.

-- 
Regards,
Li Wang


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [LTP] Broken Fedora build
  2020-10-22  2:36 ` Li Wang
  2020-10-22  2:44   ` Yang Xu
@ 2020-10-22  6:01   ` Jan Stancek
  1 sibling, 0 replies; 8+ messages in thread
From: Jan Stancek @ 2020-10-22  6:01 UTC (permalink / raw)
  To: ltp



----- Original Message -----
> Petr Vorel <pvorel@suse.cz> wrote:
> 
> > Fedora build is broken due missing <sys/timeb.h> [1].
> > Quick fix would probably be to use Fedora 33 instead of Rawhide. [2]
> > But we should port hugetlb.c and trace_sched.c (if used) to gettimeofday or
> > clock_gettime. [3]
> 
> +1
> I prefer to go replace ftime() by gettimeofday() or clock_gettime()
> way to solve this from root.

Agreed, ftime is marked as obsolete.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [LTP] Broken Fedora build
  2020-10-22  5:47       ` Li Wang
@ 2020-10-22  6:22         ` Yang Xu
  2020-10-22  6:27           ` Xiao Yang
  0 siblings, 1 reply; 8+ messages in thread
From: Yang Xu @ 2020-10-22  6:22 UTC (permalink / raw)
  To: ltp

Hi Li
> Xiao Yang<yangx.jy@cn.fujitsu.com>  wrote:
>
>>>> I prefer to go replace ftime() by gettimeofday() or clock_gettime()
>>>> way to solve this from root.
>>> +1
>>>
>>> I have seen the hugetlb.c and trace_sched.c code, they all use the
>>> time to generate a random value for ftok or sched_priority. So using
>>> gettimeofday() also looks ok.
>> Hi,
>>
>> It is fine for me to replace ftime(), but I wonder if we can remove
>> fime() and srand()/srandom() directly? :-)
>> It seems unnecessary to set the seed for random number.
>
> That's true, but random() will generate the same number each time.
Agree. If we don't call srandom, repeatly call random binary will give 
same  random num. ie
root@localhost ~]# ./random
random num 1804289383
random num 846930886
random num 1681692777
random num 1714636915
random num 1957747793
random num 424238335
random num 719885386
random num 1649760492
random num 596516649
random num 1189641421
[root@localhost ~]# ./random
random num 1804289383
random num 846930886
random num 1681692777
random num 1714636915
random num 1957747793
random num 424238335
random num 719885386
random num 1649760492
random num 596516649
random num 1189641421
[root@localhost ~]# cat random.c
#include <stdlib.h>
#include <stdio.h>

void main(void)
{
         int num,i;
         for (i=0;i<10;i++) {
                 num =random();
                 printf("random num %d\n", num);
         }
}
[root@localhost ~]#

So keep this maybe better.

Best Regards
Yang Xu
> I slightly tend to keep setting the seed by srandom() to get a different
> randomized number for test variety.
>




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [LTP] Broken Fedora build
  2020-10-22  6:22         ` Yang Xu
@ 2020-10-22  6:27           ` Xiao Yang
  0 siblings, 0 replies; 8+ messages in thread
From: Xiao Yang @ 2020-10-22  6:27 UTC (permalink / raw)
  To: ltp

On 2020/10/22 14:22, Yang Xu wrote:
> Hi Li
>> Xiao Yang<yangx.jy@cn.fujitsu.com>  wrote:
>>
>>>>> I prefer to go replace ftime() by gettimeofday() or clock_gettime()
>>>>> way to solve this from root.
>>>> +1
>>>>
>>>> I have seen the hugetlb.c and trace_sched.c code, they all use the
>>>> time to generate a random value for ftok or sched_priority. So using
>>>> gettimeofday() also looks ok.
>>> Hi,
>>>
>>> It is fine for me to replace ftime(), but I wonder if we can remove
>>> fime() and srand()/srandom() directly? :-)
>>> It seems unnecessary to set the seed for random number.
>>
>> That's true, but random() will generate the same number each time.
> Agree. If we don't call srandom, repeatly call random binary will give 
> same  random num. ie
> root@localhost ~]# ./random
> random num 1804289383
> random num 846930886
> random num 1681692777
> random num 1714636915
> random num 1957747793
> random num 424238335
> random num 719885386
> random num 1649760492
> random num 596516649
> random num 1189641421
> [root@localhost ~]# ./random
> random num 1804289383
> random num 846930886
> random num 1681692777
> random num 1714636915
> random num 1957747793
> random num 424238335
> random num 719885386
> random num 1649760492
> random num 596516649
> random num 1189641421
> [root@localhost ~]# cat random.c
> #include <stdlib.h>
> #include <stdio.h>
>
> void main(void)
> {
>         int num,i;
>         for (i=0;i<10;i++) {
>                 num =random();
>                 printf("random num %d\n", num);
>         }
> }
> [root@localhost ~]#
>
> So keep this maybe better.
Hi Li, Yang

Thanks for your replies. It's reasonable for me to keep it. :-)

Best Regards,
Xiao Yang
>
> Best Regards
> Yang Xu
>> I slightly tend to keep setting the seed by srandom() to get a different
>> randomized number for test variety.
>>
>
> .
>




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-10-22  6:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-21 19:35 [LTP] Broken Fedora build Petr Vorel
2020-10-22  2:36 ` Li Wang
2020-10-22  2:44   ` Yang Xu
2020-10-22  5:18     ` Xiao Yang
2020-10-22  5:47       ` Li Wang
2020-10-22  6:22         ` Yang Xu
2020-10-22  6:27           ` Xiao Yang
2020-10-22  6:01   ` Jan Stancek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox