Get most tests running for Python
This commit is contained in:
		
							parent
							
								
									80119ba66d
								
							
						
					
					
						commit
						785acda4a9
					
				|  | @ -4,6 +4,7 @@ import * as WebSocket from "ws"; | ||||||
| 
 | 
 | ||||||
| import * as pty from "node-pty"; | import * as pty from "node-pty"; | ||||||
| import { IPty } from "node-pty"; | import { IPty } from "node-pty"; | ||||||
|  | import PQueue from "p-queue"; | ||||||
| import * as rpc from "vscode-jsonrpc"; | import * as rpc from "vscode-jsonrpc"; | ||||||
| import { v4 as getUUID } from "uuid"; | import { v4 as getUUID } from "uuid"; | ||||||
| 
 | 
 | ||||||
|  | @ -44,6 +45,8 @@ export class Session { | ||||||
| 
 | 
 | ||||||
|   logPrimitive: (msg: string) => void; |   logPrimitive: (msg: string) => void; | ||||||
| 
 | 
 | ||||||
|  |   msgQueue: PQueue = new PQueue({ concurrency: 1 }); | ||||||
|  | 
 | ||||||
|   get homedir() { |   get homedir() { | ||||||
|     return `/tmp/riju/${this.uuid}`; |     return `/tmp/riju/${this.uuid}`; | ||||||
|   } |   } | ||||||
|  | @ -158,7 +161,9 @@ export class Session { | ||||||
|         ); |         ); | ||||||
|         this.send({ event: "lspStarted", root: this.homedir }); |         this.send({ event: "lspStarted", root: this.homedir }); | ||||||
|       } |       } | ||||||
|       this.ws.on("message", this.receive); |       this.ws.on("message", (msg: string) => | ||||||
|  |         this.msgQueue.add(() => this.receive(msg)) | ||||||
|  |       ); | ||||||
|       this.ws.on("close", async () => { |       this.ws.on("close", async () => { | ||||||
|         await this.teardown(); |         await this.teardown(); | ||||||
|       }); |       }); | ||||||
|  |  | ||||||
|  | @ -1388,8 +1388,14 @@ main = do | ||||||
|         }, |         }, | ||||||
|       }, |       }, | ||||||
|     }, |     }, | ||||||
|     template: `print('Hello, world!')
 |     template: `print("Hello, world!")
 | ||||||
| `,
 | `,
 | ||||||
