Merge lp:~laney/ubuntu-test-cases/touch-boottest-no-download-orig into lp:ubuntu-test-cases/touch

Proposed by Iain Lane
Status: Superseded
Proposed branch: lp:~laney/ubuntu-test-cases/touch-boottest-no-download-orig
Merge into: lp:ubuntu-test-cases/touch
Diff against target: 110 lines (+30/-17)
5 files modified
scripts/boottest.sh (+24/-8)
tests/getinstalledpkgs/debian/changelog (+1/-1)
tests/getinstalledpkgs/debian/control (+2/-2)
tests/getinstalledpkgs/debian/tests/control (+2/-2)
tests/getinstalledpkgs/debian/tests/getinstalledpkgs.template (+1/-4)
To merge this branch: bzr merge lp:~laney/ubuntu-test-cases/touch-boottest-no-download-orig
Reviewer Review Type Date Requested Status
Evan (community) Needs Information
Review via email: mp+260584@code.launchpad.net

This proposal has been superseded by a proposal from 2015-06-02.

Description of the change

oxide-qt's boottest fails. psivaa says this is because getpkgsrc can't download the source package due to the device not having enough space.

Looking at the test script it seems as if the whole orig isn't needed - you only want the debian/ part to run the tests, and in "getpkgsrc" itself (outputs the binary packages from a source that are already installed) you can get the necessary information from apt's database directly without needing any part of the source.

We can refactor both parts

  - Make getpkgsrc use grep-aptavail from dctrl-tools to do the source to binary mapping. Then it isn't getting the source any more, so I rename it to getinstalledpkgs.
  - Use apt-get source --diff-only in the test runner to download the debian directory.

I can't test this, but if someone can and it works then it should be good to land in this state as a drop in replacement.

(I previously said something about getpkgsrc being unnecessary but now I see that it is used later on, so disregard that)

To post a comment you must log in.
396. By Iain Lane

Rename in tests/getinstalledpkgs/debian/tests/control too

Revision history for this message
Evan (ev) wrote :

I'm not convinced --diff-only will work here.

review: Needs Information
Revision history for this message
Evan (ev) wrote :

Having getpkgsrc use grep-aptavail works. This block is here to calculate the binary packages generated by the source package under test so that they can be fed in as test dependencies of the DEP8 boot test.

Revision history for this message
Iain Lane (laney) wrote :

On Fri, May 29, 2015 at 05:42:37PM -0000, Evan Dandrea wrote:
> Isn't this going to fail for native packages? Also, ${SRC_PKG_NAME} :)

Yes. Good catch (on both). Can you think of any other case? Otherwise,
we could try --diff-only and if this doesn't download any files then do
it again without.

--
Iain Lane [ <email address hidden> ]
Debian Developer [ <email address hidden> ]
Ubuntu Developer [ <email address hidden> ]

397. By Iain Lane

Make package extraction work with native packages and format 1.0 packages

Revision history for this message
Iain Lane (laney) wrote :

On Sat, May 30, 2015 at 05:51:21PM -0000, Iain Lane wrote:
> On Fri, May 29, 2015 at 05:42:37PM -0000, Evan Dandrea wrote:
> > Isn't this going to fail for native packages? Also, ${SRC_PKG_NAME} :)
>
> Yes. Good catch (on both). Can you think of any other case? Otherwise,
> we could try --diff-only and if this doesn't download any files then do
> it again without.

Pushed something like that, with fixes for other source formats too.
Could you re-review?

--
Iain Lane [ <email address hidden> ]
Debian Developer [ <email address hidden> ]
Ubuntu Developer [ <email address hidden> ]

398. By Iain Lane

Exclude debian at any level

Revision history for this message
Francis Ginther (fginther) wrote :

I'm currently testing this and will have some more input later. Right now, I don't see any reason why the code that runs on the host system needs to change. The fix to stop downloading the entire source package in getinstalledpkgs should be all that is needed.

Revision history for this message
Iain Lane (laney) wrote :

On Mon, Jun 01, 2015 at 03:23:35PM -0000, Francis Ginther wrote:
> I'm currently testing this and will have some more input later. Right now, I don't see any reason why the code that runs on the host system needs to change. The fix to stop downloading the entire source package in getinstalledpkgs should be all that is needed.

