diff --git a/source/Dockerfile b/source/Dockerfile index fb58e37..1f997c4 100644 --- a/source/Dockerfile +++ b/source/Dockerfile @@ -129,7 +129,9 @@ FROM docker-gs64-server as docker-gs64-rowan # Install git RUN apt-get update \ - && apt-get install --assume-yes --no-install-recommends git \ + && apt-get install --assume-yes --no-install-recommends \ + git \ + ssh-client \ && apt-get clean \ && rm --recursive --force /var/lib/apt/lists/* /tmp/* /var/tmp/* \ ; @@ -140,6 +142,7 @@ RUN install -d --owner=${GS_USER} --group=users ${ROWAN_PROJECTS_HOME} COPY --chown=${GS_USER}:users load-rowan-project.sh ${GEMSTONE_GLOBAL_DIR}/load-rowan-project.sh COPY --chown=${GS_USER}:users run-tests.sh ${GEMSTONE_GLOBAL_DIR}/run-tests.sh COPY --chown=${GS_USER}:users StdOutPrinter.gs ${GEMSTONE_GLOBAL_DIR}/StdOutPrinter.gs +COPY --chown=${GS_USER}:users StdOutTestReporter.gs ${GEMSTONE_GLOBAL_DIR}/StdOutTestReporter.gs COPY --from=download --chown=${GS_USER}:users /tmp/extent0.rowan.dbf ${GEMSTONE_GLOBAL_DIR}/data/extent0.dbf CMD ["./entrypoint.sh"] diff --git a/source/StdOutTestReporter.gs b/source/StdOutTestReporter.gs new file mode 100644 index 0000000..7848991 --- /dev/null +++ b/source/StdOutTestReporter.gs @@ -0,0 +1,113 @@ +set compile_env: 0 +! ------------------- Class definition for StdOutTestReporter +expectvalue /Class +doit +Object subclass: 'StdOutTestReporter' + instVarNames: #() + classVars: #() + classInstVars: #() + poolDictionaries: #() + inDictionary: Globals + options: #() + +% +! ------------------- Remove existing behavior from StdOutTestReporter +expectvalue /Metaclass3 +doit +StdOutTestReporter removeAllMethods. +StdOutTestReporter class removeAllMethods. +% +set compile_env: 0 +! ------------------- Instance methods for StdOutTestReporter +category: 'reporting' +method: StdOutTestReporter +runTestsForProjectNamed: aProjectName + +| suite result sortBlock currentTestClass | + +suite := (Rowan projectNamed: aProjectName) testSuite. + +StdOutPrinter printLine: [:s | + s << 'Running suite ' << suite name << ' with ' << suite tests size asString << ' tests.'. +]. + +result := suite run. + +StdOutPrinter + printLine: [:s | s << '.............']; + printLine: [:s | s << 'Finished running suite: ' << suite name ]; + printLine: [:s | ]; + printInfo: [:s | s << '##################################################']; + printInfo: [:s | s << ' ' << suite name]; + printInfo: [:s | s << ' ' << result runCount asString << ' tests with ' << result failureCount asString << ' failures and ' << result errorCount asString << ' errors.' ]; + printInfo: [:s | s << '##################################################']. + +sortBlock := [:a :b | a class name < b class name or: [a class name = b class name and: [ a selector < b selector ]]]. + +StdOutPrinter + printLine: [:s | ]; + printSuccess: [:s | s << '(' << result passedCount asString << ' tests passed)' ]. + +(result passed sort: sortBlock) + do: [:test | + currentTestClass = test class name + ifFalse: [ + currentTestClass := test class name. + StdOutPrinter + printLine: [:s | ]; + printLine: [:s | s << currentTestClass asString ] + ]. + StdOutPrinter printSuccess: [:s | s << ' ✓ ' << test selector asString ] + ]. + +StdOutPrinter + printLine: [:s | ]; + printWarning: [:s | s << '##########################']; + printWarning: [:s | s << ' ' << result failureCount asString << ' tests failed' ]; + printWarning: [:s | s << '##########################']. + +(result failures sort: sortBlock) + do: [:test | + currentTestClass = test class name + ifFalse: [ + currentTestClass := test class name. + StdOutPrinter + printLine: [:s | ]; + printLine: [:s | s << currentTestClass asString ] + ]. + StdOutPrinter printWarning: [:s | s << ' ✗ ' << test selector asString ] + ]. + +StdOutPrinter + printLine: [:s | ]; + printError: [:s | s << '##########################']; + printError: [:s | s << ' ' << result errorCount asString << ' tests errored' ]; + printError: [:s | s << '##########################']. + +(result errors sort: sortBlock) + do: [:test | + currentTestClass = test class name + ifFalse: [ + currentTestClass := test class name. + StdOutPrinter + printLine: [:s | ]; + printLine: [:s | s << currentTestClass asString ] + ]. + StdOutPrinter printError: [:s | s << ' ✗ ' << test selector asString ] + ]. + +result hasPassed ifTrue: [ + StdOutPrinter + printLine: [:s | ]; + printSuccess: [:s | s << '#####################################################']; + printSuccess: [:s | s << '✓ Executed ' << result runCount asString << ' tests with ' << result failureCount asString << ' failures and ' << result errorCount asString << ' errors.' ]; + printSuccess: [:s | s << '#####################################################'] + ] ifFalse: [ + StdOutPrinter + printLine: [:s | ]; + printError: [:s | s << '#####################################################']; + printError: [:s | s << '✗ Executed ' << result runCount asString << ' tests with ' << result failureCount asString << ' failures and ' << result errorCount asString << ' errors.' ]; + printError: [:s | s << '#####################################################'] + ]. +^ result hasPassed +% diff --git a/source/run-tests.sh b/source/run-tests.sh index 881727c..970c54e 100755 --- a/source/run-tests.sh +++ b/source/run-tests.sh @@ -9,13 +9,14 @@ echo "Running ${PROJECT_NAME} tests..." touch "${GEMSTONE_LOG_DIR}/running-tests.log" -echo "Installing stdout printer" +echo "Installing stdout printer & test reporter" topaz -i -q < "${GEMSTONE_LOG_DIR}/installing-stdout-support.log" set gemstone gs64stone user SystemUser pass ${SYSTEM_USER_PASSWORD} iferror exit 1 login input StdOutPrinter.gs +input StdOutTestReporter.gs commit logout exit 0 @@ -29,93 +30,7 @@ iferror exit 1 login expectvalue true doit -| suite result sortBlock currentTestClass | - -suite := (Rowan projectNamed: '${PROJECT_NAME}') testSuite. - -StdOutPrinter printLine: [:s | - s << 'Running suite ' << suite name << ' with ' << suite tests size asString << ' tests.'. -]. - -result := suite run. - -StdOutPrinter - printLine: [:s | s << '.............']; - printLine: [:s | s << 'Finished running suite: ' << suite name ]; - printLine: [:s | ]; - printInfo: [:s | s << '##################################################']; - printInfo: [:s | s << ' ' << suite name]; - printInfo: [:s | s << ' ' << result runCount asString << ' tests with ' << result failureCount asString << ' failures and ' << result errorCount asString << ' errors.' ]; - printInfo: [:s | s << '##################################################']. - -sortBlock := [:a :b | a class name < b class name or: [a class name = b class name and: [ a selector < b selector ]]]. - -StdOutPrinter - printLine: [:s | ]; - printSuccess: [:s | s << '(' << result passedCount asString << ' tests passed)' ]. - -(result passed sort: sortBlock) - do: [:test | - currentTestClass = test class name - ifFalse: [ - currentTestClass := test class name. - StdOutPrinter - printLine: [:s | ]; - printLine: [:s | s << currentTestClass asString ] - ]. - StdOutPrinter printSuccess: [:s | s << ' ✓ ' << test selector asString ] - ]. - -StdOutPrinter - printLine: [:s | ]; - printWarning: [:s | s << '##########################']; - printWarning: [:s | s << ' ' << result failureCount asString << ' tests failed' ]; - printWarning: [:s | s << '##########################']. - -(result failures sort: sortBlock) - do: [:test | - currentTestClass = test class name - ifFalse: [ - currentTestClass := test class name. - StdOutPrinter - printLine: [:s | ]; - printLine: [:s | s << currentTestClass asString ] - ]. - StdOutPrinter printWarning: [:s | s << ' ✗ ' << test selector asString ] - ]. - -StdOutPrinter - printLine: [:s | ]; - printError: [:s | s << '##########################']; - printError: [:s | s << ' ' << result errorCount asString << ' tests errored' ]; - printError: [:s | s << '##########################']. - -(result errors sort: sortBlock) - do: [:test | - currentTestClass = test class name - ifFalse: [ - currentTestClass := test class name. - StdOutPrinter - printLine: [:s | ]; - printLine: [:s | s << currentTestClass asString ] - ]. - StdOutPrinter printError: [:s | s << ' ✗ ' << test selector asString ] - ]. - -result hasPassed ifTrue: [ - StdOutPrinter - printLine: [:s | ]; - printSuccess: [:s | s << '#####################################################']; - printSuccess: [:s | s << '✓ Executed ' << result runCount asString << ' tests with ' << result failureCount asString << ' failures and ' << result errorCount asString << ' errors.' ]; - printSuccess: [:s | s << '#####################################################'] - ] ifFalse: [ - StdOutPrinter - printLine: [:s | ]; - printError: [:s | s << '#####################################################']; - printError: [:s | s << '✗ Executed ' << result runCount asString << ' tests with ' << result failureCount asString << ' failures and ' << result errorCount asString << ' errors.' ]; - printError: [:s | s << '#####################################################'] - ]. -result hasPassed +StdOutTestReporter new runTestsForProjectNamed: '${PROJECT_NAME}' % commit logout