summaryrefslogtreecommitdiffstats
path: root/coverity
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-09-27 01:25:09 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-09-27 01:25:09 +0200
commita62cfe1ed3ede2ddc0b64ab94f1a09cb35c3c89e (patch)
tree19e6fbd523b83d07bb89ab8eb897296c9ff77896 /coverity
parent735a5b9d1653d98f1ab65462b83738106e80c40c (diff)
add coverity scripts found on osmo build-1
Diffstat (limited to 'coverity')
-rwxr-xr-xcoverity/build_iuh.sh154
-rwxr-xr-xcoverity/coverity_all.sh139
-rwxr-xr-xcoverity/coverity_iuh.sh16
-rwxr-xr-xcoverity/coverity_test_osmo_trx.sh41
-rwxr-xr-xcoverity/get_token.sh18
5 files changed, 368 insertions, 0 deletions
diff --git a/coverity/build_iuh.sh b/coverity/build_iuh.sh
new file mode 100755
index 0000000..f3afeab
--- /dev/null
+++ b/coverity/build_iuh.sh
@@ -0,0 +1,154 @@
+#!/usr/bin/env bash
+
+set -e -x
+
+export PKG_CONFIG_PATH=~/coverity/install-iuh/lib/pkgconfig
+
+do_build() {
+ git clean -dxf
+ git checkout .
+ git remote prune origin
+ git pull --rebase
+ autoreconf --install --force
+ ./configure --prefix=$HOME/coverity/install-iuh $*
+
+ make
+ make install
+}
+
+build_layer1api() {
+ pushd layer1-api
+ install -d $HOME/coverity/install-iuh/include/sysmocom/femtobts/
+ cp include/*.h $HOME/coverity/install-iuh/include/sysmocom/femtobts/
+ popd
+}
+
+build_asn1c() {
+ pushd asn1c
+ do_build
+ popd
+}
+
+build_libasn1c() {
+ pushd libasn1c
+ do_build
+ sed -i s,'#include "config.h"','/*#include "config.h"*/', $HOME/coverity/install-iuh/include/asn1c/asn_system.h
+ popd
+}
+
+build_osmoiuh() {
+ pushd osmo-iuh
+ do_build
+ popd
+}
+
+build_libosmocore() {
+ pushd libosmocore
+
+ do_build
+ popd
+}
+
+build_libosmoabis() {
+ pushd libosmo-abis
+
+ do_build
+ popd
+}
+
+build_libosmosccp() {
+ pushd libosmo-sccp
+
+ do_build
+ popd
+}
+
+build_openggsn() {
+ pushd openggsn
+ do_build
+ popd
+}
+
+build_openbsc() {
+ pushd openbsc/openbsc
+ git checkout sysmocom/iu
+
+ do_build --enable-osmo-bsc --enable-nat --enable-smpp --enable-mgcp-transcoding --enable-iu
+ popd
+}
+
+build_osmobts() {
+ pushd openbsc/openbsc
+ git checkout master
+ git pull --rebase
+ popd
+ pushd osmo-bts
+
+ do_build --enable-sysmocom-bts --with-openbsc=$PWD/../openbsc/openbsc/include
+ popd
+}
+
+build_osmopcu() {
+ pushd osmo-pcu
+
+ do_build --enable-sysmocom-bts=yes --enable-sysmocom-dsp=yes
+ popd
+}
+
+build_libosmodsp() {
+ pushd libosmo-dsp
+ do_build
+ popd
+}
+
+build_libosmonetif() {
+ pushd libosmo-netif
+ do_build
+ popd
+}
+
+build_osmogmr() {
+ pushd osmo-gmr
+ do_build
+ popd
+}
+
+build_libsmpp34() {
+ pushd libsmpp34
+ do_build
+ popd
+}
+
+build_osmosipconnector() {
+ pushd osmo-sip-connector
+ do_build
+ popd
+}
+
+cd source-iuh
+
+
+rm -rf ~/coverity/install-iuh/
+
+build_layer1api
+build_asn1c
+build_libosmocore
+build_libasn1c
+build_libosmoabis
+build_libosmonetif
+build_libosmosccp
+build_libsmpp34
+build_openggsn
+build_osmoiuh
+build_osmopcu
+build_osmobts
+build_openbsc
+build_osmosipconnector
+
+# GMR
+build_libosmodsp
+build_osmogmr
+
+
+# MNCC to SIP
+build_osmosipconnector
diff --git a/coverity/coverity_all.sh b/coverity/coverity_all.sh
new file mode 100755
index 0000000..e8d4722
--- /dev/null
+++ b/coverity/coverity_all.sh
@@ -0,0 +1,139 @@
+#!/usr/bin/env bash
+
+base_dir="$PWD"
+
+set -e -x
+
+export PATH=~/coverity/cov-analysis-linux64-8.5.0/bin/:$PATH
+export PKG_CONFIG_PATH=~/coverity/install/lib/pkgconfig
+
+do_build() {
+ git clean -dxf
+ git remote prune origin
+ git pull --rebase
+ autoreconf --install --force
+ ./configure --prefix=$HOME/coverity/install $*
+
+ cov-build --dir cov-int make
+ make install
+ tar czf myproject.tgz cov-int
+}
+
+do_upload() {
+ project="$1"
+ token="$("$base_dir"/get_token.sh "$base_dir"/tokens.txt $project)"
+ curl \
+ --form token=$token \
+ --form email=holger@freyther.de --form file=@myproject.tgz \
+ --form version=Version --form description=AutoUpload \
+ https://scan.coverity.com/builds?project=$project
+ :
+}
+
+upload_libosmocore() {
+ pushd libosmocore
+
+ do_build
+ do_upload libosmocore
+ popd
+}
+
+upload_libosmoabis() {
+ pushd libosmo-abis
+
+ do_build
+ do_upload libosmo-abis
+ popd
+}
+
+upload_libosmosccp() {
+ pushd libosmo-sccp
+
+ do_build
+ do_upload libosmo-sccp
+ popd
+}
+
+upload_openggsn() {
+ pushd openggsn
+ do_build
+ do_upload OpenGGSN
+ popd
+}
+
+upload_openbsc() {
+ pushd openbsc/openbsc
+
+ do_build --enable-osmo-bsc --enable-nat --enable-smpp --enable-mgcp-transcoding
+ do_upload OpenBSC
+ popd
+}
+
+upload_osmobts() {
+ pushd osmo-bts
+
+ do_build --enable-sysmocom-bts --with-openbsc=$PWD/../openbsc/openbsc/include
+ do_upload osmo-bts
+ popd
+}
+
+upload_osmopcu() {
+ pushd osmo-pcu
+
+ do_build --enable-sysmocom-bts=yes --enable-sysmocom-dsp=yes
+ do_upload osmo-pcu
+ popd
+}
+
+upload_libosmodsp() {
+ pushd libosmo-dsp
+ do_build
+ do_upload libosmo-dsp
+ popd
+}
+
+upload_libosmonetif() {
+ pushd libosmo-netif
+ do_build
+ do_upload libosmo-netif
+ popd
+}
+
+upload_osmogmr() {
+ pushd osmo-gmr
+ do_build
+ do_upload osmo-gmr
+ popd
+}
+
+build_libsmpp34() {
+ pushd libsmpp34
+ do_build
+ popd
+}
+
+build_api() {
+ pushd layer1-api
+ install -d $HOME/coverity/install/include/sysmocom/femtobts/
+ cp include/*.h $HOME/coverity/install/include/sysmocom/femtobts/
+ popd
+}
+
+cd source
+
+upload_libosmocore
+upload_libosmoabis
+upload_libosmonetif
+upload_libosmosccp
+build_libsmpp34
+build_api
+upload_openggsn
+upload_openbsc
+upload_osmopcu
+
+# GMR
+upload_libosmodsp
+upload_osmogmr
+
+# last.. as currently broken
+upload_osmobts
diff --git a/coverity/coverity_iuh.sh b/coverity/coverity_iuh.sh
new file mode 100755
index 0000000..517b634
--- /dev/null
+++ b/coverity/coverity_iuh.sh
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+set -e -x
+
+export PATH=~/coverity/cov-analysis-linux64-8.5.0/bin/:$PATH
+
+rm -rf sources-iuh/cov-int
+cov-build --dir sources-iuh/cov-int ./build_iuh.sh
+cd sources-iuh
+tar czf myproject.tgz cov-int
+
+ curl \
+ --form token="$(../get_token.sh ../tokens.txt iuh)" \
+ --form email=holger@freyther.de --form file=@myproject.tgz \
+ --form version=Version --form description=AutoUpload \
+ https://scan.coverity.com/builds?project=Osmocom
diff --git a/coverity/coverity_test_osmo_trx.sh b/coverity/coverity_test_osmo_trx.sh
new file mode 100755
index 0000000..75da893
--- /dev/null
+++ b/coverity/coverity_test_osmo_trx.sh
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+
+set -e -x
+
+export PATH=~/coverity/cov-analysis-linux64-8.5.0/bin/:$PATH
+export PKG_CONFIG_PATH=~/coverity/install/lib/pkgconfig
+
+do_build() {
+ git clean -dxf
+ git remote prune origin
+ git pull --rebase
+ autoreconf --install --force
+ ./configure --prefix=$HOME/coverity/install $*
+
+ cov-build --dir cov-int make
+ make install
+ tar czf myproject.tgz cov-int
+}
+
+do_upload() {
+ curl \
+ --form token=$2 \
+ --form email=holger@freyther.de --form file=@myproject.tgz \
+ --form version=Version --form description=AutoUpload \
+ https://scan.coverity.com/builds?project=$1
+ :
+}
+
+upload_osmotrx() {
+ pushd osmo-trx
+
+ do_build
+ #do_upload osmo-trx Insert-Coverity-Token-Here
+ popd
+}
+
+
+cd source
+
+upload_osmotrx
+
diff --git a/coverity/get_token.sh b/coverity/get_token.sh
new file mode 100755
index 0000000..75eaf05
--- /dev/null
+++ b/coverity/get_token.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# Usage:
+# get_token.sh ../tokens.txt my-project
+#
+# Look for coverity token in a text file.
+# Text file lines must be of this format:
+# <token><single-space><project>
+#
+# e.g.
+#
+# a3Ksd02nfa-Lk28f_cAk3F libosmocore
+# b8sdJA_sd43fLS3-2vL24g libosmo-abis
+# ...
+
+tokens_file="$1"
+project="$2"
+grep " $project\$" "$tokens_file" | sed 's/ .*//'