1#/bin/sh
2# Generate test result data for xstormy16 GAS testing.
3# It is intended to be run in the testsuite source directory.
4#
5# Syntax: build.sh /path/to/build/gas
6
7if [ $# = 0 ] ; then
8  if [ ! -x ../gas/as-new ] ; then
9    echo "Usage: $0 [/path/to/gas/build]"
10  else
11    BUILD=`pwd`/../gas
12  fi
13else
14  BUILD=$1
15fi
16
17if [ ! -x $BUILD/as-new ] ; then
18  echo "$BUILD is not a gas build directory"
19  exit 1
20fi
21
22# Put results here, so we preserve the existing set for comparison.
23rm -rf tmpdir
24mkdir tmpdir
25cd tmpdir
26
27function gentest {
28    rm -f a.out
29    $BUILD/as-new ${1}.s -o a.out
30    echo "#as:" >${1}.d
31    echo "#objdump: -dr" >>${1}.d
32    echo "#name: $1" >>${1}.d
33    $BUILD/../binutils/objdump -dr a.out | 	sed -e 's/(/\\(/g'             -e 's/)/\\)/g'             -e 's/\$/\\$/g'             -e 's/\[/\\\[/g'             -e 's/\]/\\\]/g'             -e 's/[+]/\\+/g'             -e 's/[.]/\\./g'             -e 's/[*]/\\*/g' | 	sed -e 's/^.*file format.*$/.*: +file format .*/' 	>>${1}.d
34    rm -f a.out
35}
36
37# Now come all the testcases.
38cat > gcc.s <<EOF
39	mov.w r0,#-1
40	mov.w r0,#0xFFFF
41	add r0,#some_external_symbol
42EOF
43
44# Finally, generate the .d file.
45gentest gcc
46