summaryrefslogtreecommitdiffstats
path: root/src/script/gen-corpus.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/script/gen-corpus.sh
parentInitial commit. (diff)
downloadceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz
ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/script/gen-corpus.sh')
-rwxr-xr-xsrc/script/gen-corpus.sh101
1 files changed, 101 insertions, 0 deletions
diff --git a/src/script/gen-corpus.sh b/src/script/gen-corpus.sh
new file mode 100755
index 000000000..ad2ef09f1
--- /dev/null
+++ b/src/script/gen-corpus.sh
@@ -0,0 +1,101 @@
+#!/usr/bin/env bash
+# -*- mode:sh; tab-width:4; sh-basic-offset:4; indent-tabs-mode:nil -*-
+# vim: softtabstop=4 shiftwidth=4 expandtab
+
+set -ex
+
+function get_jobs() {
+ local jobs=$(nproc)
+ if [ $jobs -ge 8 ] ; then
+ echo 8
+ else
+ echo $jobs
+ fi
+}
+
+[ -z "$BUILD_DIR" ] && BUILD_DIR=build
+
+function build() {
+ local encode_dump_path=$1
+ shift
+
+ ./do_cmake.sh \
+ -DWITH_MGR_DASHBOARD_FRONTEND=OFF \
+ -DWITH_DPDK=OFF \
+ -DWITH_SPDK=OFF \
+ -DCMAKE_CXX_FLAGS="-DENCODE_DUMP_PATH=${encode_dump_path}"
+ cd ${BUILD_DIR}
+ cmake --build . -- -j$(get_jobs)
+}
+
+function run() {
+ MON=3 MGR=2 OSD=3 MDS=3 RGW=1 ../src/vstart.sh -n -x
+
+ local old_path="$PATH"
+ export PATH="bin:$PATH"
+ ceph osd pool create mypool
+ rados -p mypool bench 10 write -b 123
+ ceph osd out 0
+ ceph osd in 0
+ init-ceph restart osd.1
+ for f in ../qa/workunits/cls/*.sh ; do
+ $f
+ done
+ ../qa/workunits/rados/test.sh
+ ceph_test_librbd
+ ceph_test_libcephfs
+ init-ceph restart mds.a
+ ../qa/workunits/rgw/run-s3tests.sh
+ PATH="$old_path"
+
+ ../src/stop.sh
+}
+
+function import_corpus() {
+ local encode_dump_path=$1
+ shift
+ local version=$1
+ shift
+
+ # import the corpus
+ ../src/test/encoding/import.sh \
+ ${encode_dump_path} \
+ ${version} \
+ ../ceph-object-corpus/archive
+ ../src/test/encoding/import-generated.sh \
+ ../ceph-object-corpus/archive
+ # prune it
+ pushd ../ceph-object-corpus
+ bin/prune-archive.sh
+ popd
+}
+
+function verify() {
+ ctest -R readable.sh
+}
+
+function commit_and_push() {
+ local version=$1
+ shift
+
+ pushd ../ceph-object-corpus
+ git checkout -b wip-${version}
+ git add archive/${version}
+ git commit --signoff --message=${version}
+ git remote add cc git@github.com:ceph/ceph-object-corpus.git
+ git push cc wip-${version}
+ popd
+}
+
+encode_dump_path=$(mktemp -d)
+build $encode_dump_path
+echo "generating corpus objects.."
+run
+version=$(bin/ceph-dencoder version)
+echo "importing corpus. it may take over 30 minutes.."
+import_corpus $encode_dump_path $version
+echo "verifying imported corpus.."
+verify
+echo "all good, pushing to remote repo.."
+commit_and_push ${version}
+rm -rf encode_dump_path