Use TDS Layout
This commit is contained in:
parent
84f4c7f55c
commit
8d320f3744
30 changed files with 240 additions and 262 deletions
7
source/test-suite/.gitignore
vendored
Normal file
7
source/test-suite/.gitignore
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
*.error
|
||||
*.hex
|
||||
*.elf
|
||||
*.output
|
||||
*.tex
|
||||
*.log
|
||||
*.aux
|
1
source/test-suite/FOOTER
Normal file
1
source/test-suite/FOOTER
Normal file
|
@ -0,0 +1 @@
|
|||
\end{document}
|
8
source/test-suite/HEADER
Normal file
8
source/test-suite/HEADER
Normal file
|
@ -0,0 +1,8 @@
|
|||
\documentclass{article}
|
||||
|
||||
\usepackage{avremu}
|
||||
|
||||
\errorcontextlines=23
|
||||
|
||||
\begin{document}
|
||||
\makeatletter
|
22
source/test-suite/complex-memory.c
Normal file
22
source/test-suite/complex-memory.c
Normal file
|
@ -0,0 +1,22 @@
|
|||
#include <avr/io.h>
|
||||
|
||||
volatile char foo[30];
|
||||
|
||||
int main() {
|
||||
foo[0] = 23;
|
||||
foo[1] = 42;
|
||||
foo[2] = foo[0] + foo[1];
|
||||
|
||||
asm volatile ("break");
|
||||
}
|
||||
|
||||
/*
|
||||
check-name: Complex Memory Operations
|
||||
check-start:
|
||||
\avr@instr@stepn{1000}
|
||||
|
||||
\avr@test@MEM{96}{00010111} % 23
|
||||
\avr@test@MEM{97}{00101010} % 42
|
||||
\avr@test@MEM{98}{01000001} % 65
|
||||
check-end:
|
||||
*/
|
10
source/test-suite/empty-main.c
Normal file
10
source/test-suite/empty-main.c
Normal file
|
@ -0,0 +1,10 @@
|
|||
int main() {
|
||||
asm volatile ("break");
|
||||
}
|
||||
|
||||
/**
|
||||
check-name: Run simple main Function
|
||||
check-start:
|
||||
\avr@instr@stepn{5000}
|
||||
check-end:
|
||||
**/
|
20
source/test-suite/fibonacci-rec.c
Normal file
20
source/test-suite/fibonacci-rec.c
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include <avr/io.h>
|
||||
|
||||
char fib(char n) {
|
||||
if (n <= 1) {
|
||||
return 1;
|
||||
}
|
||||
return fib(n-1) + fib(n-2);
|
||||
}
|
||||
|
||||
int main() {
|
||||
UDR = fib(5);
|
||||
asm volatile ("break");
|
||||
}
|
||||
/*
|
||||
check-name: Fibonacci (Recursive)
|
||||
check-start:
|
||||
\avr@instr@stepn{1000}
|
||||
\avr@test@REG{r24}{00001000}
|
||||
check-end:
|
||||
*/
|
41
source/test-suite/float.c
Normal file
41
source/test-suite/float.c
Normal file
|
@ -0,0 +1,41 @@
|
|||
#include <avr/io.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static int uart_putchar(char c, FILE *stream);
|
||||
static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL,
|
||||
_FDEV_SETUP_WRITE);
|
||||
static int
|
||||
uart_putchar(char c, FILE *stream)
|
||||
{
|
||||
UDR = c;
|
||||
return 0;
|
||||
}
|
||||
|
||||
volatile uint16_t xxx = 65;
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
stdout = &mystdout;
|
||||
|
||||
volatile float a = 0.23;
|
||||
volatile float b = 0.43;
|
||||
|
||||
printf("%.2f", 1/ (a * b * 3));
|
||||
asm volatile("break;");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
check-name: Calculate with floats
|
||||
compiler-opts: -Wl,-u,vfprintf -lm -lprintf_flt
|
||||
|
||||
check-start:
|
||||
|
||||
\avr@instr@stepn{100000}
|
||||
\avr@test@UDR{3.37}
|
||||
|
||||
check-end:
|
||||
**/
|
22
source/test-suite/func-ptr.c
Normal file
22
source/test-suite/func-ptr.c
Normal file
|
@ -0,0 +1,22 @@
|
|||
#include <avr/io.h>
|
||||
|
||||
// Produces LPM operations
|
||||
__attribute__((noinline)) void bar() {
|
||||
UDR='X';
|
||||
}
|
||||
void (*foo)() = bar;
|
||||
|
||||
int main() {
|
||||
bar();
|
||||
foo();
|
||||
asm volatile ("break");
|
||||
}
|
||||
|
||||
/*
|
||||
check-name: Function Pointers
|
||||
check-start:
|
||||
\avr@instr@stepn{1000000}
|
||||
|
||||
\avr@test@UDR{XX}
|
||||
check-end:
|
||||
*/
|
133
source/test-suite/mandelbrot.c
Normal file
133
source/test-suite/mandelbrot.c
Normal file
|
@ -0,0 +1,133 @@
|
|||
/** mandel.c by Eric R. Weeks written 9-28-96
|
||||
** weeks@physics.emory.edu
|
||||
** http://www.physics.emory.edu/~weeks/
|
||||
**
|
||||
** This program is public domain, but this header must be left intact
|
||||
** and unchanged.
|
||||
**
|
||||
**/
|
||||
|
||||
#include <avr/io.h>
|
||||
|
||||
#define CMD_COLOR 1
|
||||
#define CMD_DOT 2
|
||||
|
||||
|
||||
|
||||
static
|
||||
void setcolor(uint8_t r, uint8_t g, uint8_t b) {
|
||||
TWDR = r;
|
||||
TWDR = g;
|
||||
TWDR = b;
|
||||
TWAR = CMD_COLOR;
|
||||
}
|
||||
|
||||
static
|
||||
void dot(uint8_t x, uint8_t y) {
|
||||
TWDR = x, TWDR = y;
|
||||
TWAR = CMD_DOT;
|
||||
}
|
||||
|
||||
|
||||
/* Colors
|
||||
import colorsys
|
||||
def color(i):
|
||||
h = i/float(100)
|
||||
s = 1.0
|
||||
v = h
|
||||
print h, s, v
|
||||
x = colorsys.hsv_to_rgb(h, s, v)
|
||||
return (str(int(x[0] * 255)),
|
||||
str(int(x[1] * 255)),
|
||||
str(int(x[2] * 255)))
|
||||
|
||||
colors = [color (i) for i in range(0, 100)]
|
||||
|
||||
print "char color_R[] = {%s};" % (",".join([x[0] for x in colors]))
|
||||
print "char color_G[] = {%s};" % (",".join([x[1] for x in colors]))
|
||||
print "char color_B[] = {%s};" % (",".join([x[2] for x in colors]))
|
||||
*/
|
||||
|
||||
char color_R[] = {0,2,5,7,10,12,15,17,20,22,25,28,30,33,35,38,40,42,42,41,40,39,38,36,34,31,29,26,22,19,15,11,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,13,24,35,47,58,70,83,95,108,121,135,149,163,177,192,207,214,216,219,221,224,226,229,232,234,237,239,242,244,247,249,252};
|
||||
char color_G[] = {0,0,0,1,2,3,5,7,9,12,15,18,22,25,29,34,39,43,45,48,51,53,56,58,61,63,66,68,71,73,76,79,81,84,86,89,91,94,96,99,102,104,107,109,112,114,117,119,122,124,127,122,116,110,104,98,91,84,76,69,61,52,44,35,26,16,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||
char color_B[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,8,14,20,27,33,40,48,55,63,71,80,89,98,107,117,127,130,132,135,137,140,142,145,147,150,153,155,158,160,163,165,168,170,173,175,178,181,183,186,188,191,193,196,198,201,204,206,209,211,205,195,184,173,161,149,137,125,112,99,86,72,58,44,29,15};
|
||||
|
||||
|
||||
int main() {
|
||||
|
||||
float x,xx,y,cx,cy;
|
||||
uint8_t iteration;
|
||||
uint8_t hx,hy;
|
||||
#define itermax 100 /* how many iterations to do */
|
||||
#define magnify 4.0 /* no magnification */
|
||||
#define hxres 128 /* horizonal resolution */
|
||||
#define hyres 128 /* vertical resolution */
|
||||
#define ydelta 0
|
||||
#define xdelta -0.75
|
||||
|
||||
uint8_t i;
|
||||
for (hy=1;hy<=hyres;hy++) {
|
||||
for (hx=1;hx<=hxres;hx++) {
|
||||
cx = (((float)hx)/((float)hxres)-0.5)/magnify*3.0-0.7;
|
||||
cy = (((float)hy)/((float)hyres)-0.5)/magnify*3.0;
|
||||
cx += xdelta;
|
||||
cy += ydelta;
|
||||
x = 0.0; y = 0.0;
|
||||
for (iteration=1; iteration < itermax; iteration++) {
|
||||
xx = x*x-y*y+cx;
|
||||
y = 2.0*x*y+cy;
|
||||
x = xx;
|
||||
if (x*x+y*y>128.0){
|
||||
i = iteration;
|
||||
iteration = itermax + 1;
|
||||
}
|
||||
}
|
||||
// Print a dot
|
||||
if (iteration<itermax+1) {
|
||||
setcolor(0,0,0);
|
||||
} else {
|
||||
setcolor(color_R[i],
|
||||
color_G[i],
|
||||
color_B[i]);
|
||||
}
|
||||
dot(hx-1, hy-1);
|
||||
}
|
||||
}
|
||||
|
||||
asm volatile ("break");
|
||||
}
|
||||
|
||||
/*
|
||||
check-name: Mandelbrot Set
|
||||
compiler-opts: -O3
|
||||
check-long: 1
|
||||
check-start:
|
||||
\def\avr@debug#1{}
|
||||
|
||||
\newcommand{\mydot}[3]{%
|
||||
\definecolor{avrfill}{RGB}{#3}%
|
||||
\node[minimum size = 1mm,%
|
||||
anchor=north west,
|
||||
inner sep=0,
|
||||
draw=avrfill,fill=avrfill]
|
||||
at (#1 mm,#2 mm) {};%
|
||||
}
|
||||
|
||||
\avr@instr@run
|
||||
|
||||
% Dump to .dat file
|
||||
\newwrite\coords
|
||||
\openout\coords=\jobname.coords.dat
|
||||
\newcommand{\mydump}[3]{%
|
||||
\edef\@tempa{#1,#2,#3}%
|
||||
\expandafter\write\expandafter\coords\expandafter{\@tempa}%
|
||||
}
|
||||
\avrdrawiter{\mydump}
|
||||
\closeout\coords
|
||||
|
||||
\begin{tikzpicture}[every node/.style={draw}]
|
||||
\avrdrawiter{\mydot}
|
||||
\end{tikzpicture}
|
||||
|
||||
check-end:
|
||||
*/
|
52
source/test-suite/mul.c
Normal file
52
source/test-suite/mul.c
Normal file
|
@ -0,0 +1,52 @@
|
|||
#include <avr/io.h>
|
||||
|
||||
volatile char foo[30];
|
||||
|
||||
int main() {
|
||||
foo[0] = 23;
|
||||
foo[1] = 42;
|
||||
// Should produce a mul
|
||||
foo[2] = foo[0] * foo[1];
|
||||
|
||||
// Contains a decrement (8 Bit Dividend)
|
||||
foo[3] = (unsigned char)((unsigned char )foo[1] / (unsigned char)foo[0]);
|
||||
|
||||
foo[4] = foo[1] % foo[0];
|
||||
|
||||
volatile uint16_t x = 1000;
|
||||
volatile uint16_t y = 55;
|
||||
|
||||
foo[5] = x * y;
|
||||
foo[20] = 165;
|
||||
|
||||
itoa((unsigned char)foo[20], &foo[6], 10);
|
||||
itoa((signed char)foo[20], &foo[9], 10);
|
||||
|
||||
|
||||
asm volatile ("break");
|
||||
}
|
||||
|
||||
/*
|
||||
check-name: Complex Memory Operations
|
||||
check-start:
|
||||
\avr@instr@stepn{100000}
|
||||
|
||||
\avr@test@MEM{96}{00010111} % 23
|
||||
\avr@test@MEM{97}{00101010} % 42
|
||||
\avr@test@MEM{98}{11000110} % 198
|
||||
|
||||
\avr@test@MEM{99}{00000001} % 1
|
||||
\avr@test@MEM{100}{00010011} % 19
|
||||
|
||||
\avr@test@MEM{101}{11011000} % 216
|
||||
|
||||
\avr@test@MEM{102}{00110001} % '1'
|
||||
\avr@test@MEM{103}{00110110} % '6'
|
||||
\avr@test@MEM{104}{00110101} % '5'
|
||||
|
||||
\avr@test@MEM{105}{00101101} % '-'
|
||||
\avr@test@MEM{106}{00111001} % '9'
|
||||
\avr@test@MEM{107}{00110001} % '1'
|
||||
|
||||
check-end:
|
||||
*/
|
69
source/test-suite/printf.c
Normal file
69
source/test-suite/printf.c
Normal file
|
@ -0,0 +1,69 @@
|
|||
#include <avr/io.h>
|
||||
#include <stdio.h>
|
||||
|
||||
char buffer[30];
|
||||
|
||||
volatile char buf[3];
|
||||
|
||||
static int uart_putchar(char c, FILE *stream);
|
||||
static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL,
|
||||
_FDEV_SETUP_WRITE);
|
||||
static int
|
||||
uart_putchar(char c, FILE *stream)
|
||||
{
|
||||
UDR = c;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
stdout = &mystdout;
|
||||
|
||||
buf[0] = 'x';
|
||||
buf[1] = 'y';
|
||||
buf[2] = '\0';
|
||||
|
||||
puts(buf);
|
||||
|
||||
|
||||
asm volatile("break;");
|
||||
|
||||
printf(":%c", buf[0]);
|
||||
|
||||
asm volatile("break;");
|
||||
|
||||
printf(":%d:", buf[1]);
|
||||
|
||||
asm volatile("break;");
|
||||
|
||||
volatile float x=0.23;
|
||||
printf(":%.2f:", x);
|
||||
|
||||
asm volatile("break;");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
check-name: Print to Stdout
|
||||
compiler-opts: -Wl,-u,vfprintf -lm -lprintf_flt
|
||||
check-start:
|
||||
|
||||
\avr@instr@stepn{100000}
|
||||
\avr@test@UDR{xy^10} % ^10 == \n
|
||||
\def\avr@UDR{}
|
||||
|
||||
\avr@instr@stepn{100000}
|
||||
\avr@test@UDR{:x}
|
||||
|
||||
\avr@instr@stepn{100000}
|
||||
\avr@test@UDR{:121:}
|
||||
|
||||
\avr@instr@stepn{100000}
|
||||
\avr@test@UDR{:0.23:}
|
||||
|
||||
check-end:
|
||||
**/
|
26
source/test-suite/shift.c
Normal file
26
source/test-suite/shift.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
#include <avr/io.h>
|
||||
|
||||
volatile char foo[30];
|
||||
|
||||
int main() {
|
||||
foo[0] = 5;
|
||||
foo[1] = 42;
|
||||
foo[2] = foo[1] >> foo[0];
|
||||
foo[3] = foo[1] << (foo[0]>>2);
|
||||
|
||||
|
||||
asm volatile ("break");
|
||||
}
|
||||
|
||||
/*
|
||||
check-name: Shift Operations
|
||||
check-start:
|
||||
\avr@instr@stepn{1000}
|
||||
|
||||
\avr@test@MEM{96}{00000101} % 5
|
||||
\avr@test@MEM{97}{00101010} % 42
|
||||
\avr@test@MEM{98}{00000001} % 0
|
||||
\avr@test@MEM{99}{01010100} % 42
|
||||
|
||||
check-end:
|
||||
*/
|
22
source/test-suite/string.c
Normal file
22
source/test-suite/string.c
Normal file
|
@ -0,0 +1,22 @@
|
|||
#include <avr/io.h>
|
||||
|
||||
// Produces LPM operations
|
||||
const char *foo = "abc";
|
||||
|
||||
int main() {
|
||||
char* p = foo;
|
||||
while (*p) {
|
||||
UDR = *p++;
|
||||
}
|
||||
|
||||
asm volatile ("break");
|
||||
}
|
||||
|
||||
/*
|
||||
check-name: String Operations
|
||||
check-start:
|
||||
\avr@instr@stepn{1000000}
|
||||
|
||||
\avr@test@UDR{abc}
|
||||
check-end:
|
||||
*/
|
23
source/test-suite/sum-rec.c
Normal file
23
source/test-suite/sum-rec.c
Normal file
|
@ -0,0 +1,23 @@
|
|||
#include <avr/io.h>
|
||||
|
||||
char sum(char n) {
|
||||
if (n <= 1) {
|
||||
return n;
|
||||
}
|
||||
return n + sum(n-1);
|
||||
}
|
||||
|
||||
int main() {
|
||||
UDR = sum(4);
|
||||
asm volatile ("break");
|
||||
}
|
||||
|
||||
/*
|
||||
check-name: Complex Memory Operations
|
||||
check-start:
|
||||
|
||||
\avr@instr@stepn{1000}
|
||||
\avr@test@REG{r24}{00001010}
|
||||
|
||||
check-end:
|
||||
*/
|
221
source/test-suite/test-suite
Executable file
221
source/test-suite/test-suite
Executable file
|
@ -0,0 +1,221 @@
|
|||
#!/bin/bash
|
||||
|
||||
#set -x
|
||||
|
||||
default_path=".."
|
||||
tests_list=`find . -name '*.c' | sed -e 's#^\./\(.*\)#\1#' | sort`
|
||||
prog_name=`basename $0`
|
||||
|
||||
# counts:
|
||||
# - tests that have not been converted to test-suite format
|
||||
# - tests that passed
|
||||
# - tests that failed
|
||||
# - tests that failed but are known to fail
|
||||
unhandled_tests=0
|
||||
ok_tests=0
|
||||
ko_tests=0
|
||||
known_ko_tests=0
|
||||
|
||||
|
||||
# defaults to not verbose
|
||||
[ -z "$V" ] && V=0
|
||||
|
||||
##
|
||||
# get_value(key, file) - gets the value of a (key, value) pair in file.
|
||||
#
|
||||
# returns 0 on success, 1 if the file does not have the key
|
||||
get_value()
|
||||
{
|
||||
last_result=`grep $1: $2 | sed -e "s/^.*$1:\(.*\)$/\1/"`
|
||||
[ -z "$last_result" ] && return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
##
|
||||
# get_tag(key, file) - does file has the tag key in it ?
|
||||
#
|
||||
# returns 0 if present, 1 otherwise
|
||||
get_tag()
|
||||
{
|
||||
last_result=`grep $1 $2`
|
||||
return $?
|
||||
}
|
||||
|
||||
##
|
||||
# verbose(string) - prints string if we are in verbose mode
|
||||
verbose()
|
||||
{
|
||||
[ "$V" -eq "1" ] && echo " $1"
|
||||
return 0
|
||||
}
|
||||
|
||||
##
|
||||
# error(string[, die]) - prints an error and exits with value die if given
|
||||
error()
|
||||
{
|
||||
echo " error: $1"
|
||||
[ -n "$2" ] && exit $2
|
||||
return 0
|
||||
}
|
||||
|
||||
do_usage()
|
||||
{
|
||||
echo "$prog_name - a tiny automatic testing script"
|
||||
echo "Usage: $prog_name [command] [command arguments]"
|
||||
echo
|
||||
echo "commands:"
|
||||
echo " none runs the whole test suite"
|
||||
echo " single file runs the test in 'file'"
|
||||
echo
|
||||
echo " help prints usage"
|
||||
}
|
||||
|
||||
##
|
||||
# do_test(file) - tries to validate a test case
|
||||
#
|
||||
# it "parses" file, looking for check-* tags and tries to validate
|
||||
# the test against an expected result
|
||||
# returns:
|
||||
# - 0 if the test passed,
|
||||
# - 1 if it failed,
|
||||
# - 2 if it is not a "test-suite" test.
|
||||
do_test()
|
||||
{
|
||||
test_failed=0
|
||||
file="$1"
|
||||
|
||||
# can this test be handled by test-suite ?
|
||||
# (it has to have a check-name key in it)
|
||||
get_value "check-name" $file
|
||||
if [ "$?" -eq 1 ]; then
|
||||
echo "warning: test '$file' unhandled"
|
||||
unhandled_tests=`expr $unhandled_tests + 1`
|
||||
return 2
|
||||
fi
|
||||
test_name=$last_result
|
||||
|
||||
echo -n "TEST $test_name ($file)"
|
||||
|
||||
cp HEADER "$file".tex
|
||||
get_value compiler-opts "$file"
|
||||
echo "\avrloadc[-Os -mmcu=atmega8 $last_result]{$file}" >> "$file".tex
|
||||
|
||||
awk '/check-start/,/check-end/ {print}' $file \
|
||||
| egrep -v 'check-(start|end)' >> "$file".tex
|
||||
cat FOOTER >> "$file".tex
|
||||
|
||||
|
||||
# grab the actual output & exit value
|
||||
stdbuf -oL pdflatex -halt-on-error -shell-escape "$file".tex 1> $file.output 2> $file.error
|
||||
actual_exit_value=$?
|
||||
rm -f *.log *.aux
|
||||
|
||||
if [ "$actual_exit_value" -ne 0 ]; then
|
||||
echo
|
||||
error " Actual exit value does not match the expected one."
|
||||
error " expected 0, got $actual_exit_value"
|
||||
if [ x"$V" = x"1" ]; then
|
||||
cat $file.output | sed 's/^/ /'
|
||||
else
|
||||
tail -n 10 $file.output | sed 's/^/ /'
|
||||
fi
|
||||
test_failed=1
|
||||
else
|
||||
get_value BREAK "$file".output
|
||||
echo " ($last_result)" | sed 's/ instructions//' | tr -d "\n"
|
||||
echo
|
||||
fi
|
||||
|
||||
if [ "$test_failed" -eq "1" ]; then
|
||||
ko_tests=`expr $ko_tests + 1`
|
||||
get_tag "check-known-to-fail" $file
|
||||
if [ "$?" -eq "0" ]; then
|
||||
echo "info: test '$file' is known to fail"
|
||||
known_ko_tests=`expr $known_ko_tests + 1`
|
||||
fi
|
||||
return 1
|
||||
else
|
||||
ok_tests=`expr $ok_tests + 1`
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
pwait() {
|
||||
# This functions blocks until less than $1 subprocesses are running
|
||||
jobs="$1"
|
||||
[ -z "$jobs" ] && jobs=5
|
||||
|
||||
while [ $(jobs -r | wc -l) -gt "$jobs" ]; do
|
||||
sleep 0.5
|
||||
done
|
||||
}
|
||||
|
||||
do_test_suite()
|
||||
{
|
||||
for i in $tests_list; do
|
||||
if get_value "check-long" "$i" > /dev/null; then
|
||||
echo "IGNORED $i (long running)"
|
||||
continue
|
||||
fi
|
||||
do_test "$i"
|
||||
done
|
||||
|
||||
# prints some numbers
|
||||
tests_nr=`expr $ok_tests + $ko_tests`
|
||||
echo -n "Out of $tests_nr tests, $ok_tests passed, $ko_tests failed"
|
||||
echo " ($known_ko_tests of them are known to fail)"
|
||||
if [ "$unhandled_tests" -ne "0" ]; then
|
||||
echo "$unhandled_tests tests could not be handled by $prog_name"
|
||||
fi
|
||||
}
|
||||
|
||||
##
|
||||
# arg_file(filename) - checks if filename exists
|
||||
arg_file()
|
||||
{
|
||||
[ -z "$1" ] && {
|
||||
do_usage
|
||||
exit 1
|
||||
}
|
||||
[ -e "$1" ] || {
|
||||
error "Can't open file $1"
|
||||
exit 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
'')
|
||||
do_test_suite
|
||||
if test `expr $ko_tests - $known_ko_tests` -gt 0; then
|
||||
for f in *.error.diff *.output.diff; do
|
||||
if test -s "$f"; then
|
||||
echo "Contents of $f:"
|
||||
cat "$f"
|
||||
echo "==="
|
||||
fi
|
||||
done
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
single)
|
||||
arg_file "$2"
|
||||
do_test "$2"
|
||||
case "$?" in
|
||||
0) echo "$2 passed !";;
|
||||
1) echo "$2 failed !";;
|
||||
2) echo "$2 can't be handled by $prog_name";;
|
||||
esac
|
||||
;;
|
||||
format)
|
||||
arg_file "$2"
|
||||
do_format "$2" "$3" "$4"
|
||||
;;
|
||||
help | *)
|
||||
do_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue