diff mbox series

[4/5] travis.yml: Fix the ccache lines

Message ID 20191009170701.14756-5-thuth@redhat.com (mailing list archive)
State New, archived
Headers show
Series travis.yml improvements: Update libraries, build with arm64 | expand

Commit Message

Thomas Huth Oct. 9, 2019, 5:07 p.m. UTC
The "command -v ccache && ccache ..." likely were supposed to test
the availability of ccache before running the program. But this
shell construct causes Travis to abort if ccache is not available.
Use an if-statement instead to fix this problem.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 .travis.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Philippe Mathieu-Daudé Oct. 9, 2019, 7:04 p.m. UTC | #1
On 10/9/19 7:07 PM, Thomas Huth wrote:
> The "command -v ccache && ccache ..." likely were supposed to test
> the availability of ccache before running the program. But this
> shell construct causes Travis to abort if ccache is not available.

Oops.

Why can't you install ccache if these are Ubuntu systems?
It is even more wanted if the arm64 machine are slow...

> Use an if-statement instead to fix this problem.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   .travis.yml | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/.travis.yml b/.travis.yml
> index 616e59867a..0c88e8757b 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -91,13 +91,13 @@ git:
>   
>   before_script:
>     - if [ "$TRAVIS_OS_NAME" == "osx" ] ; then export PATH="/usr/local/opt/ccache/libexec:$PATH" ; fi
> -  - command -v ccache && ccache --zero-stats
> +  - if command -v ccache ; then ccache --zero-stats ; fi
>     - mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR}
>     - ${SRC_DIR}/configure ${BASE_CONFIG} ${CONFIG} || { cat config.log && exit 1; }
>   script:
>     - make -j3 && travis_retry ${TEST_CMD}
>   after_script:
> -  - command -v ccache && ccache --show-stats
> +  - if command -v ccache ; then ccache --show-stats ; fi
>   
>   
>   matrix:
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Thomas Huth Oct. 10, 2019, 9:38 a.m. UTC | #2
On 09/10/2019 21.04, Philippe Mathieu-Daudé wrote:
> On 10/9/19 7:07 PM, Thomas Huth wrote:
>> The "command -v ccache && ccache ..." likely were supposed to test
>> the availability of ccache before running the program. But this
>> shell construct causes Travis to abort if ccache is not available.
> 
> Oops.
> 
> Why can't you install ccache if these are Ubuntu systems?
> It is even more wanted if the arm64 machine are slow...

I just tried to add "ccache" to the list of packages that should be
installed, but I don't see a difference in the runtime.

First run with ccache enabled:

 https://travis-ci.com/huth/qemu/jobs/244117945

Second run where I'd expect a speedup:

 https://travis-ci.com/huth/qemu/jobs/244124599

The statistics at the end say that it had only 1 cache hit. Any ideas
what might be wrong here?

 Thomas
Philippe Mathieu-Daudé Oct. 10, 2019, 11:16 a.m. UTC | #3
On 10/10/19 11:38 AM, Thomas Huth wrote:
> On 09/10/2019 21.04, Philippe Mathieu-Daudé wrote:
>> On 10/9/19 7:07 PM, Thomas Huth wrote:
>>> The "command -v ccache && ccache ..." likely were supposed to test
>>> the availability of ccache before running the program. But this
>>> shell construct causes Travis to abort if ccache is not available.
>>
>> Oops.
>>
>> Why can't you install ccache if these are Ubuntu systems?
>> It is even more wanted if the arm64 machine are slow...
> 
> I just tried to add "ccache" to the list of packages that should be
> installed, but I don't see a difference in the runtime.
> 
> First run with ccache enabled:
> 
>   https://travis-ci.com/huth/qemu/jobs/244117945
> 
> Second run where I'd expect a speedup:
> 
>   https://travis-ci.com/huth/qemu/jobs/244124599
> 
> The statistics at the end say that it had only 1 cache hit. Any ideas
> what might be wrong here?

Looking there and your following commit 
(https://github.com/huth/qemu/commit/eaf80e7851) I see you already 
figured this out :)
Thomas Huth Oct. 10, 2019, 11:29 a.m. UTC | #4
On 10/10/2019 13.16, Philippe Mathieu-Daudé wrote:
> On 10/10/19 11:38 AM, Thomas Huth wrote:
>> On 09/10/2019 21.04, Philippe Mathieu-Daudé wrote:
>>> On 10/9/19 7:07 PM, Thomas Huth wrote:
>>>> The "command -v ccache && ccache ..." likely were supposed to test
>>>> the availability of ccache before running the program. But this
>>>> shell construct causes Travis to abort if ccache is not available.
>>>
>>> Oops.
>>>
>>> Why can't you install ccache if these are Ubuntu systems?
>>> It is even more wanted if the arm64 machine are slow...
>>
>> I just tried to add "ccache" to the list of packages that should be
>> installed, but I don't see a difference in the runtime.
>>
>> First run with ccache enabled:
>>
>>   https://travis-ci.com/huth/qemu/jobs/244117945
>>
>> Second run where I'd expect a speedup:
>>
>>   https://travis-ci.com/huth/qemu/jobs/244124599
>>
>> The statistics at the end say that it had only 1 cache hit. Any ideas
>> what might be wrong here?
> 
> Looking there and your following commit
> (https://github.com/huth/qemu/commit/eaf80e7851) I see you already
> figured this out :)

No, that was just a try, but it did not change anything:

 https://travis-ci.com/huth/qemu/jobs/244137697#L5813

But I also noticed that in the arm64 builds, the cache information is
missing:

 https://travis-ci.com/huth/qemu/jobs/244137697#L1844

... so I assume that ccache support needs to be supported in the image
that is provided by Travis, and you can not simply install it
afterwards. So this is likely just a quirk that hopefully will be fixed
by Travis later (arm64 is still marked as "alpha" there if I've got that
right).

 Thomas
Philippe Mathieu-Daudé Oct. 10, 2019, 11:51 a.m. UTC | #5
On 10/10/19 1:29 PM, Thomas Huth wrote:
> On 10/10/2019 13.16, Philippe Mathieu-Daudé wrote:
>> On 10/10/19 11:38 AM, Thomas Huth wrote:
>>> On 09/10/2019 21.04, Philippe Mathieu-Daudé wrote:
>>>> On 10/9/19 7:07 PM, Thomas Huth wrote:
>>>>> The "command -v ccache && ccache ..." likely were supposed to test
>>>>> the availability of ccache before running the program. But this
>>>>> shell construct causes Travis to abort if ccache is not available.
>>>>
>>>> Oops.
>>>>
>>>> Why can't you install ccache if these are Ubuntu systems?
>>>> It is even more wanted if the arm64 machine are slow...
>>>
>>> I just tried to add "ccache" to the list of packages that should be
>>> installed, but I don't see a difference in the runtime.
>>>
>>> First run with ccache enabled:
>>>
>>>    https://travis-ci.com/huth/qemu/jobs/244117945
>>>
>>> Second run where I'd expect a speedup:
>>>
>>>    https://travis-ci.com/huth/qemu/jobs/244124599
>>>
>>> The statistics at the end say that it had only 1 cache hit. Any ideas
>>> what might be wrong here?
>>
>> Looking there and your following commit
>> (https://github.com/huth/qemu/commit/eaf80e7851) I see you already
>> figured this out :)
> 
> No, that was just a try, but it did not change anything:
> 
>   https://travis-ci.com/huth/qemu/jobs/244137697#L5813

Oh I checked the x86 build then...

https://travis-ci.com/huth/qemu/jobs/244137696#L11299

> But I also noticed that in the arm64 builds, the cache information is
> missing:
> 
>   https://travis-ci.com/huth/qemu/jobs/244137697#L1844
> 
> ... so I assume that ccache support needs to be supported in the image
> that is provided by Travis, and you can not simply install it
> afterwards. So this is likely just a quirk that hopefully will be fixed
> by Travis later (arm64 is still marked as "alpha" there if I've got that
> right).

Ah, you might be correct.

If so, your job is now ready to use the feature once they enable it :)
diff mbox series

Patch

diff --git a/.travis.yml b/.travis.yml
index 616e59867a..0c88e8757b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -91,13 +91,13 @@  git:
 
 before_script:
   - if [ "$TRAVIS_OS_NAME" == "osx" ] ; then export PATH="/usr/local/opt/ccache/libexec:$PATH" ; fi
-  - command -v ccache && ccache --zero-stats
+  - if command -v ccache ; then ccache --zero-stats ; fi
   - mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR}
   - ${SRC_DIR}/configure ${BASE_CONFIG} ${CONFIG} || { cat config.log && exit 1; }
 script:
   - make -j3 && travis_retry ${TEST_CMD}
 after_script:
-  - command -v ccache && ccache --show-stats
+  - if command -v ccache ; then ccache --show-stats ; fi
 
 
 matrix: