Skip to content

Commit

Permalink
add a --no-js option to validate.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed Oct 19, 2014
1 parent bfc6fbf commit 0e633e9
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions common/validate.sh
@@ -1,5 +1,4 @@
#! /bin/bash
REVRANGE="$1..HEAD"
TEST='buildbot.test buildslave.test'

# some colors
Expand All @@ -19,16 +18,28 @@ if [ $# -eq 0 ]; then
echo " sphinx, pyflakes, mock, and so on"
echo "To use a different directory for tests, pass TRIALTMP=/path as an env variable"
echo "if --quick is passed validate will skip unit tests and concentrate on coding style"
echo "if --no-js is passed validate will skip tests that require Node and NPM"
exit 1
fi

## parse options

slow=true # TODO: switch slow to quick
no_js=false
while [ $# -gt 0 ]; do
case $1 in
--quick) slow=false ;;
--no-js) no_js=true ;;
-*) echo "$0: error - unrecognized option $1" 1>&2; exit 1;;
*) REVRANGE="$1..HEAD" ;;
esac
shift
done

status() {
echo "${LTCYAN}-- ${*} --${NORM}"
}
slow=true
if [[ $2 == '--quick' ]]; then
slow=false
fi

ok=true
problem_summary=""
not_ok() {
Expand Down Expand Up @@ -108,7 +119,7 @@ done < ${tempfile}
echo "${MAGENTA}Validating the following commits:${NORM}"
git log "$REVRANGE" --pretty=oneline || exit 1

if $slow; then
if $slow && ! $no_js; then
for module in www/base www/console_view www/waterfall_view www/codeparameter;
do
status "running 'setup.py develop' for $module"
Expand All @@ -118,10 +129,15 @@ if $slow; then
(cd $module; python setup.py develop >/dev/null ) || not_ok "$module/setup.py failed"
fi
done
else
warning "Skipping JavaScript Tests"
fi

if $slow; then
status "running tests"
run_tests || not_ok "tests failed"
status "running Python tests"
run_tests || not_ok "Python tests failed"
else
warning "Skipping Python Tests"
fi

status "checking formatting"
Expand Down

4 comments on commit 0e633e9

@gsemet
Copy link

@gsemet gsemet commented on 0e633e9 Oct 24, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello

I start using validate in other projects, can we have it sperated from buildbot and so, generalized a bit more?

@djmitche
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use it in a number of other projects, too -- https://github.com/mozilla/build-relengapi and friends, at least.

I have thought vaguely about generalizing it, but since it's a shell script and is fairly project-specific, I didn't see any good way to do so. What do you have in mind?

@gsemet
Copy link

@gsemet gsemet commented on 0e633e9 Oct 26, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a real suggestion to do, but why not moving it in a dedicated repo and have it installed with buildbot.
It is not too much buildbot oriented, rather it is "python project with some unit test", with pylint/pep8 automatically applyied on checkin, I'd like to reuse it and capitalize on a dedicated project, so it can becomes more easier to reuse it in every other projects.

@djmitche
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good -- feel free to give it a shot, and point me to the repository..

Please sign in to comment.