Merge lp:~fginther/ubuntu-test-cases/remove-source-package into lp:ubuntu-test-cases/touch

Proposed by Francis Ginther
Status: Merged
Approved by: Francis Ginther
Approved revision: 399
Merged at revision: 401
Proposed branch: lp:~fginther/ubuntu-test-cases/remove-source-package
Merge into: lp:ubuntu-test-cases/touch
Diff against target: 128 lines (+18/-32)
5 files modified
scripts/boottest.sh (+12/-23)
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:~fginther/ubuntu-test-cases/remove-source-package
Reviewer Review Type Date Requested Status
Paul Larson Approve
Evan Pending
Review via email: mp+260854@code.launchpad.net

This proposal supersedes a proposal from 2015-05-29.

Description of the change

I'm hijacking laney's MP as another change was identified through testing (this was to remove the need for the boottest.py wrapper to have the package source).

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.
  - The boottest.py wrapper does not need the source package at all, it just needs to inject the list of to-install-binary packages generated by getinstalledpkgs into the boottest dep8 control file

Tested with oxide-qt here:
- http://d-jenkins.ubuntu-ci:8080/view/Wily/view/BootTest/job/fjg-boottest/24/

To post a comment you must log in.
Revision history for this message
Evan (ev) wrote : Posted in a previous version of this proposal

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

review: Needs Information
Revision history for this message
Evan (ev) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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> ]

Revision history for this message
Iain Lane (laney) wrote : Posted in a previous version of this proposal

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> ]

Revision history for this message
Francis Ginther (fginther) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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.

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

I've resubmitted this MP after removing the need for boottest.sh to have the source package. Now it just executes the boottest script, modifying the list of binary packages in place.

Revision history for this message
Paul Larson (pwlars) wrote :

I've tried this locally and got it to pass on the first try with using ca-certificates as a test package. It still doesn't properly update the package, but I know that's coming in another one. I think it's at least as good as what we have right now and doesn't seem to cause new problems, so I'm +1

review: Approve

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-02 16:14:14 +0000
@@ -58,7 +58,7 @@
58 fi58 fi
5959
60 # Ensure we leave a usable phone60 # Ensure we leave a usable phone
61 [ -z ${NODE_NAME} ] || test-runner/scripts/recover.py ${NODE_NAME}61 [ -z ${NODE_NAME} ] || ${BASEDIR}/scripts/recover.py ${NODE_NAME}
6262
63 # Leave a parting message63 # Leave a parting message
64 # (disable command tracing as it confuses the output)64 # (disable command tracing as it confuses the output)
@@ -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
@@ -167,7 +167,7 @@
167 echo "$RELEASE $ARCH $SRC_PKG_NAME" > $errfile167 echo "$RELEASE $ARCH $SRC_PKG_NAME" > $errfile
168 [ -f "$errfile" ] && ${RSYNC} -a $errfile $RSYNC_DEST/${RELEASE}/tmp/ || true168 [ -f "$errfile" ] && ${RSYNC} -a $errfile $RSYNC_DEST/${RELEASE}/tmp/ || true
169 # Ensure we leave a usable phone169 # Ensure we leave a usable phone
170 [ -z ${NODE_NAME} ] || test-runner/scripts/recover.py ${NODE_NAME}170 [ -z ${NODE_NAME} ] || ${BASEDIR}/scripts/recover.py ${NODE_NAME}
171171
172 exit $RET172 exit $RET
173fi173fi
@@ -179,27 +179,16 @@
179 RET=$?179 RET=$?
180 set -e180 set -e
181else181else
182 SOURCE_DIR=$(ls -d ${PKG_SRC_DIR}/artifacts/${SRC_PKG_NAME}-*/debian)182 FROM=${TESTS}/boottest/debian/tests/control.template
183 # Get the debian dir from the source package (involving the whole183 TARGET=${TESTS}/boottest/debian/tests/control
184 # source tree can fail with 'No space left on device' on the phone).184
185 TARGET_BASE=work
186 rm -fr ${TARGET_BASE}
187 mkdir -p ${TARGET_BASE}
188 cp -rd ${SOURCE_DIR} ${TARGET_BASE}
189 # Inject the boot DEP8 test into the debian dir from the package
190 # source tree
191 FROM=${TESTS}/boottest/debian/tests
192 TARGET="${TARGET_BASE}/debian/tests"
193 mkdir -p ${TARGET} # For packages that don't define DEP8 tests
194 # Inject the binary packages built previously185 # Inject the binary packages built previously
195 BIN_PACKAGES=$(tr '\n' ',' < ${PKG_SRC_DIR}/artifacts/needs_install.packages | sed -e s/,$//)186 BIN_PACKAGES=$(tr '\n' ',' < ${PKG_SRC_DIR}/artifacts/needs_install.packages | sed -e s/,$//)
196 sed -e "s/{{ bin_packages }}/${BIN_PACKAGES}/" \187 sed -e "s/{{ bin_packages }}/${BIN_PACKAGES}/" ${FROM} > ${TARGET}
197 ${FROM}/control.template > ${TARGET}/control
198 cp ${FROM}/boottest ${TARGET}
199188
200 # Now execute the boot test from inside the (reduced) pkg source tree189 # Now execute the boot test
201 set +e190 set +e
202 ${ADT_CMD} --unbuilt-tree ${TARGET_BASE} -o results ${ADT_OPTS}191 ${ADT_CMD} --unbuilt-tree ${TESTS}/boottest -o results ${ADT_OPTS}
203 RET=$?192 RET=$?
204 set -e193 set -e
205fi194fi
206195
=== 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-02 16:14:14 +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-02 16:14:14 +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-02 16:14:14 +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-02 16:14:14 +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