Skip to content

Commit

Permalink
Avoid unnecessary rebuilds for test.sh (#322)
Browse files Browse the repository at this point in the history
Due to the source binary in `nnfusion/build` shared by all the
docker containers, they could just install the tools into their
environment without rebuild the same source every time.

Simplify the commands in `build.sh` also.
  • Loading branch information
colinyoyo26 authored Nov 12, 2021
1 parent cb7b03a commit 31f688f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
16 changes: 5 additions & 11 deletions maint/script/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ else
fi

# build the repo
if [ ! -d "$THIS_SCRIPT_DIR/../../build" ]; then
mkdir $THIS_SCRIPT_DIR/../../build
fi
mkdir -p $THIS_SCRIPT_DIR/../../build

pushd $THIS_SCRIPT_DIR/../../build/ > /dev/null
pushd $THIS_SCRIPT_DIR/../../build > /dev/null
cmake ..
popd > /dev/null

Expand All @@ -35,9 +33,7 @@ else
fi

# Make
pushd $THIS_SCRIPT_DIR/../../build/ > /dev/null
make -j$(nproc)
popd > /dev/null
cmake --build $THIS_SCRIPT_DIR/../../build -j$(nproc)

if [ $? -ne 0 ]; then
echo "Build failed."
Expand All @@ -48,14 +44,12 @@ fi

if [ -f "/.dockerenv" ]; then
# Make install
pushd $THIS_SCRIPT_DIR/../../build/ > /dev/null
make install
popd > /dev/null
cmake --install $THIS_SCRIPT_DIR/../../build

if [ $? -ne 0 ]; then
echo "Install failed."
exit 1
else
echo "Install succeded."
fi
fi
fi
6 changes: 5 additions & 1 deletion maint/script/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ create_rocm_container(){

# check if inside one docker container(for testing)
if [ -f "/.dockerenv" ]; then
$THIS_SCRIPT_DIR/build.sh
cmake --install $THIS_SCRIPT_DIR/../../build > /dev/null
if [ $? -ne 0 ]; then
echo "install failed"
exit 1
fi
python3 $THIS_SCRIPT_DIR/../../test/nnfusion/scripts/e2e_tests.py
else

Expand Down

0 comments on commit 31f688f

Please sign in to comment.