#!/bin/bash
set -e
tmpdir=$(mktemp -d)

cp -r /usr/share/doc/libddsc-dev/examples/helloworld "$tmpdir"
cd "$tmpdir/helloworld"
sed -i -e '/^cmake_minimum_required/a \
project(hello-world LANGUAGES C)
' CMakeLists.txt
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build .
timeout 20 ./HelloworldSubscriber > subscriber.log &
timeout 10 ./HelloworldPublisher
echo "==========================================="
cat subscriber.log

