File: create_pbf_test_data.sh

package info (click to toggle)
protozero 1.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,548 kB
  • sloc: cpp: 20,364; sh: 18; makefile: 14
file content (35 lines) | stat: -rwxr-xr-x 780 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
#
#  create_pbf_test_data.sh [TESTCASE]
#
#  This script creates the test data for the given test case in protobuf format
#  using the testcase.proto description and the testcase.cpp code.
#
#  If called without a test case it will iterate over all test cases generating
#  all data.
#
#  This program should be called with the "test" directory as current directory.
#

set -e

if [ -z "$CXX" ]; then
    echo "Please set CXX before running this script"
    exit 1
fi

if [ -z "$1" ]; then
    for dir in t/*; do
        $0 $dir
    done
fi

echo "Generating $1..."
cd $1
if [ -f testcase.proto ]; then
    protoc --cpp_out=. testcase.proto
    $CXX -std=c++11 -I../../include -o testcase testcase.cpp testcase.pb.cc -lprotobuf-lite -pthread
    ./testcase
fi
cd ../..