Skip to contentSkip to conversation

Add a weekly coverity flight

PATCH In review Ian Campbell 3 participants 4 messages Dec 15, 2015 – Jan 5, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add a weekly coverity flight

This primarily consists of ts-coverity-scan and make-coverity-flight which constructs the sole job.

The most recently scanned revision is pushed to a new coverity-scanned branch in the usual xen.git, tests are run on the master branch.

Move collectversions into Osstest::BuildSupport rather than duplicating with ts-xen-build (nothing else is really duplicated)

For the cr-* integration we treat branch=coverity as a special case of tree=xen. I didn't think tree=coverity made much sense, and would probably reach tendrils into lots of other places (such as the invocations of check_tested).

TODO: How to pick $c{CoverityEmail}, needs to be a real email which is in coverity project (which [email protected] used here is not)

At the moment actually uploading is not implemented and is gated via a runvar which is currently set to false. Therfore for now ts-coverity-scan justs prints the curl arguments while we sort the rest out.

---
Could consider running on smoked? staging is probably a step too far.

Deployment notes:
- Put cov-analysis-linux64-7.7.0.4.tar.gz in the Images directory.
- Populate $HOME/.xen-osstest/coverity-secret with the token
- Populate xen.git#coverity-scanned with an initial baseline, update ap-fetch-version-old to refer to it instead of master.

---
 Osstest/BuildSupport.pm |  12 ++++++
 ap-fetch-version        |   3 ++
 ap-fetch-version-old    |   4 ++
 ap-print-url            |   2 +-
 ap-push                 |   4 ++
 cr-daily-branch         |  18 +++++++-
 cri-common              |   1 +
 crontab                 |   1 +
 make-coverity-flight    |  47 +++++++++++++++++++++
 production-config       |   4 ++
 sg-run-job              |   5 +++
 ts-coverity-scan        | 108 ++++++++++++++++++++++++++++++++++++++++++++++++
 ts-xen-build            |  11 +----
 ts-xen-build-prep       |   2 +-
 14 files changed, 209 insertions(+), 13 deletions(-)
 create mode 100755 make-coverity-flight
 create mode 100755 ts-coverity-scan
Osstest/BuildSupport.pm +12 -0
index 933f6e1..a183546 100644
@@ -42,6 +42,7 @@ BEGIN {
 
                       xendist
                       $xendist
+                      collect_xen_built_versions
 
                       submodulefixup submodule_have submodule_find
 
@@ -84,6 +85,17 @@ sub xendist () {
 	($ho, 'xendist', '', $r{"buildjob"});
 }
 
+sub collect_xen_built_versions () {
+    my $tools="$builddir/xen/tools";
+    my $extras="$builddir/xen/extras";
+    store_revision($ho, 'qemu', "$tools/ioemu-dir", 1);
+    store_revision($ho, 'qemu', "$tools/qemu-xen-traditional-dir", 1);
+    store_revision($ho, 'qemuu', "$tools/qemu-xen-dir", 1);
+    store_revision($ho, 'seabios', "$tools/firmware/seabios-dir", 1);
+    store_revision($ho, 'ovmf', "$tools/firmware/ovmf-dir", 1);
+    store_revision($ho, 'minios', "$extras/mini-os", 1);
+}
+
 #----- submodules -----
 
 sub submodulefixup ($$$$) {
ap-fetch-version +3 -0
index a7b658b..1e48b45 100755
@@ -53,6 +53,9 @@ xen-4.*-testing)
 	repo_tree_rev_fetch_git xen \
 		$TREE_XEN staging-$branchcore $LOCALREV_XEN
 	;;
+coverity)
+	repo_tree_rev_fetch_git xen $TREE_XEN master $LOCALREV_XEN
+	;;
 qemu-mainline)
 	repo_tree_rev_fetch_git $branch \
 		$TREE_QEMU_MAINLINE master $LOCALREV_QEMU_UPSTREAM
