Tiago Gomes pushed to branch tiagogomes/system_tests at BuildStream / buildstream
Commits:
-
4b1c6447
by Tiago Gomes at 2018-08-07T12:37:26Z
-
d98a2e20
by Tiago Gomes at 2018-08-07T12:37:29Z
-
7dd49729
by Tiago Gomes at 2018-08-07T12:37:29Z
-
44f9067f
by Tiago Gomes at 2018-08-07T12:37:29Z
5 changed files:
- .gitlab-ci.yml
- buildstream/_artifactcache/artifactcache.py
- buildstream/_artifactcache/cascache.py
- buildstream/_scheduler/queues/buildqueue.py
- buildstream/utils.py
Changes:
... | ... | @@ -84,6 +84,8 @@ source_dist: |
84 | 84 |
- cd ../..
|
85 | 85 |
- mkdir -p coverage-linux/
|
86 | 86 |
- cp dist/buildstream/.coverage.* coverage-linux/coverage."${CI_JOB_NAME}"
|
87 |
+ except:
|
|
88 |
+ - schedules
|
|
87 | 89 |
artifacts:
|
88 | 90 |
paths:
|
89 | 91 |
- coverage-linux/
|
... | ... | @@ -125,6 +127,8 @@ tests-unix: |
125 | 127 |
- cd ../..
|
126 | 128 |
- mkdir -p coverage-unix/
|
127 | 129 |
- cp dist/buildstream/.coverage.* coverage-unix/coverage.unix
|
130 |
+ except:
|
|
131 |
+ - schedules
|
|
128 | 132 |
artifacts:
|
129 | 133 |
paths:
|
130 | 134 |
- coverage-unix/
|
... | ... | @@ -146,10 +150,53 @@ docs: |
146 | 150 |
- make BST_FORCE_SESSION_REBUILD=1 -C doc
|
147 | 151 |
- cd ../..
|
148 | 152 |
- mv dist/buildstream/doc/build/html public
|
153 |
+ except:
|
|
154 |
+ - schedules
|
|
149 | 155 |
artifacts:
|
150 | 156 |
paths:
|
151 | 157 |
- public/
|
152 | 158 |
|
159 |
+.system-tests: &system-tests-template
|
|
160 |
+ stage: test
|
|
161 |
+ variables:
|
|
162 |
+ XDG_CACHE_HOME: /cache
|
|
163 |
+ bst_ext_url: git+https://gitlab.com/BuildStream/bst-external.git
|
|
164 |
+ bst_ext_ref: 31376f750df713b3613d5348f93100c7e0ef68c0 # 0.3
|
|
165 |
+ fd_sdk_ref: 27cb7575f57e2922331facbd252dc690807c7182 # 18.08
|
|
166 |
+ expected_cache_key: ceee9b5a
|
|
167 |
+ expected_md5sum: 083966a5dc914d52e5245af3a06e933e
|
|
168 |
+ before_script:
|
|
169 |
+ - (cd dist && ./unpack.sh && cd buildstream && pip3 install .)
|
|
170 |
+ - pip3 install --user -e ${bst_ext_url}@${bst_ext_ref}#egg=bst_ext
|
|
171 |
+ - git clone https://gitlab.com/freedesktop-sdk/freedesktop-sdk.git
|
|
172 |
+ - git -C freedesktop-sdk checkout ${fd_sdk_ref}
|
|
173 |
+ #when:
|
|
174 |
+ #- schedules
|
|
175 |
+ |
|
176 |
+system-tests:
|
|
177 |
+ <<: *system-tests-template
|
|
178 |
+ script:
|
|
179 |
+ - make -C freedesktop-sdk
|
|
180 |
+ - pwd
|
|
181 |
+ - cache_key=$(bst -C sdk show all.bst --deps none --format %{key})
|
|
182 |
+ - test ${cache_key} == ${expected_cache_key}
|
|
183 |
+ - bst -C sdk checkout --tar all.bst all.tar
|
|
184 |
+ - checksum=$(md5sum all.tar)
|
|
185 |
+ - test ${checksum} == ${expected_checksum}
|
|
186 |
+ |
|
187 |
+system-tests-no-cache:
|
|
188 |
+ <<: *system-tests-template
|
|
189 |
+ script:
|
|
190 |
+ - sed -i '/artifacts:/,+1 d' freedesktop-sdk/bootstrap/project.conf
|
|
191 |
+ - sed -i '/artifacts:/,+1 d' freedesktop-sdk/project.conf
|
|
192 |
+ - make -C freedesktop-sdk
|
|
193 |
+ - pwd
|
|
194 |
+ - cache_key=$(bst -C sdk show all.bst --deps none --format %{key})
|
|
195 |
+ - test ${cache_key} == ${expected_cache_key}
|
|
196 |
+ - bst -C sdk checkout --tar all.bst all.tar
|
|
197 |
+ - checksum=$(md5sum all.tar)
|
|
198 |
+ - test ${checksum} == ${expected_checksum}
|
|
199 |
+ |
|
153 | 200 |
|
154 | 201 |
#####################################################
|
155 | 202 |
# Post stage #
|
... | ... | @@ -174,6 +221,8 @@ codequality: |
174 | 221 |
--volume "$PWD":/code
|
175 | 222 |
--volume /var/run/docker.sock:/var/run/docker.sock
|
176 | 223 |
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
|
224 |
+ except:
|
|
225 |
+ - schedules
|
|
177 | 226 |
artifacts:
|
178 | 227 |
paths: [codeclimate.json]
|
179 | 228 |
|
... | ... | @@ -199,6 +248,8 @@ analysis: |
199 | 248 |
radon raw -s -j buildstream > analysis/raw.json
|
200 | 249 |
radon raw -s buildstream
|
201 | 250 |
|
251 |
+ except:
|
|
252 |
+ - schedules
|
|
202 | 253 |
artifacts:
|
203 | 254 |
paths:
|
204 | 255 |
- analysis/
|
... | ... | @@ -223,6 +274,8 @@ coverage: |
223 | 274 |
- tests-fedora-27
|
224 | 275 |
- tests-unix
|
225 | 276 |
- source_dist
|
277 |
+ except:
|
|
278 |
+ - schedules
|
|
226 | 279 |
|
227 | 280 |
# Deploy, only for merges which land on master branch.
|
228 | 281 |
#
|
... | ... | @@ -247,3 +300,5 @@ pages: |
247 | 300 |
# See https://gitlab.com/gitlab-org/gitlab-ce/issues/35141
|
248 | 301 |
#
|
249 | 302 |
- master
|
303 |
+ except:
|
|
304 |
+ - schedules
|
... | ... | @@ -276,11 +276,6 @@ class ArtifactCache(): |
276 | 276 |
# (int) An approximation of the artifact cache size.
|
277 | 277 |
#
|
278 | 278 |
def get_approximate_cache_size(self):
|
279 |
- # If we don't currently have an estimate, figure out the real
|
|
280 |
- # cache size.
|
|
281 |
- if self.estimated_size is None:
|
|
282 |
- self.estimated_size = self.calculate_cache_size()
|
|
283 |
- |
|
284 | 279 |
return self.estimated_size
|
285 | 280 |
|
286 | 281 |
################################################
|
... | ... | @@ -534,10 +529,8 @@ class ArtifactCache(): |
534 | 529 |
# ArtifactCache.estimated_size.
|
535 | 530 |
#
|
536 | 531 |
def _add_artifact_size(self, artifact_size):
|
537 |
- if not self.estimated_size:
|
|
538 |
- self.estimated_size = self.calculate_cache_size()
|
|
539 |
- |
|
540 |
- self.estimated_size += artifact_size
|
|
532 |
+ if self.estimated_size:
|
|
533 |
+ self.estimated_size += artifact_size
|
|
541 | 534 |
|
542 | 535 |
# _set_cache_size()
|
543 | 536 |
#
|
... | ... | @@ -56,7 +56,9 @@ class CASCache(ArtifactCache): |
56 | 56 |
super().__init__(context)
|
57 | 57 |
|
58 | 58 |
self.casdir = os.path.join(context.artifactdir, 'cas')
|
59 |
- os.makedirs(os.path.join(self.casdir, 'tmp'), exist_ok=True)
|
|
59 |
+ |
|
60 |
+ self.tmpdir = os.path.join(context.artifactdir, 'tmp')
|
|
61 |
+ os.makedirs(self.tmpdir, exist_ok=True)
|
|
60 | 62 |
|
61 | 63 |
self._enable_push = enable_push
|
62 | 64 |
|
... | ... | @@ -394,7 +396,7 @@ class CASCache(ArtifactCache): |
394 | 396 |
try:
|
395 | 397 |
h = hashlib.sha256()
|
396 | 398 |
# Always write out new file to avoid corruption if input file is modified
|
397 |
- with tempfile.NamedTemporaryFile(dir=os.path.join(self.casdir, 'tmp')) as out:
|
|
399 |
+ with tempfile.NamedTemporaryFile(dir=self.tmpdir) as out:
|
|
398 | 400 |
# Set mode bits to 0644
|
399 | 401 |
os.chmod(out.name, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH)
|
400 | 402 |
|
... | ... | @@ -764,7 +766,7 @@ class CASCache(ArtifactCache): |
764 | 766 |
# already in local cache
|
765 | 767 |
return
|
766 | 768 |
|
767 |
- with tempfile.NamedTemporaryFile(dir=os.path.join(self.casdir, 'tmp')) as out:
|
|
769 |
+ with tempfile.NamedTemporaryFile(dir=self.tmpdir) as out:
|
|
768 | 770 |
self._fetch_blob(remote, tree, out)
|
769 | 771 |
|
770 | 772 |
directory = remote_execution_pb2.Directory()
|
... | ... | @@ -778,7 +780,7 @@ class CASCache(ArtifactCache): |
778 | 780 |
# already in local cache
|
779 | 781 |
continue
|
780 | 782 |
|
781 |
- with tempfile.NamedTemporaryFile(dir=os.path.join(self.casdir, 'tmp')) as f:
|
|
783 |
+ with tempfile.NamedTemporaryFile(dir=self.tmpdir) as f:
|
|
782 | 784 |
self._fetch_blob(remote, filenode.digest, f)
|
783 | 785 |
|
784 | 786 |
digest = self.add_object(path=f.name)
|
1 | 1 |
#
|
2 |
-# Copyright (C) 2016 Codethink Limited
|
|
2 |
+# Copyright (C) 2018 Codethink Limited
|
|
3 | 3 |
#
|
4 | 4 |
# This program is free software; you can redistribute it and/or
|
5 | 5 |
# modify it under the terms of the GNU Lesser General Public
|
... | ... | @@ -56,13 +56,16 @@ class BuildQueue(Queue): |
56 | 56 |
return
|
57 | 57 |
|
58 | 58 |
artifact_size = job.child_data.get('artifact_size', False)
|
59 |
+ if not artifact_size:
|
|
60 |
+ return
|
|
59 | 61 |
|
60 |
- if artifact_size:
|
|
61 |
- cache = element._get_artifact_cache()
|
|
62 |
- cache._add_artifact_size(artifact_size)
|
|
62 |
+ cache = element._get_artifact_cache()
|
|
63 |
+ cache._add_artifact_size(artifact_size)
|
|
63 | 64 |
|
64 |
- if cache.get_approximate_cache_size() > self._scheduler.context.cache_quota:
|
|
65 |
- self._scheduler._check_cache_size_real()
|
|
65 |
+ approx_size = cache.get_approximate_cache_size()
|
|
66 |
+ if not approx_size or (approx_size >
|
|
67 |
+ self._scheduler.context.cache_quota):
|
|
68 |
+ self._scheduler._check_cache_size_real()
|
|
66 | 69 |
|
67 | 70 |
def done(self, job, element, result, success):
|
68 | 71 |
|
... | ... | @@ -827,6 +827,12 @@ def _process_list(srcdir, destdir, filelist, actionfunc, result, |
827 | 827 |
os.mknod(destpath, file_stat.st_mode, file_stat.st_rdev)
|
828 | 828 |
os.chmod(destpath, file_stat.st_mode)
|
829 | 829 |
|
830 |
+ elif stat.S_ISFIFO(mode):
|
|
831 |
+ os.mkfifo(destpath, mode)
|
|
832 |
+ |
|
833 |
+ elif stat.S_ISSOCK(mode):
|
|
834 |
+ pass
|
|
835 |
+ |
|
830 | 836 |
else:
|
831 | 837 |
# Unsupported type.
|
832 | 838 |
raise UtilError('Cannot extract {} into staging-area. Unsupported type.'.format(srcpath))
|