Skip to content

Commit

Permalink
Merge branch 'fniephaus/python-plugin'
Browse files Browse the repository at this point in the history
# Conflicts:
#	.travis.yml
#	rsqueakvm/plugins/plugin.py
#	rsqueakvm/plugins/profiler_plugin.py
#	rsqueakvm/plugins/ruby_plugin.py
#	rsqueakvm/plugins/tailcall_plugin.py
  • Loading branch information
fniephaus committed Mar 26, 2018
2 parents d33005c + 7464de4 commit 2d4eeb1
Show file tree
Hide file tree
Showing 544 changed files with 5,868 additions and 400 deletions.
34 changes: 34 additions & 0 deletions .build/plugintests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#! /usr/bin/env python

import sys
from os import path
from environment import cp, config # import with side effects

from rsqueakvm.util import system

if __name__ == "__main__":
try:
plugins = next(arg for arg in sys.argv
if arg.startswith("--plugins="))
sys.argv.remove(plugins)
except StopIteration:
pass
try:
plugin_dir = next(arg for arg in sys.argv
if arg.startswith("--plugin-dir="))
sys.argv.remove(plugin_dir)
except StopIteration:
print "No plugin directory provided via --plugin-dir=<plugin directory>"
sys.exit(1)
if plugins:
plugins = plugins.split("=")[1]
system.optional_plugins = plugins
plugin_dir = plugin_dir.split("=")[1]
sys.argv.append("-s")
sys.argv.append("-vv")
sys.argv.append(path.join(
path.dirname(__file__), "..",
"rsqueakvm", "test", "plugins", plugin_dir))

import pytest
exit(pytest.main(args=sys.argv[1:]))
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -275,3 +275,4 @@ images/
.build/rply
.build/topaz
docs/_build
rsqueakvm/test/images/pypy.image
47 changes: 45 additions & 2 deletions .travis/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,49 @@ if [[ "${TRAVIS_BRANCH}" != "master" ]] && [[ "${BUILD_ARCH}" = arm* ]]; then
exit 0
fi

travis_wait() {
local timeout=110

local cmd="$@"

$cmd &
local cmd_pid=$!

travis_jigger $! $timeout $cmd &
local jigger_pid=$!
local result

{
wait $cmd_pid 2>/dev/null
result=$?
ps -p$jigger_pid &>/dev/null && kill $jigger_pid
}

echo -e "\nThe command $cmd exited with $result."
return $result
}

travis_jigger() {
# helper method for travis_wait()
local cmd_pid=$1
shift
local timeout=$1 # in minutes
shift
local count=0

# clear the line
echo -e "\n"

while [ $count -lt $timeout ]; do
count=$(($count + 1))
echo -ne "."
sleep 60
done

echo -e "\nTimeout (${timeout} minutes) reached. Terminating \"$@\"\n"
kill -9 $cmd_pid
}

case "$TRAVIS_OS_NAME" in
linux)
export SDL_VIDEODRIVER=dummy;
Expand All @@ -29,8 +72,8 @@ if [[ -n "${TEST_TYPE}" ]]; then
SCRIPT_NAME="test.sh"
fi

"${BASE}/${SCRIPT_NAME}"
travis_wait "${BASE}/${SCRIPT_NAME}"

if [[ "${PLUGINS}" = *"database_plugin"* ]]; then
"${BASE}/test_database_integration.sh"
fi
fi
20 changes: 20 additions & 0 deletions .travis/install_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
set -ex

readonly BASE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly BUILD_DIR="${BASE}/../.build"
readonly TEST_IMAGES_BASE="${TRAVIS_BUILD_DIR}/rsqueakvm/test/images"
readonly TEST_IMAGES_BASE_URL="https://www.hpi.uni-potsdam.de/hirschfeld/artefacts/rsqueak/testing/images"

export OPTIONS=""

Expand Down Expand Up @@ -95,6 +98,21 @@ setup_linux() {
fi
}

load_test_images() {
local target
local url

if [[ -z "${TEST_TYPE}" ]]; then
return
fi

if [[ "${PLUGINS}" = "PythonPlugin" ]]; then
target="${TEST_IMAGES_BASE}/pypy.image"
url="${TEST_IMAGES_BASE_URL}/pypy.image"
curl -f -s -L --retry 3 -o "${target}" "${url}"
fi
}

# Only build arm on master
if [[ "${TRAVIS_BRANCH}" != "master" ]] && [[ "${BUILD_ARCH}" = arm* ]]; then
exit 0
Expand All @@ -103,6 +121,8 @@ fi
setup_$TRAVIS_OS_NAME
python .build/download_dependencies.py $OPTIONS

load_test_images

if [[ -d ".build/sqpyte" ]]; then
# Make sqlite/sqpyte for DatabasePlugin
pushd ".build/sqpyte" > /dev/null
Expand Down
16 changes: 11 additions & 5 deletions .travis/test.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
#!/bin/sh
set -ex

testscript="unittests.py"

case "${TEST_TYPE}" in
default) testflag="-S" ;;
quick) testflag="-Q" ;;
slow) testflag="-S" ;;
coverage) testflag="-v -S --cov=rsqueakvm --cov-append " ;;
default) testflag="-s -S" ;;
quick) testflag="-s -Q" ;;
slow) testflag="-s -S" ;;
coverage) testflag="-s -v -S --cov=rsqueakvm --cov-append " ;;
plugin)
testscript="plugintests.py"
testflag="--plugins=${PLUGINS} --plugin-dir=${PLUGIN_DIR}"
;;
*)
echo "Wrong TEST_TYPE value (${TEST_TYPE}), not executing tests"
exit 0
Expand All @@ -17,4 +23,4 @@ case "${BUILD_ARCH}" in
*) ;;
esac

pypy ".build/unittests.py" -s ${testflag}
pypy ".build/${testscript}" -s ${testflag}
4 changes: 4 additions & 0 deletions repository/ForeignLanguage-Core.package/.filetree
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"noMethodMetaData" : true,
"separateMethodMetaAndSource" : false,
"useCypressPropertiesFile" : true }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
helpers
availableLanguages
^ (self subclasses collect: [ :ea | ea asString ]) sorted
inject: (OrderedCollection with: #Smalltalk)
into: [ :coll :ea | coll add: ea asSymbol; yourself ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
initialize-release
compilePrimitivesIn: newClass
| primitiveSelectors |
self flag: #instanceSidePrimitives.
primitiveSelectors := ForeignLanguage class organization listAtCategoryNamed: 'system primitives'.
primitiveSelectors do: [:selector | | template |
template := (ForeignLanguage class >> selector) getSource asString.
newClass class compile: (
template copyReplaceAll: '{ForeignLanguage}' with: newClass name)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
debugging
debuggerPrintItem: pyFrame on: aStream
self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
execution
evaluateExpression: selection in: aContext to: aReceiver
self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source code
fileExtension
self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
helpers
getContentsOf: aFileName
| stream data |
stream := StandardFileStream oldFileNamed: aFileName.
stream := MultiByteFileStream newFrom: stream.
data := stream contents.
stream close.
^ data
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
debugging
getFilename: foreignFrame
self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source code
getSource: foreignFrame
self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
debugging
pcRange: foreignFrame
self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
source code
persistEvalCode: aSource
| directory filename stream |
directory := 'eval', FileDirectory pathNameDelimiter.
filename := directory, Time millisecondClockValue, self fileExtension.
stream := StandardFileStream forceNewFileNamed: filename.
stream := MultiByteFileStream newFrom: stream.
stream write: aSource.
stream close.
^ filename
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
system primitives
primBreakOnExceptionsDuringSends: aBool
<primitive: 'breakOnExceptionsDuringSends' module: '{ForeignLanguage}Plugin'>
self primitiveFailed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
system primitives
primEval: aString
<primitive: 'eval' module: '{ForeignLanguage}Plugin'>
self primitiveFailed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
system primitives
primRestartSpecificFrame: foreignFrame
<primitive: 'restartSpecificFrame' module: '{ForeignLanguage}Plugin'>
self primitiveFailed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
styling
pygmentsLexer
self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
debugging
restartFrame: foreignFrame with: aSource
self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
styling
sourceCodeTemplate
self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
styling
stylerFormat: aText
"Perform any formatting of aText necessary and answer either aText, or a formatted copy of aText"

aText asString = Object sourceCodeTemplate
ifTrue:[
"the original source code template does not parse,
replace it with one that does"
^ self sourceCodeTemplate asText].
^aText
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
initialize-release
subclass: t instanceVariableNames: f classVariableNames: d poolDictionaries: s category: cat
| newClass |
newClass := super subclass: t instanceVariableNames: f classVariableNames: d poolDictionaries: s category: cat.
self compilePrimitivesIn: newClass.
^ newClass
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
debugging
tempNamesIn: foreignFrame
self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
debugging
tempVariableAt: anIndex in: pyFrame
self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
helpers
vmSpeaksLanguage
self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"class" : {
"availableLanguages" : "fn 3/14/2017 11:15",
"compilePrimitivesIn:" : "fn 5/6/2017 13:20",
"debuggerPrintItem:on:" : "fn 3/16/2017 22:31",
"evaluateExpression:in:to:" : "fn 3/21/2017 11:32",
"fileExtension" : "fn 3/17/2017 10:20",
"getContentsOf:" : "fn 3/27/2017 21:54",
"getFilename:" : "fn 4/2/2017 19:32",
"getSource:" : "fn 3/16/2017 21:57",
"pcRange:" : "fn 3/16/2017 22:03",
"persistEvalCode:" : "fn 3/17/2017 10:23",
"primBreakOnExceptionsDuringSends:" : "fn 11/13/2017 18:09",
"primEval:" : "fn 4/28/2017 15:30",
"primRestartSpecificFrame:" : "fn 4/28/2017 15:31",
"pygmentsLexer" : "fn 5/16/2017 17:47",
"restartFrame:with:" : "fn 3/16/2017 21:57",
"sourceCodeTemplate" : "fn 3/14/2017 11:23",
"stylerFormat:" : "fn 3/14/2017 11:21",
"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:" : "fn 4/28/2017 16:00",
"tempNamesIn:" : "fn 3/16/2017 22:45",
"tempVariableAt:in:" : "fn 3/16/2017 22:44",
"vmSpeaksLanguage" : "fn 3/14/2017 11:31" },
"instance" : {
} }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "ForeignLanguage-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "ForeignLanguage",
"pools" : [
],
"super" : "Object",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
testing
isVariable
^ false
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
abstract
allInstVarNames
self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
abstract
asSmalltalk
self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
abstract
class
self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
abstract
className
self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
overrides
defaultLabelForInspector
self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
overrides
environment
^ nil
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
overrides
explore
^FLToolSet explore: self
Loading

0 comments on commit 2d4eeb1

Please sign in to comment.