Sfoglia il codice sorgente

adding test for leda micro framework

Sergey Zavadski 11 anni fa
parent
commit
e2d2b25d77
6 ha cambiato i file con 78 aggiunte e 0 eliminazioni
  1. 16 0
      leda/README.md
  2. 0 0
      leda/__init__.py
  3. 13 0
      leda/app.moon
  4. 24 0
      leda/benchmark_config
  5. 24 0
      leda/setup.py
  6. 1 0
      leda/source_code

+ 16 - 0
leda/README.md

@@ -0,0 +1,16 @@
+# Leda  Benchmark Test
+
+Requires `leda` installed (see https://github.com/sergeyzavadski/leda for instructions)
+    
+
+
+## Test URLs
+### JSON Encoding 
+
+http://localhost:8080/
+
+
+
+### Plaintext URL
+
+http://localhost:8080/plaintext

+ 0 - 0
leda/__init__.py


+ 13 - 0
leda/app.moon

@@ -0,0 +1,13 @@
+require 'leda.http_server'
+
+with HTTPServer!
+    .port = 8080
+    .host = ''
+    .on_request = (server, request, response)  ->
+        if request.url\find("/json")
+            response.body = {message: 'Hello, World!'}
+
+        if request.url\find("/plaintext")
+            response.body = 'Hello, World! '
+
+    \start!

+ 24 - 0
leda/benchmark_config

@@ -0,0 +1,24 @@
+{
+  "framework": "lapis",
+  "tests": [{
+    "default": {
+      "setup_file": "setup",
+      "json_url": "/"json,
+      "plaintext_url": "/plaintext",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Micro",
+      "database": "None",
+      "framework": "leda",
+      "language": "moonscript",
+      "orm": "Raw",
+      "platform": "libpropeller",
+      "webserver": "None",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "leda",
+      "notes": "",
+      "versus": ""
+    }
+  }]
+}

+ 24 - 0
leda/setup.py

@@ -0,0 +1,24 @@
+import subprocess
+import sys
+import setup_util
+import os
+
+def start(args, logfile, errfile):
+  subprocess.Popen('leda app.moon', shell=True, cwd="leda", stderr=errfile, stdout=logfile)
+
+  return 0
+
+def stop(logfile, errfile):
+  
+  p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
+  out, err = p.communicate()
+  for line in out.splitlines():
+    if 'app.moon' in line:
+      try:
+        pid = int(line.split(None, 2)[1])
+        os.kill(pid, 15)
+      except OSError:
+        pass
+
+
+  return 0

+ 1 - 0
leda/source_code

@@ -0,0 +1 @@
+./leda/app.moon