зеркало из https://github.com/mozilla/rappor.git
Add sensible defaults if no argument is specified.
This commit is contained in:
Родитель
bf2c2448eb
Коммит
1011487aab
41
bin/test.sh
41
bin/test.sh
|
@ -1,17 +1,20 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Simple smoke test for the decode-dist tool. This will fail if your machine
|
||||
# doesn't have the right R libraries.
|
||||
#
|
||||
# Usage:
|
||||
# ./test.sh <function name>
|
||||
#
|
||||
# Example:
|
||||
# ./test.sh write-assoc-testdata # write data needed for R and C++ tests
|
||||
# ./test.sh decode-assoc-R-smoke # test pure R implementation
|
||||
# ./test.sh decode-assoc-cpp-smoke # test with analysis/cpp/fast_em.cc
|
||||
# ./test.sh decode-assoc-cpp-converge # run for longer with C++
|
||||
# ./test.sh decode-assoc-tensorflow
|
||||
usage() {
|
||||
echo "
|
||||
|
||||
Simple smoke test for the decode-dist tool. This will fail if your machine
|
||||
doesn't have the right R libraries.
|
||||
|
||||
Usage:
|
||||
./test.sh <function name>
|
||||
|
||||
Example:
|
||||
./test.sh decode-assoc-R-smoke # test pure R implementation
|
||||
./test.sh decode-assoc-cpp-smoke # test with analysis/cpp/fast_em.cc
|
||||
./test.sh decode-assoc-cpp-converge # run for longer with C++
|
||||
./test.sh decode-assoc-tensorflow
|
||||
"
|
||||
}
|
||||
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
@ -32,10 +35,6 @@ clear-cached-files() {
|
|||
find $dir -name '*.rda' | xargs --no-run-if-empty -- rm --verbose
|
||||
}
|
||||
|
||||
decode-dist-help() {
|
||||
time $RAPPOR_SRC/bin/decode-dist --help
|
||||
}
|
||||
|
||||
write-dist-testdata() {
|
||||
local input_dir=$DIST_TESTDATA_DIR/input
|
||||
|
||||
|
@ -53,6 +52,8 @@ write-dist-testdata() {
|
|||
}
|
||||
|
||||
decode-dist() {
|
||||
write-dist-testdata
|
||||
|
||||
local output_dir=$DIST_TESTDATA_DIR
|
||||
|
||||
local input_dir=$DIST_TESTDATA_DIR/input
|
||||
|
@ -70,10 +71,6 @@ decode-dist() {
|
|||
cat $output_dir/metrics.json
|
||||
}
|
||||
|
||||
decode-assoc-help() {
|
||||
time $RAPPOR_SRC/bin/decode-assoc --help
|
||||
}
|
||||
|
||||
write-assoc-testdata() {
|
||||
# 'build' has intermediate build files, 'input' is the final input to the
|
||||
# decode-assoc tool.
|
||||
|
@ -166,6 +163,8 @@ EOF
|
|||
|
||||
# Helper function to run decode-assoc with testdata.
|
||||
decode-assoc-helper() {
|
||||
write-assoc-testdata
|
||||
|
||||
local output_dir=$1
|
||||
shift
|
||||
|
||||
|
|
13
build.sh
13
build.sh
|
@ -23,7 +23,7 @@ die() {
|
|||
}
|
||||
|
||||
run-markdown() {
|
||||
which markdown >/dev/null || die "Markdown not installed"
|
||||
md=`which markdown || echo "echo"`
|
||||
|
||||
# Markdown is output unstyled; make it a little more readable.
|
||||
cat <<EOF
|
||||
|
@ -41,7 +41,7 @@ run-markdown() {
|
|||
<!-- INSERT LATCH HTML -->
|
||||
EOF
|
||||
|
||||
markdown "$@"
|
||||
$md "$@"
|
||||
|
||||
cat <<EOF
|
||||
</body>
|
||||
|
@ -108,4 +108,11 @@ cpp-client() {
|
|||
popd
|
||||
}
|
||||
|
||||
"$@"
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
cpp-client
|
||||
doc
|
||||
fastrand
|
||||
else
|
||||
"$@"
|
||||
fi
|
||||
|
|
7
demo.sh
7
demo.sh
|
@ -102,4 +102,9 @@ ok-case() {
|
|||
run-dist exp 10000 10 'v1|v2'
|
||||
}
|
||||
|
||||
"$@"
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
quick
|
||||
else
|
||||
"$@"
|
||||
fi
|
||||
|
|
72
regtest.sh
72
regtest.sh
|
@ -1,39 +1,40 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Run end-to-end tests in parallel.
|
||||
#
|
||||
# Usage:
|
||||
# ./regtest.sh <function name>
|
||||
usage() {
|
||||
echo "
|
||||
Run end-to-end tests in parallel.
|
||||
|
||||
# At the end, it will print an HTML summary.
|
||||
#
|
||||
# Three main functions are
|
||||
# run [[<pattern> [<num> [<fast>]] - run tests matching <pattern> in
|
||||
# parallel, each <num> times. The fast
|
||||
# mode (T/F) shortcuts generation of
|
||||
# reports.
|
||||
# run-seq [<pattern> [<num> [<fast>]] - ditto, except that tests are run
|
||||
# sequentially
|
||||
# run-all [<num>] - run all tests, in parallel, each <num> times
|
||||
#
|
||||
# Examples:
|
||||
# $ ./regtest.sh run-seq unif-small-typical # Sequential run, matches 1 case
|
||||
# $ ./regtest.sh run-seq unif-small- 3 F # Sequential, each test is run three
|
||||
# times, using slow generation
|
||||
# $ ./regtest.sh run unif- # Parallel run, matches multiple cases
|
||||
# $ ./regtest.sh run unif- 5 # Parallel run, matches multiple cases, each test
|
||||
# is run 5 times
|
||||
# $ ./regtest.sh run-all # Run all tests once
|
||||
#
|
||||
# The <pattern> argument is a regex in 'grep -E' format. (Detail: Don't
|
||||
# use $ in the pattern, since it matches the whole spec line and not just the
|
||||
# test case name.) The number of processors used in a parallel run is one less
|
||||
# than the number of CPUs on the machine.
|
||||
Usage:
|
||||
./regtest.sh <function name>
|
||||
At the end, it will print an HTML summary.
|
||||
|
||||
Three main functions are
|
||||
run [[<pattern> [<num> [<fast>]] - run tests matching <pattern> in
|
||||
parallel, each <num> times. The fast
|
||||
mode (T/F) shortcuts generation of
|
||||
reports.
|
||||
run-seq [<pattern> [<num> [<fast>]] - ditto, except that tests are run
|
||||
sequentially
|
||||
run-all [<num>] - run all tests, in parallel, each <num> times
|
||||
|
||||
Examples:
|
||||
$ ./regtest.sh run-seq unif-small-typical # Sequential run, matches 1 case
|
||||
$ ./regtest.sh run-seq unif-small- 3 F # Sequential, each test is run three
|
||||
times, using slow generation
|
||||
$ ./regtest.sh run unif- # Parallel run, matches multiple cases
|
||||
$ ./regtest.sh run unif- 5 # Parallel run, matches multiple cases, each test
|
||||
is run 5 times
|
||||
$ ./regtest.sh run-all # Run all tests once
|
||||
|
||||
# Future speedups:
|
||||
# - Reuse the same input -- come up with naming scheme based on params
|
||||
# - Reuse the same maps -- ditto, rappor library can cache it
|
||||
The <pattern> argument is a regex in 'grep -E' format. (Detail: Don't
|
||||
use $ in the pattern, since it matches the whole spec line and not just the
|
||||
test case name.) The number of processors used in a parallel run is one less
|
||||
than the number of CPUs on the machine.
|
||||
|
||||
Future speedups:
|
||||
- Reuse the same input -- come up with naming scheme based on params
|
||||
- Reuse the same maps -- ditto, rappor library can cache it
|
||||
"
|
||||
}
|
||||
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
@ -461,4 +462,9 @@ compare-python-cpp() {
|
|||
head _tmp/{python,cpp}/demo3/1/case_reports.csv
|
||||
}
|
||||
|
||||
"$@"
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
usage
|
||||
else
|
||||
"$@"
|
||||
fi
|
||||
|
|
67
run.sh
67
run.sh
|
@ -1,67 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Miscellaneous scripts.
|
||||
#
|
||||
# Usage:
|
||||
# ./run.sh <function name>
|
||||
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
set -o errexit
|
||||
|
||||
. util.sh
|
||||
|
||||
# Count lines of code
|
||||
count() {
|
||||
# exclude _tmp dirs, and include Python, C, C++, R, shell
|
||||
find . \
|
||||
\( -name _tmp -a -prune \) -o \
|
||||
\( -name \*.py -a -print \) -o \
|
||||
\( -name \*.c -a -print \) -o \
|
||||
\( -name \*.h -a -print \) -o \
|
||||
\( -name \*.cc -a -print \) -o \
|
||||
\( -name \*.R -a -print \) -o \
|
||||
\( -name \*.sh -a -print \) \
|
||||
| xargs wc -l | sort -n
|
||||
}
|
||||
|
||||
#
|
||||
# Publish docs
|
||||
#
|
||||
|
||||
readonly DOC_DEST=../rappor-gh-pages
|
||||
|
||||
assert-dest() {
|
||||
test -d $DOC_DEST || die \
|
||||
"This requires that the RAPPOR repo is cloned into $DOC_DEST"
|
||||
}
|
||||
|
||||
publish-report() {
|
||||
assert-dest
|
||||
|
||||
local dest=$DOC_DEST/examples
|
||||
mkdir -p $dest
|
||||
|
||||
cp --verbose --recursive \
|
||||
_tmp/report.html \
|
||||
_tmp/*_report \
|
||||
$dest
|
||||
|
||||
echo "Now switch to $DOC_DEST, commit, and push."
|
||||
}
|
||||
|
||||
publish-doc() {
|
||||
assert-dest
|
||||
|
||||
local dest=$DOC_DEST/doc
|
||||
mkdir -p $dest
|
||||
|
||||
cp --verbose \
|
||||
_tmp/doc/*.html \
|
||||
_tmp/doc/*.png \
|
||||
$dest
|
||||
|
||||
echo "Now switch to $DOC_DEST, commit, and push."
|
||||
}
|
||||
|
||||
"$@"
|
9
setup.sh
9
setup.sh
|
@ -21,7 +21,7 @@ native-packages() {
|
|||
# - python-dev is for building the fastrand extension
|
||||
#
|
||||
# NOTE: we get R 3.0.2 on Trusty.
|
||||
sudo apt-get install build-essential gfortran libblas-dev r-base python-dev
|
||||
sudo apt-get install build-essential gfortran libblas-dev r-base python-dev graphviz
|
||||
}
|
||||
|
||||
r-packages() {
|
||||
|
@ -81,4 +81,9 @@ shiny-smoke-test() {
|
|||
# Then set up a "firewall rule" in console.developers.google.com to open up
|
||||
# "tcp:6789". Test it from the outside.
|
||||
|
||||
"$@"
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
install-most
|
||||
else
|
||||
"$@"
|
||||
fi
|
||||
|
|
7
test.sh
7
test.sh
|
@ -162,4 +162,9 @@ gen-true-values() {
|
|||
cat $out
|
||||
}
|
||||
|
||||
"$@"
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
all
|
||||
else
|
||||
"$@"
|
||||
fi
|
||||
|
|
Загрузка…
Ссылка в новой задаче