scripts/mk-patch.sh
author Martin Lund <mgl@doredevelopment.dk>
Wed May 19 17:53:04 2010 +0200 (2010-05-19)
changeset 1965 e3d532dd8b5d
child 2075 edc7c7958e80
permissions -rwxr-xr-x
test-suite: Added new test suite feature (experimental)

This patch adds support for installing the gcc test suite. A helper
Makefile is provided for building and running the gcc tests.

The default configuration runs all gcc tests and requires automatic
ssh/scp login access to a networked target board. See README for
more details.

Note: Current feature is tested with the powerpc-unknown-linux-gnu
sample but it should work with others as well.

Signed-off-by: Martin Lund <mgl@doredevelopment.dk>
     1 #!/bin/sh
     2 
     3 repos="$1"
     4 pdir="$2"
     5 if [ -z "${repos}" -o ! -d "${repos}" -o -z "${pdir}" -o ! -d "${pdir}" ];then
     6     printf "Usage: ${0##*/} <repos_dir> <patch_dir>\n"
     7     exit 1
     8 fi
     9 
    10 pdir="$( cd "${pdir}"; pwd)"
    11 version="$( echo "${pdir}" |sed -r -e 's,.*/([^/]+)/*$,\1,' )"
    12 branch="${version%.*}"
    13 n=$( ls -1 "${pdir}" 2>/dev/null |wc -l )
    14 
    15 r1="$( hg -R "${repos}" log -b "${branch}"  \
    16        |awk '
    17             $1=="changeset:" {
    18                 prev=rev;
    19                 split($2,a,":");
    20                 rev=a[1];
    21             }
    22             $0~/^summary:[[:space:]]+'"${branch}: (bump|update) version to ${version}\+hg"'$/ {
    23                 printf( "%d\n", prev );
    24             }
    25             '
    26      )"
    27 
    28 i=0
    29 hg -R "${repos}" log -b "${branch}" -r "${r1}:tip" --template '{rev}\n'    \
    30 |while read rev; do
    31     p="$( printf "%03d" ${i} )"
    32     i=$((i+1))
    33     if [ $( ls -1 "${pdir}/${p}-"*.patch 2>/dev/null |wc -l ) -ne 0 ]; then
    34         continue
    35     fi
    36     plog=$( hg -R "${repos}" log -r ${rev} --template '{desc|firstline}\n'  \
    37             |sed -r -e 's,[/ :]+,_,g;'                                      \
    38           )
    39     pname="${p}-${plog}.patch"
    40     printf "Revision '%d' --> '%s'\n" ${rev} "${pname}"
    41     hg -R "${repos}" diff -c ${rev} --color=never >"${pdir}/${pname}"
    42     pdate="$( hg -R "${repos}" log -r ${rev} --template '{date|isodate}\n' )"
    43     touch -d "${pdate}" "${pdir}/${pname}"
    44 done