I thought that adt copies the source tree over to the target system.

If it doesn't, then that is right and this becomes just a space
optimisation so we can drop it if you want.

(Actually, I don't see why the package under test's debian/ directory is
needed at all at this step - it seems to me like it could just be a
skeleton whose debian/tests/control we generate from
needs_install.packages. But I didn't know for sure so went for this
route.

Actually², I don't get the reason why we generate this list at all.
Surely the boottest infrastructure has the list of packages it cares
about because it needs to know which packages to trigger a boottest for
in the first place and this script could consult a mapping into that
list directly.

Those are asides that don't need to block this review.)

p.s. still couldn't test it so it might break in some boneheaded way;
feel free to fix up directly and then merge yourself if it's easier once
you see what's wrong

--
Iain Lane [ <email address hidden> ]
Debian Developer [ <email address hidden> ]
Ubuntu Developer [ <email address hidden> ]

Revision history for this message
Francis Ginther (fginther) wrote :

Thanks for the response. Looking at this deeper, I have to agree with you. This section of code appears to be doing more then it needs to. The boottest is setup using the dep8 format, but it is completely independent of any dep8 test that the source package under test may have defined, but this separation appears to be confused.

From my testing so far, the changes to tests/getinstalledpkgs/* are doing the right thing. If This is the case for a few more test cases. I'll pull this set of changes as you suggest and at least fix the issue caused by large source packages.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'scripts/boottest.sh'
--- scripts/boottest.sh 2015-03-16 16:20:32 +0000
+++ scripts/boottest.sh 2015-06-01 11:23:15 +0000
@@ -146,16 +146,16 @@
146 --- ${ADT_VIRT}"146 --- ${ADT_VIRT}"
147147
148148
149# Inject the package name into getpkgsrc DEP8 test149# Inject the package name into getinstalledpkgs DEP8 test
150FROM=${TESTS}/getpkgsrc/debian/tests/getpkgsrc.template150FROM=${TESTS}/getinstalledpkgs/debian/tests/getinstalledpkgs.template
151TARGET=${TESTS}/getpkgsrc/debian/tests/getpkgsrc151TARGET=${TESTS}/getinstalledpkgs/debian/tests/getinstalledpkgs
152sed -e "s/{{ source_package }}/${SRC_PKG_NAME}/" ${FROM} > ${TARGET}152sed -e "s/{{ source_package }}/${SRC_PKG_NAME}/" ${FROM} > ${TARGET}
153153
154# Execute a first test to get the package source tree from the testbed.154# Execute a first test to get the package source tree from the testbed.
155PKG_SRC_DIR=pkgsrc155PKG_SRC_DIR=pkgsrc
156rm -fr ${PKG_SRC_DIR} || true156rm -fr ${PKG_SRC_DIR} || true
157set +e157set +e
158${ADT_CMD} --unbuilt-tree ${TESTS}/getpkgsrc -o ${PKG_SRC_DIR} ${ADT_OPTS}158${ADT_CMD} --unbuilt-tree ${TESTS}/getinstalledpkgs -o ${PKG_SRC_DIR} ${ADT_OPTS}
159RET=$?159RET=$?
160set -e160set -e
161161
@@ -179,13 +179,29 @@
179 RET=$?179 RET=$?
180 set -e180 set -e
181else181else
182 SOURCE_DIR=$(ls -d ${PKG_SRC_DIR}/artifacts/${SRC_PKG_NAME}-*/debian)182 # Get the debian dir *only* from the archive. orig tarballs can be too
183 # Get the debian dir from the source package (involving the whole183 # big for the target system.
184 # source tree can fail with 'No space left on device' on the phone).
185 TARGET_BASE=work184 TARGET_BASE=work
186 rm -fr ${TARGET_BASE}185 rm -fr ${TARGET_BASE}
187 mkdir -p ${TARGET_BASE}186 mkdir -p ${TARGET_BASE}
188 cp -rd ${SOURCE_DIR} ${TARGET_BASE}187 apt-get source --diff-only ${SRC_PKG_NAME}
188
189 shopt -s nullglob
190 allfiles=(*)
191
192 # If this is a 3.0 (native) package then that wouldn't have downloaded
193 # anything, so try the whole thing.
194 if [ ${#allfiles[@]} -eq 0 ]; then
195 apt-get source --tar-only ${SRC_PKG_NAME}
196 # Extract debian/ but not */debian/
197 tar --strip-components=1 --no-anchored --exclude "*/**/debian" --extract --file * "debian"
198 elif [ ! -z *.diff.gz ]; then # this is a source format 1.0 package
199 zcat * | patch -p1
200 else # 3.0 (quilt)
201 tar xf *
202 fi
203 shopt -u nullglob
204
189 # Inject the boot DEP8 test into the debian dir from the package205 # Inject the boot DEP8 test into the debian dir from the package
190 # source tree206 # source tree
191 FROM=${TESTS}/boottest/debian/tests207 FROM=${TESTS}/boottest/debian/tests
192208
=== renamed directory 'tests/getpkgsrc' => 'tests/getinstalledpkgs'
=== modified file 'tests/getinstalledpkgs/debian/changelog'
--- tests/getpkgsrc/debian/changelog 2015-01-24 21:31:54 +0000
+++ tests/getinstalledpkgs/debian/changelog 2015-06-01 11:23:15 +0000
@@ -1,4 +1,4 @@
1getpkgsrc (0.1) vivid; urgency=medium1getinstalledpkgs (0.1) vivid; urgency=medium
22
3 * Initial release.3 * Initial release.
44
55
=== modified file 'tests/getinstalledpkgs/debian/control'
--- tests/getpkgsrc/debian/control 2015-01-24 21:31:54 +0000
+++ tests/getinstalledpkgs/debian/control 2015-06-01 11:23:15 +0000
@@ -1,9 +1,9 @@
1Source: getpkgsrc1Source: getinstalledpkgs
2Section: misc2Section: misc
3Maintainer: Canonical CI Engineering <canonical-ci-engineering@lists.launchpad.net>3Maintainer: Canonical CI Engineering <canonical-ci-engineering@lists.launchpad.net>
4Build-Depends: debhelper (>= 9),4Build-Depends: debhelper (>= 9),
5Standards-Version: 3.9.45Standards-Version: 3.9.4
66
7Package: getpkgsrc7Package: getinstalledpkgs
8Architecture: all8Architecture: all
9Description: A dep8 test providing a package source from inside the testbed.9Description: A dep8 test providing a package source from inside the testbed.
1010
=== modified file 'tests/getinstalledpkgs/debian/tests/control'
--- tests/getpkgsrc/debian/tests/control 2015-01-24 21:31:54 +0000
+++ tests/getinstalledpkgs/debian/tests/control 2015-06-01 11:23:15 +0000
@@ -1,2 +1,2 @@
1Tests: getpkgsrc1Tests: getinstalledpkgs
2Depends: dpkg-dev2Depends: dpkg-dev, dctrl-tools
33
=== renamed file 'tests/getpkgsrc/debian/tests/getpkgsrc.template' => 'tests/getinstalledpkgs/debian/tests/getinstalledpkgs.template'
--- tests/getpkgsrc/debian/tests/getpkgsrc.template 2015-01-28 14:30:28 +0000
+++ tests/getinstalledpkgs/debian/tests/getinstalledpkgs.template 2015-06-01 11:23:15 +0000
@@ -4,10 +4,7 @@
4cd ${ADT_ARTIFACTS}4cd ${ADT_ARTIFACTS}
5# List installed packages, removing the ':{arch}' suffix5# List installed packages, removing the ':{arch}' suffix
6dpkg-query -f '${binary:Package}\n' -W | sed -e 's/:.*$//' > installed.packages6dpkg-query -f '${binary:Package}\n' -W | sed -e 's/:.*$//' > installed.packages
7# adt-run complains and fails the test if sdterr is not empty
8# redirect stderr to preserve the output for reference
9apt-get source {{ source_package }} 2> apt-get-source.stderr
10# Get the defined binary packages7# Get the defined binary packages
11grep ^Package: {{ source_package }}*/debian/control | sed -e 's/^Package: //' | sort > binary.packages8grep-aptavail -X -n -S -sPackage {{ source_package }} | sort | uniq > binary.packages
12# Get the binary packages already installed9# Get the binary packages already installed
13comm -1 -2 binary.packages installed.packages > needs_install.packages10comm -1 -2 binary.packages installed.packages > needs_install.packages

Subscribers

People subscribed via source and target branches