|  |     test: { | ||||||
|  |       format: { | ||||||
|  |         input: `print('Hello, world!')
 | ||||||
|  | `,
 | ||||||
|  |       }, | ||||||
|  |     }, | ||||||
|   }, |   }, | ||||||
|   قلب: { |   قلب: { | ||||||
|     aliases: ["qalb"], |     aliases: ["qalb"], | ||||||
|  |  | ||||||
|  | @ -86,6 +86,9 @@ class Test { | ||||||
|         case "repl": |         case "repl": | ||||||
|           await this.testRepl(); |           await this.testRepl(); | ||||||
|           break; |           break; | ||||||
|  |         case "runrepl": | ||||||
|  |           await this.testRunRepl(); | ||||||
|  |           break; | ||||||
|         case "scope": |         case "scope": | ||||||
|           await this.testScope(); |           await this.testScope(); | ||||||
|           break; |           break; | ||||||
|  | @ -265,18 +268,48 @@ async function main() { | ||||||
|       [lang, test].concat(langs[lang].aliases || []).includes(arg) |       [lang, test].concat(langs[lang].aliases || []).includes(arg) | ||||||
|     ); |     ); | ||||||
|   } |   } | ||||||
|  |   if (tests.length === 0) { | ||||||
|  |     console.error("no tests selected"); | ||||||
|  |     process.exit(1); | ||||||
|  |   } | ||||||
|  |   const lintSeen = new Set(); | ||||||
|  |   let lintPassed = 0; | ||||||
|  |   let lintFailed = 0; | ||||||
|  |   for (const { lang } of tests) { | ||||||
|  |     if (!lintSeen.has(lang)) { | ||||||
|  |       lintSeen.add(lang); | ||||||
|  |       console.error(`===== LANGUAGE ${lang}, LINT`); | ||||||
|  |       try { | ||||||
|  |         lint(lang); | ||||||
|  |         console.error("passed"); | ||||||
|  |         lintPassed += 1; | ||||||
|  |       } catch (err) { | ||||||
|  |         console.error("failed"); | ||||||
|  |         console.error(err); | ||||||
|  |         lintFailed += 1; | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |   if (lintFailed) { | ||||||
|  |     process.exit(1); | ||||||
|  |   } | ||||||
|  |   let passed = 0; | ||||||
|  |   let failed = 0; | ||||||
|   for (const { lang, test: type } of tests) { |   for (const { lang, test: type } of tests) { | ||||||
|     console.error(`===== LANGUAGE ${lang}, TEST ${type}`); |     console.error(`===== LANGUAGE ${lang}, TEST ${type}`); | ||||||
|     const test = new Test(lang, type); |     const test = new Test(lang, type); | ||||||
|     try { |     try { | ||||||
|       await test.run(); |       await test.run(); | ||||||
|       console.error("succeeded"); |       console.error("passed"); | ||||||
|  |       passed += 1; | ||||||
|     } catch (err) { |     } catch (err) { | ||||||
|       console.error("failed:"); |       console.error("failed"); | ||||||
|       console.error(test.getLog()); |       console.error(test.getLog()); | ||||||
|       console.error(err); |       console.error(err); | ||||||
|  |       failed += 1; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |   process.exit(failed ? 1 : 0); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| main().catch(console.error); | main().catch(console.error); | ||||||
|  |  | ||||||
|  | @ -33,6 +33,7 @@ | ||||||
|     "monaco-languageclient": "^0.13.0", |     "monaco-languageclient": "^0.13.0", | ||||||
|     "node-pty": "^0.9.0", |     "node-pty": "^0.9.0", | ||||||
|     "npm-run-all": "^4.1.5", |     "npm-run-all": "^4.1.5", | ||||||
|  |     "p-queue": "^6.6.0", | ||||||
|     "parse-passwd": "^1.0.0", |     "parse-passwd": "^1.0.0", | ||||||
|     "shell-quote": "^1.7.2", |     "shell-quote": "^1.7.2", | ||||||
|     "style-loader": "^1.2.1", |     "style-loader": "^1.2.1", | ||||||
|  |  | ||||||
							
								
								
									
										20
									
								
								yarn.lock
								
								
								
								
							
							
						
						
									
										20
									
								
								yarn.lock
								
								
								
								
							|  | @ -2118,6 +2118,11 @@ etag@~1.8.1: | ||||||
|   resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" |   resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" | ||||||
|   integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= |   integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= | ||||||
| 
 | 
 | ||||||
|  | eventemitter3@^4.0.4: | ||||||
|  |   version "4.0.4" | ||||||
|  |   resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.4.tgz#b5463ace635a083d018bdc7c917b4c5f10a85384" | ||||||
|  |   integrity sha512-rlaVLnVxtxvoyLsQQFBx53YmXHDxRIzzTLbdfxqi4yocpSjAxXwkU0cScM5JgSKMqEhrZpnvQ2D9gjylR0AimQ== | ||||||
|  | 
 | ||||||
| events@^3.0.0: | events@^3.0.0: | ||||||
|   version "3.1.0" |   version "3.1.0" | ||||||
|   resolved "https://registry.yarnpkg.com/events/-/events-3.1.0.tgz#84279af1b34cb75aa88bf5ff291f6d0bd9b31a59" |   resolved "https://registry.yarnpkg.com/events/-/events-3.1.0.tgz#84279af1b34cb75aa88bf5ff291f6d0bd9b31a59" | ||||||
|  | @ -3659,6 +3664,21 @@ p-locate@^3.0.0: | ||||||
|   dependencies: |   dependencies: | ||||||
|     p-limit "^2.0.0" |     p-limit "^2.0.0" | ||||||
| 
 | 
 | ||||||
|  | p-queue@^6.6.0: | ||||||
|  |   version "6.6.0" | ||||||
|  |   resolved "https://registry.yarnpkg.com/p-queue/-/p-queue-6.6.0.tgz#263f2b73add4cefca81d8d6b2696ee74b326de2f" | ||||||
|  |   integrity sha512-zPHXPNy9jZsiym0PpJjvnHQysx1fSd/QdaNVwiDRLU2KFChD6h9CkCB6b8i3U8lBwJyA+mHgNZCzcy77glUssQ== | ||||||
|  |   dependencies: | ||||||
|  |     eventemitter3 "^4.0.4" | ||||||
|  |     p-timeout "^3.1.0" | ||||||
|  | 
 | ||||||
|  | p-timeout@^3.1.0: | ||||||
|  |   version "3.2.0" | ||||||
|  |   resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-3.2.0.tgz#c7e17abc971d2a7962ef83626b35d635acf23dfe" | ||||||
|  |   integrity sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg== | ||||||
|  |   dependencies: | ||||||
|  |     p-finally "^1.0.0" | ||||||
|  | 
 | ||||||
| p-try@^1.0.0: | p-try@^1.0.0: | ||||||
|   version "1.0.0" |   version "1.0.0" | ||||||
|   resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" |   resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Radon Rosborough
						Radon Rosborough