ap-fetch-version-old +4 -0
index e2c6b3b..9d6190f 100755
@@ -59,6 +59,10 @@ xen-4.*-testing)
 	repo_tree_rev_fetch_git xen \
 		$TREE_XEN stable-$branchcore $LOCALREV_XEN
 	;;
+coverity)
+	#XXX doesn't exist yet, use master for now repo_tree_rev_fetch_git xen $TREE_XEN coverity-scanned $LOCALREV_XEN
+	repo_tree_rev_fetch_git xen $TREE_XEN master $LOCALREV_XEN
+	;;
 qemu-mainline)
         repo_tree_rev_fetch_git $branch \
 		$BASE_TREE_QEMU_UPSTREAM upstream-tested $LOCALREV_QEMU_UPSTREAM
ap-print-url +1 -1
index 4088852..6ca000d 100755
@@ -31,7 +31,7 @@ if info_linux_tree "$branch"; then
 fi
 
 case "$branch" in
-xen-*)
+xen-*|coverity)
         echo $TREE_XEN
 	;;
 qemu-mainline)
ap-push +4 -0
index 8def652..97510c3 100755
@@ -68,6 +68,10 @@ xen-*-testing)
 	xenversion=${xenversion#xen-}
 	git push $TREE_XEN $revision:refs/heads/stable-$xenversion
 	;;
+coverity)
+	cd $repos/xen
+	git push $TREE_XEN $revision:refs/heads/coverity-scanned
+	;;
 qemu-mainline)
 	cd $repos/qemu-mainline
 	git push $TREE_QEMU_UPSTREAM $revision:refs/heads/upstream-tested
cr-daily-branch +17 -1
index 364238c..9594e18 100755
@@ -205,7 +205,22 @@ fi
 case "$tree" in
 xen)
         realtree=$xenbranch
-	NEW_REVISION=$REVISION_XEN
+
+	case $branch in
+	    coverity)
+		if [ "x$TREE_COVERITY" = x ]; then
+		    export TREE_COVERITY=$TREE_XEN
+		fi
+		if [ "x$REVISION_COVERITY" = x ]; then
+		    determine_version REVISION_COVERITY coverity COVERITY
+		    export REVISION_COVERITY
+		fi
+		NEW_REVISION=$REVISION_COVERITY
+		;;
+	    *)
+		NEW_REVISION=$REVISION_XEN
+		;;
+	esac
 	;;
 linux)
         realtree=linux
@@ -259,6 +274,7 @@ fi
 
 case $branch in
 distros-*) makeflight=./make-distros-flight ;;
+coverity)  makeflight=./make-coverity-flight ;;
 *)         makeflight=./make-flight ;;
 esac
 
cri-common +1 -0
index 6dfe8df..9f8bb0b 100644
@@ -68,6 +68,7 @@ select_xenbranch () {
 	case "$branch" in
 	xen-unstable-smoke)	tree=xen;	xenbranch=$branch; qemuubranch=qemu-upstream-unstable;;
 	xen-*)			tree=xen;	xenbranch=$branch ;;
+	coverity)               tree=xen;       xenbranch=xen-unstable ;;
 	qemu-mainline)		tree=qemuu;	xenbranch=xen-unstable; qemuubranch=qemu-mainline;;
         qemu-upstream-*)    tree=qemuu; xenbranch=xen-${branch#qemu-upstream-};;
 	linux)			tree=linux;	xenbranch=xen-unstable ;;
crontab +1 -0
index 09b8d14..b6ced25 100755
@@ -8,6 +8,7 @@ [email protected],[email protected]
 0		*	* * *		cd testing.git && BRANCHES=xen-unstable-smoke	./cr-for-branches branches -q "./cr-daily-branch --real"
 4-59/30		*	* * *		cd testing.git &&				./cr-for-branches branches -q "./cr-daily-branch --real"
 18		9	* * 1,3,5	cd testing.git && BRANCHES=linux-next		./cr-for-branches branches -w "./cr-daily-branch --real"
