Skip to content

Commit

Permalink
Fixing generateCI & sanity check (renamed) scripts. Added comments. E…
Browse files Browse the repository at this point in the history
…nhanced README.
  • Loading branch information
fdodino committed May 24, 2019
1 parent 5db5b24 commit d1daf18
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ language: generic
sudo: required

script:
- chmod 777 ./sanityCheck.sh ./runTests.sh ./runPrograms.sh
- ./sanityCheck.sh
- chmod 777 ./wsanity-check.sh ./runTests.sh ./runPrograms.sh
- ./wsanity-check.sh

8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,16 @@ This is the way you should call the script:
generateCI.sh ../wollok-dev/wollok
```

Or, if you are in `wollok-dev/wollok` folder, simply run

```bash
generateCI.sh .
```

Don't add the trailing `/` character for wollok root folder. After running the script, you can tests if everything went smooth:

```bash
sanityCheck.sh
wsanity-check.sh
```

## Another useful scripts
Expand Down
18 changes: 10 additions & 8 deletions generateCI.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,21 @@ if [ -z $1 ]
echo -e "https://github.com/uqbar-project/wollok/wiki/Development---Environment-Setup"
echo -e "and make sure you run 'mvn clean install' first."
echo -e "Example: if you have a sibling folder wollok-dev and inside you have a wollok directory, call it"
echo -e "$ ./generateCI.sh ../wollok-dev/wollok"
echo -e "$ generateCI.sh ../wollok-dev/wollok"
echo -e "(without the trailing /)"
exit 1
fi

JARS_FOLDER=./jars/

# Folders initialization
CLI_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
JARS_FOLDER=$CLI_DIR/jars/
mkdir -p $JARS_FOLDER

LAUNCH_FOLDER="$1/org.uqbar.project.wollok.launch"
LIB="./$LAUNCH_FOLDER/lib"
SRC="./$LAUNCH_FOLDER/target"
LIB="$LAUNCH_FOLDER/lib"
SRC="$LAUNCH_FOLDER/target"

# List of .jar dependencies
JARS=(
"com.google.inject"
"com.google.guava"
Expand Down Expand Up @@ -58,17 +60,17 @@ JARS=(
"org.uqbar.project.wollok.launch"
)

#WCLASS_PATH="echo $(for i in `find $SRC -name "*.jar"`; do echo $i; done) $(for i in `find $DIR/$LIB -name "*.jar"`; do echo $i; done)"
# Copying all .jars into wollok-cli jars folder
# Step 1 => from target folder
for i in "${JARS[@]}"
do
echo "Copying $i*.jar"
#find $SRC -name "$i*.jar" | xargs cp -t jars/
find $SRC -name "$i*.jar" | xargs cp -t $JARS_FOLDER
done

# Step 2 => from lib folder
for i in `find $LIB -type f -name "*.jar"`
do
echo "Copying $i"
#cp $i jars/
cp $i $JARS_FOLDER
done
3 changes: 1 addition & 2 deletions includes/commons.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
function interpret() {
rm -f $CLI_DIR/examples/*
for i in `find $SRC -name $1 ! -path "./.history*" ! -path "./bin/**"`
for i in `find $SRC -name $1 ! -path "./.history*" ! -path "./bin/**" ! -path "$CLI_DIR/examples/*"`
do
echo " ==> $i"
$CLI_DIR/winterpreter.sh $i
Expand Down
3 changes: 2 additions & 1 deletion runPrograms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#
set -e

# Setting relative folder to this script file
CLI_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
source $CLI_DIR/includes/commons.sh

Expand All @@ -13,7 +14,7 @@ interpret "*.wlk"
if [ $? -gt 0 ] ; then
exit 1
fi
echo "********************************************"
echo "==========================================================="
echo "Ejecutando programas..."
interpret "*.wpgm"
if [ $? -gt 0 ] ; then
Expand Down
4 changes: 2 additions & 2 deletions runTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

set -e

CURR_DIR=./
# Setting relative folder to this script file
CLI_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
source $CLI_DIR/includes/commons.sh

Expand All @@ -15,7 +15,7 @@ interpret "*.wlk"
if [ $? -gt 0 ] ; then
exit 1
fi
echo "********************************************"
echo "==========================================================="
echo "Ejecutando tests..."
interpret "*.wtest"
if [ $? -gt 0 ] ; then
Expand Down
16 changes: 11 additions & 5 deletions sanityCheck.sh → wsanity-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
# Sanity check for Wollok CLI project
# Author: Dodain
#

# Setting relative folder to this script file
CLI_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

function testFailingFile() {
echo "*******************************************************************************"
echo "=========================================================================================="
echo "Testeando archivo $1"
if [ ! -s ./examples/$1 ] ; then
if [ ! -s $CLI_DIR/examples/$1 ] ; then
echo "Archivo $1 no existe"
return 1
fi
./winterpreter.sh ./examples/$1
$CLI_DIR/winterpreter.sh $CLI_DIR/examples/$1
if [ $? -ne 1 ] ; then
echo "$1 no debería haber compilado"
return 1
Expand All @@ -28,7 +32,9 @@ if [ $? -ne 0 ] ; then
exit 1
fi

echo "*******************************************************************************"
echo "=========================================================================================="
echo "Testing happy path for pepita test and program"
./winterpreter.sh ./examples/pepita.warnings.wlk && ./winterpreter.sh ./examples/pepita.wtest && ./winterpreter.sh ./examples/pepita.wpgm
$CLI_DIR/winterpreter.sh $CLI_DIR/examples/pepita.warnings.wlk \
&& $CLI_DIR/winterpreter.sh $CLI_DIR/examples/pepita.wtest \
&& $CLI_DIR/winterpreter.sh $CLI_DIR/examples/pepita.wpgm
exit $?

0 comments on commit d1daf18

Please sign in to comment.