Permalink
Browse files

Add all_clojure_versions_except bash function in env.sh

to make it easier to add to the list of Clojure versions going
forward.  Now I should be add the new version to env.sh only, and all
batch.sh files will automatically inherit that unless they add it to
their list of exceptions.
  • Loading branch information...
jafingerhut committed Oct 21, 2012
1 parent db60a32 commit 8c050dc08843f8adc37108ba039eadf00bdc8656
Showing with 68 additions and 4 deletions.
  1. +1 −1 binarytrees/batch.sh
  2. +64 −0 env.sh
  3. +1 −1 knucleotide/batch.sh
  4. +1 −1 pidigits/batch.sh
  5. +1 −1 revcomp/batch.sh
View
@@ -11,7 +11,7 @@ BENCHMARK="binarytrees"
#ALL_LANGUAGES="java jruby clj-1.2 clj-1.3-alpha1 clj-1.3-alpha3 clj-1.3-alpha4"
# Note: Older versions than clj-1.3-alpha7 cannot compile the program
# binarytrees.clojure-rh.clojure.
-ALL_LANGUAGES="java clj-1.3-alpha7 clj-1.3-alpha8 clj-1.3-beta1 clj-1.3-beta2 clj-1.3-beta3 clj-1.3 clj-1.4-alpha1 clj-1.4-alpha2 clj-1.4-alpha3 clj-1.4-alpha4 clj-1.4-alpha5 clj-1.4-beta1 clj-1.4-beta2 clj-1.4-beta3 clj-1.4-beta4 clj-1.4-beta5 clj-1.4-beta6 clj-1.4-beta7 clj-1.4 clj-1.5-alpha1 clj-1.5-alpha2 clj-1.5-alpha3 clj-1.5-alpha4 clj-1.5-alpha5 clj-1.5-alpha6 clj-1.5-alpha7"
+ALL_LANGUAGES="java `all_clojure_versions_except 1.2 1.2.1 1.3-alpha5 1.3-alpha6`"
ALL_TESTS="quick medium long"
LANGUAGES=""
View
64 env.sh
@@ -123,6 +123,70 @@ check_clojure_version_spec()
return 1
}
+make_clojure_version_set()
+{
+ # str_list is a single string containing 'words' separated by
+ # white space. This function and
+ # check_exact_string_in_string_set() only work for lists/sets of
+ # strings where each string contains no white space, and no colon
+ # characters.
+ local version_set=":"
+ for v in $*
+ do
+ #1>&2 echo "andy-debug $v"
+ check_clojure_version_spec "$v"
+ if [ $? != 0 ]
+ then
+ 1>&2 echo "Bad Clojure version string found in version_list=${version_list}"
+ 1>&2 echo -n "$0: v='${v}' must be one of: "
+ show_known_clojure_versions
+ 1>&2 echo ""
+ exit 1
+ fi
+ version_set="${version_set}${CLJ_VERSION_STR}:"
+ done
+ echo "${version_set}"
+}
+
+check_exact_string_in_string_set()
+{
+ local str="$1"
+ # Note: The 'string set' is assumed to be a sequence of strings
+ # that do not contain colon (:) characters, separated by colon
+ # characters, and with a colon at the beginning and end. For
+ # example, the set containing strings "a", "foo", and "gah" would
+ # be represented as ":a:foo:gah:"
+ local str_set="$2"
+ local t="${str_set/:${str}:/}"
+ if [ "${str_set}" == "${t}" ]
+ then
+ # str not in str_set, so return "bad" non-0 exit status
+ return 1
+ fi
+ # str in str_set, so return "good" 0 exit status
+ return 0
+}
+
+all_clojure_versions_except()
+{
+ local clojure_versions_to_exclude_set=`make_clojure_version_set $*`
+ local tmp
+ local ret_val=""
+ for v in ${ALL_CLOJURE_VERSIONS}
+ do
+ check_clojure_version_spec "${v}"
+ tmp="${CLJ_VERSION_STR}"
+ check_exact_string_in_string_set "${tmp}" "${clojure_versions_to_exclude_set}"
+ if [ $? != 0 ]
+ then
+ # The version is not in the list of versions to exclude,
+ # so add it to return value.
+ ret_val="${ret_val} ${v}"
+ fi
+ done
+ echo "${ret_val}"
+}
+
#echo "Debug OS=:${OS}:"
if [ "$OS" == "Cygwin" ]
then
View
@@ -15,7 +15,7 @@ BENCHMARK="knucleotide"
# enough more memory than later versions with this program that the
# -Xmx command line argument currently used is not enough, and it runs
# out of memory. Leave those Clojure versions out for now.
-ALL_LANGUAGES="java clj-1.3-alpha7 clj-1.3-alpha8 clj-1.3-beta1 clj-1.3-beta2 clj-1.3-beta3 clj-1.3 clj-1.4-alpha1 clj-1.4-alpha2 clj-1.4-alpha3 clj-1.4-alpha4 clj-1.4-alpha5 clj-1.4-beta1 clj-1.4-beta2 clj-1.4-beta3 clj-1.4-beta4 clj-1.4-beta5 clj-1.4-beta6 clj-1.4-beta7 clj-1.4 clj-1.5-alpha1 clj-1.5-alpha2 clj-1.5-alpha3 clj-1.5-alpha4 clj-1.5-alpha5 clj-1.5-alpha6 clj-1.5-alpha7"
+ALL_LANGUAGES="java `all_clojure_versions_except 1.2 1.2.1 1.3-alpha5 1.3-alpha6`"
ALL_TESTS="quick medium long"
LANGUAGES=""
View
@@ -16,7 +16,7 @@ BENCHMARK="pidigits"
# when they were small enough, and then later arithmetic with those
# values can cause an exception when they overflow. It was fixed in
# clj-1.3.
-ALL_LANGUAGES="gcc clj-1.2 clj-1.2.1 clj-1.3-alpha5 clj-1.3-alpha6 clj-1.3-alpha7 clj-1.3-alpha8 clj-1.3-beta1 clj-1.3 clj-1.4-alpha1 clj-1.4-alpha2 clj-1.4-alpha3 clj-1.4-alpha4 clj-1.4-alpha5 clj-1.4-beta1 clj-1.4-beta2 clj-1.4-beta3 clj-1.4-beta4 clj-1.4-beta5 clj-1.4-beta6 clj-1.4-beta7 clj-1.4 clj-1.5-alpha1 clj-1.5-alpha2 clj-1.5-alpha3 clj-1.5-alpha4 clj-1.5-alpha5 clj-1.5-alpha6 clj-1.5-alpha7"
+ALL_LANGUAGES="java `all_clojure_versions_except 1.3-beta2 1.3-beta3`"
ALL_TESTS="quick medium long"
LANGUAGES=""
View
@@ -14,7 +14,7 @@ BENCHMARK="revcomp"
#ALL_LANGUAGES="sbcl perl ghc java clj-1.2 clj-1.3-alpha1 clj-1.3-alpha3 clj-1.3-alpha4"
# Note that revcomp.clj-15.clj does not compile with Clojure versions
# before 1.3-alpha7, because of its use of *unchecked-math*
-ALL_LANGUAGES="java clj-1.3-alpha7 clj-1.3-alpha8 clj-1.3-beta1 clj-1.3-beta2 clj-1.3-beta3 clj-1.3 clj-1.4-alpha1 clj-1.4-alpha2 clj-1.4-alpha3 clj-1.4-alpha4 clj-1.4-alpha5 clj-1.4-beta1 clj-1.4-beta2 clj-1.4-beta3 clj-1.4-beta4 clj-1.4-beta5 clj-1.4-beta6 clj-1.4-beta7 clj-1.4 clj-1.5-alpha1 clj-1.5-alpha2 clj-1.5-alpha3 clj-1.5-alpha4 clj-1.5-alpha5 clj-1.5-alpha6 clj-1.5-alpha7"
+ALL_LANGUAGES="java `all_clojure_versions_except 1.2 1.2.1 1.3-alpha5 1.3-alpha6`"
ALL_TESTS="quick medium long"
LANGUAGES=""

0 comments on commit 8c050dc

Please sign in to comment.