Skip to content

Improve the Travis build matrix, add Docker - #245

Closed
afbjorklund wants to merge 10 commits into
ccache:3.4-maintfrom
afbjorklund:travis
Closed

afbjorklund wants to merge 10 commits into
ccache:3.4-maintfrom
afbjorklund:travis

Conversation

@afbjorklund

Copy link
Copy Markdown
Contributor

Run in containers where possible, save the installations for the
targets that actually need to do them (currently: mingw and cuda)

@afbjorklund

afbjorklund commented Apr 1, 2018 •

Copy link
Copy Markdown
Contributor Author

The startup time isn't the main issue (1 second vs. 25 seconds), but the added complexity.
Keep the basic package list to a minimum, and then add the rest when they are required ?

Will improve the docker target, so that one can run a quick travis-compatible test for gcc/clang.
The actual container used by Travis is an enormous 4G (8G unpacked), so let's not use that...

@afbjorklund
afbjorklund force-pushed the travis branch 2 times, most recently from 804fecc to 4b39ecf Compare April 1, 2018 12:00
@afbjorklund

afbjorklund commented Apr 1, 2018 •

Copy link
Copy Markdown
Contributor Author

Now it should be possible to test locally, also fixed the w64-mingw32 and clang-3.4 targets

make travis

The default test will run CC=gcc, but you can set CC/CFLAGS/ASAN_OPTIONS/HOST/TEST

FROM ubuntu:trusty

REPOSITORY                            TAG                 IMAGE ID            CREATED             SIZE
travis-build                          latest              784309e0d90d        45 minutes ago      650MB
ubuntu                                trusty              dc4491992653        2 months ago        222MB

@afbjorklund afbjorklund changed the title Improve the Travis build matrix Improve the Travis build matrix, add Docker Apr 1, 2018
@afbjorklund

Copy link
Copy Markdown
Contributor Author

@jrosdahl : what do you think ? (3 bugs, 3 features - but all connected/dependent)

@afbjorklund

Copy link
Copy Markdown
Contributor Author

Probably should upgrade clang to version 5.0.0, from http://apt.llvm.org/ ?
Made it work with the ubuntu "trusty" system default (of 3.4), meanwhile...

deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-5.0 main
deb-src http://apt.llvm.org/trusty/ llvm-toolchain-trusty-5.0 main

@afbjorklund

Copy link
Copy Markdown
Contributor Author

The docker image uses dumb-init, so that Ctrl-C still works...

The other packages are either from Ubuntu or from LLVM.

You can find a pre-built image at: afbjorklund/travis-build

REPOSITORY                            TAG                 IMAGE ID            CREATED             SIZE
afbjorklund/ubuntu                    trusty              dc4491992653        2 months ago        222MB
afbjorklund/travis-build              latest              4e8898b1afc3        About an hour ago   823MB

You can use this image, if you don't want to build it yourself.

$ docker pull afbjorklund/travis-build
$ docker tag afbjorklund/travis-build travis-build

@afbjorklund
afbjorklund force-pushed the travis branch 3 times, most recently from bdb5683 to 239b102 Compare April 8, 2018 14:01

@jrosdahl jrosdahl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Awesome, thanks!

Just two minor things:

Comment thread .travis/Dockerfile Outdated
FROM ubuntu:trusty

# https://github.com/Yelp/dumb-init
COPY dumb-init_*.deb .

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm allergic to binaries in source control (and furry animals and pollen). How about using docker run --init ... instead? Do you see any downside with that other than that it requires Docker 1.13.0 or newer?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We can copy it from the URL, no worries. Just that I didn't have any wget/curl inside of it...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sure, that would be fine as well. (But why when run --init exists? 🙂)

Comment thread src/cleanup.c Outdated

