Changeset 20783


Ignore:
Timestamp:
06/20/16 16:29:49 (9 years ago)
Author:
ayfeng
Message:

Add usage message and error handling for spec generation script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/jenkins/javascript/karma/scripts/specs/generate-spec.sh

    r20781 r20783  
    11#!/bin/sh
     2
     3if [ -z $1 ]; then
     4        echo "Usage: $0 [NUMBER[-NUMBER]][,NUMBER[-NUMBER]]..."
     5        exit 1
     6fi
    27
    38# Create array to store numbers of the tests
     
    1318for range in $1; do
    1419    if [[ ! "$range" =~ "-" ]]; then # check if it is a range of numbers or just a single number
    15         TESTNUMBERS+=($range)
     20        if [ ! -f "$SCRIPTDIR/test$range.js" ]; then
     21            >&2 echo "Warning: test$num.js does not exist."
     22        else
     23            TESTNUMBERS+=($range)
     24        fi
    1625    else
    1726        SEQUENCE=($(seq -w -s ' ' $(sed "s/-/$IFS/" <<< ${range})))
     27
     28        IFS=' '
     29        for num in ${SEQUENCE[@]}; do
     30            if [ ! -f "$SCRIPTDIR/test$num.js" ]; then
     31                >&2 echo "Warning: test$num.js does not exist."
     32            fi
     33        done
     34
    1835        TESTNUMBERS=("${TESTNUMBERS[@]}" "${SEQUENCE[@]}")
    1936    fi
Note: See TracChangeset for help on using the changeset viewer.