run-versions 3.63 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
#!/usr/bin/env bash

# Default Python Versions
# shellcheck source=bin/default_pythons
source "bin/default_pythons"

testPythonDefault() {
  updateVersion "pythonDefault" $DEFAULT_PYTHON_VERSION
  compile "pythonDefault"
  assertCaptured $DEFAULT_PYTHON_VERSION
  assertNotCaptured "security update"
Casey Faist's avatar
Casey Faist committed
12
  assertCaptured "Installing SQLite3"
13 14 15 16 17 18 19 20 21
  assertCapturedSuccess
}

testPython2() {
    updateVersion "python2" $LATEST_27
    echo $LATEST_27 > "runtime.txt"
    compile "python2"
    assertCaptured $LATEST_27
    assertNotCaptured "security update"
Casey Faist's avatar
Casey Faist committed
22
    assertCaptured "Installing SQLite3"
23 24 25 26 27 28 29
    assertCapturedSuccess
}

testPython2_warn() {
    compile "python2_warn"
    assertCaptured "python-2.7.15"
    assertCaptured "security update!"
Casey Faist's avatar
Casey Faist committed
30
    assertCaptured "Installing SQLite3"
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
    assertCapturedSuccess
}

testPython2_fail() {
    compile "python2_fail"
    assertCaptured "Aborting"
    assertCapturedError
}

testPython3_4() {
  if [[ $STACK != "cedar-14" ]]; then
    updateVersion "python3_4" $LATEST_34
    compile "python3_4"
    assertCaptured $LATEST_34
    assertNotCaptured "security update"
    assertCapturedSuccess
  fi
}

testPython3_4_warn() {
  compile "python3_4_warn"
  if [[ $STACK = "cedar-14" ]]; then
    assertCaptured "python-3.4.0"
    assertCaptured "security update!"
    assertCapturedSuccess
  else
    assertCapturedError
  fi
}

testPython3_4_fail() {
    compile "python3_4_fail"
    assertCaptured "Aborting"
    assertCapturedError
}

testPython3_5() {
  if [[ $STACK != "cedar-14" ]]; then
    updateVersion "python3_5" $LATEST_35
    compile "python3_5"
    assertCaptured $LATEST_35
    assertNotCaptured "security update"
Casey Faist's avatar
Casey Faist committed
73
    assertCaptured "Installing SQLite3"
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
    assertCapturedSuccess
  fi
}

testPython3_5_warn() {
  compile "python3_5_warn"
  if [[ $STACK = "cedar-14" ]]; then
    assertCaptured "python-3.5.3"
    assertCaptured "security update!"
    assertCapturedError
  else
    assertCapturedError
  fi
}

testPython3_5_fail() {
    compile "python3_5_fail"
    assertCaptured "Aborting"
    assertCapturedError
}

testPython3_6() {
  updateVersion "python3_6" $LATEST_36
  compile "python3_6"
  assertCaptured $LATEST_36
  assertNotCaptured "security update"
Casey Faist's avatar
Casey Faist committed
100
  assertCaptured "Installing SQLite3"
101 102 103 104 105 106 107
  assertCapturedSuccess
}

testPython3_6_warn() {
  compile "python3_6_warn"
  assertCaptured "python-3.6.7"
  assertCaptured "security update!"
Casey Faist's avatar
Casey Faist committed
108
  assertCaptured "Installing SQLite3"
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
  assertCapturedSuccess
}

testPython3_6_fail() {
    compile "python3_6_fail"
    assertCaptured "Aborting"
    assertCapturedError
}

testPython3_7() {
  updateVersion "python3_7" $LATEST_37
  compile "python3_7"
  if [[ $STACK = "cedar-14" ]]; then
    assertCapturedError
  else
    assertNotCaptured "security update"
    assertCaptured $LATEST_37
Casey Faist's avatar
Casey Faist committed
126
    assertCaptured "Installing SQLite3"
127 128 129 130 131 132 133 134 135 136 137
    assertCapturedSuccess
  fi
}

testPython3_7_warn() {
  compile "python3_7_warn"
  if [[ $STACK = "cedar-14" ]]; then
    assertCapturedError
  else
    assertCaptured "python-3.7.1"
    assertCaptured "security update!"
Casey Faist's avatar
Casey Faist committed
138
    assertCaptured "Installing SQLite3"
139 140 141 142 143 144 145 146 147 148
    assertCapturedSuccess
  fi
}

testPython3_7_fail() {
  compile "python3_7_fail"
  assertCaptured "Aborting"
  assertCapturedError
}

Casey Faist's avatar
Casey Faist committed
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
testPython3_8() {
  updateVersion "python3_8" $LATEST_38
  compile "python3_8"
  if [[ $STACK = "cedar-14" ]]; then
    assertCapturedError
  else
    assertNotCaptured "security update"
    assertCaptured $LATEST_38
    assertCaptured "Installing SQLite3"
    assertCapturedSuccess
  fi
}

testPython3_8_fail() {
  compile "python3_8_fail"
  assertCaptured "Aborting"
  assertCapturedError
}

168 169 170 171 172
pushd $(dirname 0) >/dev/null
popd >/dev/null

source $(pwd)/test/utils
source $(pwd)/test/shunit2