Skip to content

Commit

Permalink
Have LAVA point to a local host version, I will worry about Docker ve…
Browse files Browse the repository at this point in the history
…rsion later
  • Loading branch information
AndrewQuijano committed Aug 10, 2024
1 parent cbf87e1 commit 646276a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
23 changes: 11 additions & 12 deletions scripts/add_queries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ tar xf "$tarfile"

progress "queries" 0 "Entering $source."
cd "$source"
chown -R root:root .

progress "queries" 0 "Creating git repo."
rm -rf .git || true #Remove any existing git repo
Expand Down Expand Up @@ -103,11 +102,11 @@ read -ra MAKES <<< $makecmd
for i in ${MAKES[@]}; do
IFS=' '
read -ra ARGS <<< $i
echo "/tools/btrace/sw-btrace ${ARGS[@]}"
echo "$lava/tools/btrace/sw-btrace ${ARGS[@]}"
CC=/usr/lib/llvm-11/bin/clang \
CXX=/usr/lib/llvm-11/bin/clang++ \
CFLAGS="-O0 -m32 -DHAVE_CONFIG_H -g -gdwarf-2 -fno-stack-protector -D_FORTIFY_SOURCE=0 -I. -I.. -I../include -I./src/" \
/tools/btrace/sw-btrace ${ARGS[@]}
$lava/tools/btrace/sw-btrace ${ARGS[@]}
IFS='&&'
done
IFS=$ORIGIN_IFS
Expand All @@ -120,7 +119,7 @@ bash -c $install
progress "queries" 0 "Creating compile_commands.json..."
# Delete any pre-existing compile commands.json (could be in archive by mistake)
rm -f compile_commands.json
/tools/btrace/sw-btrace-to-compiledb /usr/lib/llvm-11/lib/clang/11/include
$lava/tools/btrace/sw-btrace-to-compiledb /usr/lib/llvm-11/lib/clang/11/include
if [ -e "$directory/$name/extra_compile_commands.json" ]; then
sed -i '$d' compile_commands.json
echo "," >> compile_commands.json
Expand All @@ -131,14 +130,14 @@ git commit -m 'Add compile_commands.json.'

cd ..

c_files=$($python /tools/lavaTool/get_c_files.py $source)
c_files=$($python $lava/tools/lavaTool/get_c_files.py $source)
c_dirs=$(for i in $c_files; do dirname $i; done | sort | uniq)

progress "queries" 0 "Copying include files..."
for i in $c_dirs; do
echo " $i"
if [ -d $i ]; then
cp /tools/include/*.h $i/
cp $lava/tools/include/*.h $i/
fi
done

Expand All @@ -147,7 +146,7 @@ done
# i.e., which have only prototypes, which have bodies.
progress "queries" 0 "Figure out functions"
for this_c_file in $c_files; do
/tools/install/bin/lavaFnTool $this_c_file
$lava/tools/install/bin/lavaFnTool $this_c_file
done

#progress "queries" 0 "Initialize variables..."
Expand All @@ -167,8 +166,8 @@ fnfiles=$(echo $c_files | sed 's/\.c/\.c\.fn/g')
fninstr=$directory/$name/fninstr

echo "Creating fninstr [$fninstr]"
echo -e "\twith command: \"python fninstr.py -d -o $fninstr $fnfiles\""
$python fninstr.py -d -o $fninstr $fnfiles
echo -e "\twith command: \"python $lava/scripts/fninstr.py -d -o $fninstr $fnfiles\""
$python $lava/scripts/fninstr.py -d -o $fninstr $fnfiles

if [[ ! -z "$df_fn_blacklist" ]]; then
cmd=$(echo "sed -i /${df_fn_blacklist}/d $fninstr")
Expand All @@ -182,7 +181,7 @@ if [ "$dataflow" = "true" ]; then
# Since it's okay to pass the whitelist either way
progress "queries" 0 "Inserting queries for dataflow"
for i in $c_files; do
/tools/install/bin/lavaTool -action=query \
$lava/tools/install/bin/lavaTool -action=query \
-lava-db="$directory/$name/lavadb" \
-p="$directory/$name/$source/compile_commands.json" \
-arg_dataflow \
Expand All @@ -196,7 +195,7 @@ else
progress "queries" 0 "Inserting queries..."
# TODO: remove lava-wl here, unless we're using it to limit where we inject
for i in $c_files; do
/tools/install/bin/lavaTool -action=query \
$lava/tools/install/bin/lavaTool -action=query \
-lava-db="$directory/$name/lavadb" \
-lava-wl="$fninstr" \
-p="$source/compile_commands.json" \
Expand All @@ -210,7 +209,7 @@ fi
# Do we need to explicitly apply replacements in the root source directory
# This causes clang-apply-replacements to segfault when run a 2nd time
#pushd "$directory/$name/$source"
#/usr/lib/llvm-11/bin//clang-apply-replacements .
#/usr/lib/llvm-11/bin/clang-apply-replacements .
#popd

for i in $c_dirs; do
Expand Down
6 changes: 3 additions & 3 deletions scripts/lava.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ fi

if [[ $demo -eq 1 ]]
then
gnome-terminal --geometry=90x40 -x bash -c "python $(dirname $0)/demo.py $json; read" &
gnome-terminal --geometry=90x40 -x bash -c "$python $(dirname $0)/demo.py $json; read" &
fi

progress "everything" 1 "JSON file is $json"
Expand Down Expand Up @@ -134,7 +134,7 @@ RESET_DB() {
progress "everything" 1 "Resetting lava db -- logging to $lf"
run_remote "$buildhost" "dropdb -U postgres -h database $db || true" "$lf"
run_remote "$buildhost" "createdb -U postgres -h database $db || true" "$lf"
run_remote "$buildhost" "psql -d $db -h database -f /tools/lavaODB/generated/lava.sql -U postgres" "$lf"
run_remote "$buildhost" "psql -d $db -h database -f $lava/tools/lavaODB/generated/lava.sql -U postgres" "$lf"
run_remote "$buildhost" "echo dbwipe complete" "$lf"
}

Expand Down Expand Up @@ -164,7 +164,7 @@ if [ $add_queries -eq 1 ]; then
lf="$logs/add_queries.log"
truncate "$lf"
progress "everything" 1 "Adding queries to source with type $ATP and $project_name -- logging to $lf"
run_remote "$buildhost" "'add_queries.sh $ATP_TYPE $project_name'" "$lf"
run_remote "$buildhost" "'$scripts/add_queries.sh $ATP_TYPE $project_name'" "$lf"
if [ "$fixupscript" != "null" ]; then
lf="$logs/fixups.log"
truncate "$lf"
Expand Down
5 changes: 3 additions & 2 deletions scripts/vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ if [ "$(jq -r .injfixupsscript $json)" != "null" ]; then
injfixupsscript="${injfixupsscript/\{bug_build\}/$bug_build}"
fi

buildhost="$(jq -r '.buildhost // "docker"' $json)"
# buildhost="$(jq -r '.buildhost // "docker"' $json)"
buildhost="localhost"
pandahost="$(jq -r '.pandahost // "docker"' $json)"
testinghost="$(jq -r '.testinghost // "docker"' $json)"
logs="$output_dir/$name/logs"
Expand All @@ -79,7 +80,7 @@ configure_cmd=$(jq -r '.configure // "/bin/true"' $json)
container="$(jq -r '.docker // "lava32"' $json)"

# Constants
scripts="/scripts"
scripts="$lava/scripts"
python="/usr/bin/python3"
pdb="/usr/bin/python3 -m pdb "
dockername="lava32"

0 comments on commit 646276a

Please sign in to comment.