Skip to content

Commit 4066df0

Browse files
committed
feat: Add bash script to build and run fuzz testing
1 parent 0ba787f commit 4066df0

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

fuzz-testing/run.sh

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/bin/bash
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
#
20+
21+
set -eu
22+
23+
SPARK_MASTER="${SPARK_MASTER:-local[*]}"
24+
PROJECT_VERSION="$(mvn -q help:evaluate -Dexpression=project.version -DforceStdout)"
25+
COMET_SPARK_JAR="../spark/target/$(mvn -f ../spark/pom.xml -q help:evaluate -Dexpression=project.artifactId -DforceStdout)-${PROJECT_VERSION}.jar"
26+
COMET_FUZZ_JAR="target/$(mvn -q help:evaluate -Dexpression=project.artifactId -DforceStdout)-${PROJECT_VERSION}-jar-with-dependencies.jar"
27+
NUM_FILES="${NUM_FILES:-2}"
28+
NUM_ROWS="${NUM_ROWS:-200}"
29+
NUM_QUERIES="${NUM_QUERIES:-500}"
30+
31+
if [ ! -f "${COMET_SPARK_JAR}" ]; then
32+
echo "Building Comet Spark jar..."
33+
cd ..
34+
mvn install -DskipTests
35+
cd fuzz-testing
36+
else
37+
echo "Building Fuzz testing jar..."
38+
mvn package -DskipTests
39+
fi
40+
41+
echo "Generating data..."
42+
"${SPARK_HOME}/bin/spark-submit" \
43+
--master "${SPARK_MASTER}" \
44+
--class org.apache.comet.fuzz.Main \
45+
"${COMET_FUZZ_JAR}" \
46+
data --num-files="${NUM_FILES}" --num-rows="${NUM_ROWS}" \
47+
--exclude-negative-zero \
48+
--generate-arrays --generate-structs --generate-maps
49+
50+
echo "Generating queries..."
51+
"${SPARK_HOME}/bin/spark-submit" \
52+
--master "${SPARK_MASTER}" \
53+
--class org.apache.comet.fuzz.Main \
54+
"${COMET_FUZZ_JAR}" \
55+
queries --num-files="${NUM_FILES}" --num-queries="${NUM_QUERIES}"
56+
57+
echo "Running fuzz tests..."
58+
"${SPARK_HOME}/bin/spark-submit" \
59+
--master "${SPARK_MASTER}" \
60+
--conf spark.memory.offHeap.enabled=true \
61+
--conf spark.memory.offHeap.size=16G \
62+
--conf spark.plugins=org.apache.spark.CometPlugin \
63+
--conf spark.comet.enabled=true \
64+
--conf spark.shuffle.manager=org.apache.spark.sql.comet.execution.shuffle.CometShuffleManager \
65+
--conf spark.comet.exec.shuffle.enabled=true \
66+
--jars "${COMET_SPARK_JAR}" \
67+
--conf spark.driver.extraClassPath="${COMET_SPARK_JAR}" \
68+
--conf spark.executor.extraClassPath="${COMET_SPARK_JAR}" \
69+
--class org.apache.comet.fuzz.Main \
70+
"${COMET_FUZZ_JAR}" \
71+
run --num-files="${NUM_FILES}" --filename="queries.sql"

0 commit comments

Comments
 (0)