Skip to content

Commit

Permalink
testing: Make sure that integration tests fail when crx cannot be cre…
Browse files Browse the repository at this point in the history
…ated

Previously the error was almost silently ignored resulting in testing
the crx file that was in that directory before.
  • Loading branch information
Libor Polčák committed Sep 15, 2023
1 parent 6565eee commit 362f5ce
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
18 changes: 16 additions & 2 deletions tests/common_files/scripts/build_JSR_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#

FIREFOX_XPI_PATH="./tests/common_files/JShelter/firefox.xpi"
CHROME_CRX_PATH="./tests/common_files/JShelter/chrome.crx"

# Go to root directory of JShelter project.
cd ../../../

Expand All @@ -37,23 +40,34 @@ make

# Create directory for JShelter package if does not exists.
mkdir -p ./tests/common_files/JShelter
rm -f "$FIREFOX_XPI_PATH" "$CHROME_CRX_PATH"

# Create xpi package of JShelter for Mozilla Firefox from zip archive created by make.
cp -f ./jshelter_firefox.zip ./tests/common_files/JShelter/firefox.xpi
cp -f ./jshelter_firefox.zip "$FIREFOX_XPI_PATH"

# Create crx package of JShelter for Google Chrome from source files.
if command -v google-chrome &> /dev/null
then
google-chrome --pack-extension=./build/chrome >/dev/null 2>&1
EXIT="$?"
if [ "$EXIT" != "0" ]; then
echo "ERROR!!! Cannot pack extension" >&2
exit $EXIT
fi
else
chromium --pack-extension=./build/chrome >/dev/null 2>&1
EXIT="$?"
if [ "$EXIT" != "0" ]; then
echo "ERROR!!! Cannot pack extension" >&2
exit $EXIT
fi
fi

# Remove unnecessary file created during crx package creating.
rm -rf ./build/chrome.pem

# Move crx package of JShelter to right location (same as xpi package of JShelter).
mv -f ./build/chrome.crx ./tests/common_files/JShelter/chrome.crx
mv -f ./build/chrome.crx "$CHROME_CRX_PATH"

# Go back to common scripts directory.
cd ./tests/common_files/scripts
4 changes: 4 additions & 0 deletions tests/integration_tests/start_integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ fi

# Run script build_JSR_package.sh
./build_JSR_package.sh
if [ "$?" != 0 ]; then
echo "ERROR!!! Please check errors above" >&2
exit
fi

# Go to JSR project root directory directory and save PWD.
cd ../../../
Expand Down

0 comments on commit 362f5ce

Please sign in to comment.