+18		9	* * 7		cd testing.git && BRANCHES=coverity		./cr-for-branches branches -w "./cr-daily-branch --real"
 18		4	* * *		cd testing.git && BRANCHES='linux-linus linux-mingo-tip-master linux-3.0 libvirt rumpuserxen' ./cr-for-branches branches -w "./cr-daily-branch --real"
 6-59/15   	*	* * *		cd testing.git && EXTRA_BRANCHES='linux-linus linux-3.0 rumpuserxen libvirt' ./cr-for-branches bisects -w "./cr-try-bisect --real"
 #8-59/5		*	* * *		cd bisects/adhoc.git &&	with-lock-ex -q data-tree-lock bash -c "./cr-try-bisect-adhoc; exit $?"
make-coverity-flight new file +47 -0

47 lines not on this page · raw message

production-config +4 -0
index bb8d224..874cbba 100644
@@ -100,6 +100,10 @@ TftpGrubVersion XXXX-XX-XX
 XenUsePath /usr/groups/xencore/systems/bin/xenuse
 XenUseUser osstest
 
+# Results might include potential vulnerabilities.
+CoverityEmail [email protected]
+CoverityTools cov-analysis-linux64-7.7.0.4.tar.gz
+
 # We use the IP address because Citrix can't manage reliable nameservice
 #DebianMirrorHost debian.uk.xensource.com
 #DebianMirrorHost 10.80.16.196
sg-run-job +5 -0
index 20ebb64..7e592dd 100755
@@ -445,6 +445,11 @@ proc prepare-build-host {} {
     run-ts . host-build-prep ts-xen-build-prep
 }
 
+proc need-hosts/coverity {} { return BUILD }
+proc run-job/coverity {} {
+    run-ts . = ts-coverity-scan + host
+}
+
 #---------- main program ----------
 
 jobdb::set-flight
ts-coverity-scan new file +108 -0

108 lines not on this page · raw message

ts-xen-build +1 -10
index b02e737..5c7863d 100755
@@ -138,15 +138,6 @@ END
     }
 }
 
-sub collectversions () {
-    my $tools="$builddir/xen/tools";
-    store_revision($ho, 'qemu', "$tools/ioemu-dir", 1);
-    store_revision($ho, 'qemu', "$tools/qemu-xen-traditional-dir", 1);
-    store_revision($ho, 'qemuu', "$tools/qemu-xen-dir", 1);
-    store_revision($ho, 'seabios', "$tools/firmware/seabios-dir", 1);
-    store_revision($ho, 'ovmf', "$tools/firmware/ovmf-dir", 1);
-}
-
 sub divide () {
     # Only move hv to xeninstall, so that we can have
     # xenpolicy in tools tarball.
@@ -232,7 +223,7 @@ sub trapping ($) {
 checkout();
 
 trapping(\&build);
-trapping(\&collectversions);
+trapping(\&collect_xen_built_versions);
 
 die "*** something failed:\n\n".(join "\n\n",@probs)."\n** something failed"
     if @probs;
ts-xen-build-prep +1 -1
index b35e91b..c2383db 100755
@@ -206,7 +206,7 @@ sub prep () {
                       autoconf automake libtool xsltproc
                       libxml2-utils libxml2-dev
                       libdevmapper-dev w3c-dtd-xhtml libxml-xpath-perl
-                      ccache nasm checkpolicy ebtables);
+                      ccache nasm checkpolicy ebtables curl);
 
     if ($ho->{Suite} =~ m/wheezy|squeeze|lenny/) {
 	push(@packages, "libnl-dev");
Signature · 1 line
2.6.1
#1 lore raw

Ian Campbell writes ("[PATCH OSSTEST] Add a weekly coverity flight"):

Quoted 2 lines

Move collectversions into Osstest::BuildSupport rather than duplicating with ts-xen-build (nothing else is really duplicated)

This could profitably be split into a separate patch IMO.

Quoted 7 lines

For the cr-* integration we treat branch=coverity as a special case of tree=xen. I didn't think tree=coverity made much sense, and would probably reach tendrils into lots of other places (such as the invocations of check_tested).

TODO: How to pick $c{CoverityEmail}, needs to be a real email which is in coverity project (which [email protected] used here is not)

I don't have an answer to this but perhaps osstest-admin@xenproject ? Or will it get lots of annoying output ? (We could filter it to make it go to osstest-output I guess...)

production-config TftpGrubVersion XXXX-XX-XX · line 105

Quoted 2 lines
production-config +2 -0
+CoverityEmail [email protected]
+CoverityTools cov-analysis-linux64-7.7.0.4.tar.gz

This file needs a DEPLOYMENT NOTE I think.

The rest of this looks OK. A review from Andrew Cooper might be worthwhile ?

Ian.

#2 lore raw
Quoted 16 lines · Ian Jackson

Ian Campbell writes ("[PATCH OSSTEST] Add a weekly coverity flight"):

Quoted 2 lines

Move collectversions into Osstest::BuildSupport rather than duplicating with ts-xen-build (nothing else is really duplicated)

This could profitably be split into a separate patch IMO.

Quoted 7 lines

For the cr-* integration we treat branch=coverity as a special case of tree=xen. I didn't think tree=coverity made much sense, and would probably reach tendrils into lots of other places (such as the invocations of check_tested).

TODO: How to pick $c{CoverityEmail}, needs to be a real email which is in coverity project (which [email protected] used here is not)

I don't have an answer to this but perhaps osstest-admin@xenproject ? Or will it get lots of annoying output ? (We could filter it to make it go to osstest-output I guess...)

Quoted 6 lines

production-config TftpGrubVersion XXXX-XX-XX · line 105

Quoted 2 lines
production-config +2 -0
+CoverityEmail [email protected]
+CoverityTools cov-analysis-linux64-7.7.0.4.tar.gz

This file needs a DEPLOYMENT NOTE I think.

The rest of this looks OK. A review from Andrew Cooper might be worthwhile ?

I don't speak much perl, nor know the internals of OSSTest.

However, the snippets of shell for building look correct.

~Andrew

#3 lore raw
In reply to Ian Jackson
Quoted 11 lines · Ian Jackson

Ian Campbell writes ("[PATCH OSSTEST] Add a weekly coverity flight"):

Quoted 2 lines

Move collectversions into Osstest::BuildSupport rather than duplicating with ts-xen-build (nothing else is really duplicated)

This could profitably be split into a separate patch IMO.

Quoted 5 lines

For the cr-* integration we treat branch=coverity as a special case of tree=xen. I didn't think tree=coverity made much sense, and would probably reach tendrils into lots of other places (such as the invocations of check_tested).

Quoted 6 lines
Quoted 2 lines

TODO: How to pick $c{CoverityEmail}, needs to be a real email which is in coverity project (which [email protected] used here is not)

I don't have an answer to this but perhaps osstest-admin@xenproject ? Or will it get lots of annoying output ?  (We could filter it to make it go to osstest-output I guess...)

It's not lots of output, but it will contain potential security vulnerabilities.

In principal it should only contain newly introduced vulnerabilities, which we would obviously fix before releasing, but:

a) We might not notice but someone more nefarious might

b) Some kinds of changes can cause previously discovered (but not fixed) issues to be re-reported

Quoted 4 lines

production-config TftpGrubVersion XXXX-XX-XX · line 105

Quoted 2 lines
production-config +2 -0
+CoverityEmail [email protected]
+CoverityTools cov-analysis-linux64-7.7.0.4.tar.gz

This file needs a DEPLOYMENT NOTE I think.

Yes.

Quoted 5 lines

The rest of this looks OK.  A review from Andrew Cooper might be worthwhile ?

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel