source: branches/stable/tools/pkg2test @ 1285

Last change on this file since 1285 was 1285, checked in by Bruno Cornec, 13 years ago

First attempt to automize tests

  • Property svn:executable set to *
File size: 2.3 KB
Line 
1#!/bin/bash
2#
3# Test packages
4#
5# $Id$
6#
7
8
9(
10dname=`dirname $0`
11prem=`echo $dname |cut -c1`
12if [ _${prem} = _"/" ]; then
13        export TOOLHOME=$dname
14else
15    export TOOLHOME=${PWD}/$dname
16fi
17
18. $TOOLHOME/common-env
19. $TOOLHOME/distro-env
20
21# We need to get $VER and $TAG
22if [ "$1" = "" ]; then
23    LAST=`cat ${TOPDIR}/LAST`
24else
25    LAST=$1
26    shift
27fi
28VER=`echo $LAST | cut -d- -f1`
29TAG=`echo $LAST | cut -d- -f2`
30echo "Working on ${VER}-$TAG"
31   
32if [ "$1" = "" ]; then
33    c="mondo-doc mindi mindi-busybox mondo"
34else
35    if [ "$1" = "all" ]; then
36        c="mindi-kernel mondo-doc mindi mindi-busybox mondo"
37    else
38        c="$*"
39    fi
40fi
41
42export pkg=""
43echo "Working under $TOPBUILDDIR"
44cd $TOPBUILDDIR
45
46spkg=""
47pkg=""
48
49for p in $c; do
50    # s= stable; t = trunk; 1-9 = official version
51    src=${TOPDIR}/${VER}-$TAG/$p-[1-9st]*.tar.gz
52    pv=`basename $src .tar.gz`
53    tar -xz -C $MONDOTMP -f $src $pv/TAG
54    tag=`cat $MONDOTMP/$pv/TAG`
55    if [  _"$dtype" = _"rpm" ]; then
56        if [ _"$p" = _"mondo-doc" ] || [ _"$p" = _"mindi" ]; then
57            ar="noarch"
58        else
59            ar=$ARCH
60        fi
61        pkg="$pkg ${TOPBUILDDIR}/RPMS/${ar}/$pv-${tag}${suf}.${ar}.rpm"
62        spkg="$spkg ${TOPBUILDDIR}/SRPMS/$pv-${tag}${suf}.src.rpm"
63    elif [  _"$dtype" = "_deb" ]; then
64        pkg="$pkg ${TOPBUILDDIR}/$p_*.deb"
65        spkg="$spkg ${TOPBUILDDIR}/$p_*.dsc ${TOPBUILDDIR}/$p_*.tar.gz"
66    elif [  _"$dtype" = "_ebuild" ]; then
67        spkg="$spkg ${TOPBUILDDIR}/portage/sys-apps/$p/$pv.ebuild"
68        pkg="$pkg /usr/portage/packages/All/$pv.tbz2"
69    elif [  _"$dfam" = _"slackware" ]; then
70        pkg="$pkg ${TOPBUILDDIR}/build-$p/$pv-*-${tag}mr.tgz"
71    fi
72done
73
74echo "Packages installation"
75if [  _"$dtype" = _"rpm" ]; then
76    sudo rpm -Uvh ${pkg}
77elif [  _"$dtype" = "_deb" ]; then
78    sudo dpkg -i ${pkg}
79elif [  _"$dtype" = "_ebuild" ]; then
80    sudo blabla ${pkg}
81elif [  _"$dfam" = _"slackware" ]; then
82    sudo pkginstall ${pkg}
83fi
84cat > $MONDOTMP/test-mondo << EOF
85#!/bin/bash
86
87h=test-mondo
88mkdir -p /mondo/tmp-\$h /mondo/scratch-\$h
89mkdir -p /users/svg
90mount flecha.home.musique-ancienne.org:/users/svg /users/svg
91/usr/sbin/mondoarchive -n flecha.home.musique-ancienne.org:/users/svg -G -F -N -O -E "/usr/doc /home /users /var/log" -d images -s 4300m -T /mondo/tmp-\$h -S /mondo/scratch-\$h -p \$h
92umount /users/svg
93EOF
94chmod 755 $MONDOTMP/test-mondo
95sudo $MONDOTMP/test-mondo
96rm -rf $MONDOTMP
97) 2>&1 | tee /tmp/pkg2test.log
Note: See TracBrowser for help on using the repository browser.