// Clean the cache.
#ifdef _WIN32
cc_log("Before cleanup: %lu KiB, %I64u files",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would prefer casting to unsigned long instead of introducing ifdefs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will it fit ? I suppose we could cast it to float (without decimals) or something, for simplicity

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Doesn't really matter since it's just a debug log message, I'd say. Also, it's extremely unlikely that somebody has a cache with more than 232 files.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Casting to float means that it will be incorrect after 224 + 1 = 16,777,217 files, which a large cache might contain.

@jrosdahl jrosdahl added the issue: feature New feature label Apr 17, 2018
@jrosdahl jrosdahl added this to the 3.5 milestone Apr 17, 2018
@afbjorklund

Copy link
Copy Markdown
Contributor Author

@jrosdahl : also, should this be rebased against 3.4-maint perhaps ? and merged to master

@jrosdahl

Copy link
Copy Markdown
Member

@jrosdahl : also, should this be rebased against 3.4-maint perhaps ? and merged to master

Sounds like a good idea.

@jrosdahl jrosdahl modified the milestones: 3.5, 3.4.3 Apr 17, 2018
@afbjorklund

Copy link
Copy Markdown
Contributor Author

Ah, looks like the PR contains the branch - not sure how to change that

@jrosdahl

Copy link
Copy Markdown
Member

@afbjorklund

Copy link
Copy Markdown
Contributor Author

Ah, that sounds easy enough! :-)

Seems like MinGW doesn't have the %z (size_t) printf format
So add some %f casting variant, so that it works everywhere.
Run in containers where possible, save the installations for the
targets that actually need to do them (currently: mingw and cuda)
Seems like old clang-3.4 didn't have this feature, while the
newer MinGW might. So remove the hardcoding, and do the check.
This is not the actual Travis docker container, but it
should be similar enough for doing local verification:

make travis
make travis CC=clang
make travis CC=clang CFLAGS="-fsanitize=address -g" ASAN_OPTIONS="detect_leaks=0"
make travis CC=i686-w64-mingw32-gcc HOST="--host=i686-w64-mingw32" TEST="unittest/run.exe"
The idea behind this script is to run the same checks as .travis.yml
but locally instead. It is not identical, but should be close enough.

Note: this does not include any tests for the osx or cuda platforms,
only the linux targets - although that does include the mingw build.
We were getting different results when converting "float" to
integers, on 32-bit versus 64-bit platforms. So use "roundf".

Also exposed a typo in another testsuite, where we only cleaned
files as a result of roundoff... Make cleaning explicit again.
Use gcc-multilib rather than doing a full cross-compile.
But set the --host, just in case something is listening.
@afbjorklund
afbjorklund changed the base branch from master to 3.4-maint April 18, 2018 17:50
@afbjorklund

afbjorklund commented Apr 18, 2018 •

Copy link
Copy Markdown
Contributor Author

Ah, too good to be true...

Rebased manually instead.

@jrosdahl

Copy link
Copy Markdown
Member

71b1204's message says

Convert float config to double, add rounding

but as far as I can tell it's not converting anything to double. Was that something you intended to do?

I'm happy with all changes now except that I think that it would be better to stay in integer land in the above mentioned patch. (Not sure if you saw my previous review comments since you didn't comment on them?) Or at least use doubles instead of floats.

@afbjorklund

Copy link
Copy Markdown
Contributor Author

I used "double" (64) at first, but then discovered that ccache was using "float" (32) for everything

@afbjorklund

Copy link
Copy Markdown
Contributor Author

Going over to floating point, escaped all the various casts and missing types and sprintfs

@jrosdahl

Copy link
Copy Markdown
Member

I used "double" (64) at first, but then discovered that ccache was using "float" (32) for everything

Right, the calculations in question are coerced to float, which is more unintentional than not. I'll make something up.

Applied now, thanks!

@jrosdahl jrosdahl closed this Apr 23, 2018
@afbjorklund
afbjorklund deleted the travis branch April 24, 2018 19:16
@jrosdahl jrosdahl mentioned this pull request Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

issue: feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants