<commit_before>#!/usr/bin/python

#FromTasty should be in classpath (TODO as a param)
projectPath = '/home/vova/scala-projects/new-tasty/tasty/'
exttestsFolder = projectPath + 'exttests/'
checkFolder = exttestsFolder + 'check/'
testFolder = exttestsFolder + 'tests/'

def checkTasty( testName, testClass, fromTastyName ):
  #testName = test1
  #testClass = Test.scala or a/b/c/d/Test.scala
  #fromTastyName = Test

  #path to test file (for its compilation)
  testPath = testFolder + testName
  #path to res
  checkPath = checkFolder + testName + '.check' #test1.check - file with result output

  #read result from file
  try:
    with open (checkPath, "r") as checkFile:
      data = checkFile.read()

  except IOError:
    data = ''

  #commands to run
  cleanCommand = 'cd ' + testPath + ' && rm -rf *.class'
  scalacCommand = '/home/vova/scala/scala-2.11.5/bin/scalac -Ybackend:GenBCode ' +\
  '-Xplugin:' + projectPath + 'plugin/target/scala-2.11/tasty_2.11.5-0.1.0-SNAPSHOT.jar ' + testClass #Test.scala - should be added folder to find
  fromTastyCommand = 'java -Xmx768m -Xms768m ' +\
  '-Xbootclasspath/a:/home/vova/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.5.jar:/home/vova/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.11.5.jar:/home/vova/.ivy2/cache/me.d-d/scala-compiler/jars/scala-compiler-2.11.5-20150416-144435-09c4a520e1.jar:/home/vova/.ivy2//cache/jline/jline/jars/jline-2.12.jar:/home/vova/scala-projects/my-dotty/dotty/bin/../target/scala-2.11/dotty_2.11-0.1-SNAPSHOT.jar ' +\
  '-classpath /home/vova/scala-projects/my-dotty/dotty/bin/../target/scala-2.11/dotty_2.11-0.1-SNAPSHOT.jar:/home/vova/scala-projects/my-dotty/dotty/bin/../target/scala-2.11/dotty_2.11-0.1-SNAPSHOT-tests.jar -Dscala.usejavacp=true dotty.tools.dotc.FromTasty ' +\
  '-Xprint:front ' + fromTastyName #Test - it should be added to classpath

  runCommand = cleanCommand + '&&' + scalacCommand + '&&' + fromTastyCommand

  import subprocess
  proc = subprocess.Popen([runCommand],
    stdin = subprocess.PIPE,
    stdout = subprocess.PIPE,
    stderr = subprocess.PIPE,<commit_msg>Clean command modified to remove all generated *.class files<commit_after>#!/usr/bin/python

#FromTasty should be in classpath (TODO as a param)
projectPath = '/home/vova/scala-projects/new-tasty/tasty/'
exttestsFolder = projectPath + 'exttests/'
checkFolder = exttestsFolder + 'check/'
testFolder = exttestsFolder + 'tests/'

def checkTasty( testName, testClass, fromTastyName ):
  #testName = test1
  #testClass = Test.scala or a/b/c/d/Test.scala
  #fromTastyName = Test

  #path to test file (for its compilation)
  testPath = testFolder + testName
  #path to res
  checkPath = checkFolder + testName + '.check' #test1.check - file with result output

  #read result from file
  try:
    with open (checkPath, "r") as checkFile:
      data = checkFile.read()

  except IOError:
    data = ''

  #commands to run
  cleanCommand = 'cd ' + testPath + " && find . -type f -name '*.class' -delete"
  scalacCommand = '/home/vova/scala/scala-2.11.5/bin/scalac -Ybackend:GenBCode ' +\
  '-Xplugin:' + projectPath + 'plugin/target/scala-2.11/tasty_2.11.5-0.1.0-SNAPSHOT.jar ' + testClass #Test.scala - should be added folder to find
  fromTastyCommand = 'java -Xmx768m -Xms768m ' +\
  '-Xbootclasspath/a:/home/vova/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.5.jar:/home/vova/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.11.5.jar:/home/vova/.ivy2/cache/me.d-d/scala-compiler/jars/scala-compiler-2.11.5-20150416-144435-09c4a520e1.jar:/home/vova/.ivy2//cache/jline/jline/jars/jline-2.12.jar:/home/vova/scala-projects/my-dotty/dotty/bin/../target/scala-2.11/dotty_2.11-0.1-SNAPSHOT.jar ' +\
  '-classpath /home/vova/scala-projects/my-dotty/dotty/bin/../target/scala-2.11/dotty_2.11-0.1-SNAPSHOT.jar:/home/vova/scala-projects/my-dotty/dotty/bin/../target/scala-2.11/dotty_2.11-0.1-SNAPSHOT-tests.jar -Dscala.usejavacp=true dotty.tools.dotc.FromTasty ' +\
  '-Xprint:front ' + fromTastyName #Test - it should be added to classpath

  runCommand = cleanCommand + '&&' + scalacCommand + '&&' + fromTastyCommand + '&&' + cleanCommand

  import subprocess
  proc = subprocess.Popen([runCommand],
    stdin = subprocess.PIPE,
    stdout = subprocess.PIPE,
    stderr = subprocess.PIPE,
{'fraction_non_alphanumeric': 0.15760240685026614, 'fraction_numerical': 0.039805600555426986, 'mean_word_length': 3.602768903088392, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3265168', 'n_tokens_mistral': 1781, 'n_tokens_neox': 1652, 'n_words': 265}