Commit 1a1a1861 authored by Pavel Emelyanov's avatar Pavel Emelyanov

tests: Add new "real-life" test suit

The intention is to put here tests, that check how real apps
work. Initially I test that make -j4 works. This test is very
basic (uses sleep to wait for make to fork everybody) and a
syntetic .c file (quite big though).

Extend and use.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 956d28bb
all: foo1.o foo2.o foo3.o foo4.o
echo "Done"
%.o: %.c
gcc -c $< -o $@
foo%.c: tmpl.c
cp $< $@
clean:
rm -f *.o
#!/bin/bash
crtools="../../../crtools"
cleanup_wd() {
rm -f "ref-*"
make clean
}
set -x
echo "Creating reference objects"
cleanup_wd
setsid make || exit 1
for f in *.o; do
mv "$f" "ref-${f//.o/}";
done
rm -rf dump
mkdir dump
setsid make clean || exit 1
setsid make -j4 &
pid=${!}
echo Lanuched make in $pid background
sleep 2
${crtools} dump -D dump -o dump.log -v 4 -t ${pid} || {
echo "Dump failed"
exit 1
}
echo "Dumped, restoring and waiting for completion"
${crtools} restore -D dump -o restore.log -v 4 -t ${pid} || {
echo "Restore failed"
exit 1
}
for f in ref-*; do
if ! cmp "$f" "${f//ref-/}.o"; then
echo "$f mismatch"
echo "FAIL"
cleanup_wd
exit 1
fi
done
cleanup_wd
echo PASS
int foo(int a, int b)
{
#define A0(a, b) ((a)+(b))
#define A1(a, b) ((a)>(b))?A0((a)-(b), (b)):A0((b)-(a), (a))
#define A2(a, b) ((a)>(b))?A1((a)-(b), (b)):A1((b)-(a), (a))
#define A3(a, b) ((a)>(b))?A2((a)-(b), (b)):A2((b)-(a), (a))
#define A4(a, b) ((a)>(b))?A3((a)-(b), (b)):A3((b)-(a), (a))
#define A5(a, b) ((a)>(b))?A4((a)-(b), (b)):A4((b)-(a), (a))
#define A6(a, b) ((a)>(b))?A5((a)-(b), (b)):A5((b)-(a), (a))
#define A7(a, b) ((a)>(b))?A6((a)-(b), (b)):A6((b)-(a), (a))
#define A8(a, b) ((a)>(b))?A7((a)-(b), (b)):A7((b)-(a), (a))
#define A9(a, b) ((a)>(b))?A8((a)-(b), (b)):A8((b)-(a), (a))
#define A10(a, b) ((a)>(b))?A9((a)-(b), (b)):A9((b)-(a), (a))
#define A11(a, b) ((a)>(b))?A10((a)-(b), (b)):A10((b)-(a), (a))
return A10(a, b);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment