mumuki-qsim-runner 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/checker.rb +24 -0
- data/lib/html_renderer.rb +14 -0
- data/lib/metadata_hook.rb +18 -0
- data/lib/qsim_runner.rb +18 -0
- data/lib/records.html.erb +28 -0
- data/lib/test_hook.rb +50 -0
- metadata +134 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 480cb87550e38dddd05b4d6080ccd894d6576098
|
4
|
+
data.tar.gz: db3a0e50c5b7046f25ff880cbc6ac21812ae81a6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: accc4c01e7b76ed6bc9e944167fbb68d67557cb5fbe33e53dadb88976c0c8c46c65b4880e9a523d0d009b673f50dce40f9b3f06b22f74631c39f7042ca65d80a
|
7
|
+
data.tar.gz: 52e07236fd148facdf657e63fc0dfc02232983874aabb319c833095655e753b93030a73b3749fdf3a88e5675158e56c63b15ac3307c7616e3b5f227b75b32652
|
data/lib/checker.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
module Qsim
|
2
|
+
class Checker < Mumukit::Metatest::Checker
|
3
|
+
def check_equal(result, records)
|
4
|
+
records.each do |record, expected|
|
5
|
+
actual = result[:records][record]
|
6
|
+
fail I18n.t :check_equal_failure, {record: record, expected: expected, actual: actual} unless actual == expected
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def render_success_output(result)
|
11
|
+
renderer.render result
|
12
|
+
end
|
13
|
+
|
14
|
+
def render_error_output(result, error)
|
15
|
+
"#{error}\n#{renderer.render result}"
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def renderer
|
21
|
+
@renderer ||= Qsim::HtmlRenderer.new
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class QsimMetadataHook < Mumukit::Hook
|
2
|
+
def metadata
|
3
|
+
{
|
4
|
+
language: {
|
5
|
+
name: 'qsim',
|
6
|
+
icon: {type: 'devicon', name: 'qsim'},
|
7
|
+
version: 'v0.2.2',
|
8
|
+
extension: 'qsim',
|
9
|
+
ace_mode: 'assembly_x86',
|
10
|
+
graphic: true
|
11
|
+
},
|
12
|
+
test_framework: {
|
13
|
+
name: 'metatest',
|
14
|
+
test_extension: 'yml'
|
15
|
+
}
|
16
|
+
}
|
17
|
+
end
|
18
|
+
end
|
data/lib/qsim_runner.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'i18n'
|
2
|
+
require 'mumukit'
|
3
|
+
require 'mumukit'
|
4
|
+
require 'erb'
|
5
|
+
|
6
|
+
I18n.load_path += Dir[File.join('.', 'locales', '*.yml')]
|
7
|
+
|
8
|
+
Mumukit.runner_name = 'qsim'
|
9
|
+
Mumukit.configure do |config|
|
10
|
+
config.docker_image = 'mumuki/mumuki-qsim-worker'
|
11
|
+
config.content_type = 'html'
|
12
|
+
config.structured = true
|
13
|
+
end
|
14
|
+
|
15
|
+
require_relative './test_hook'
|
16
|
+
require_relative './metadata_hook'
|
17
|
+
require_relative './checker'
|
18
|
+
require_relative './html_renderer'
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<style>
|
2
|
+
table.qsim-records {
|
3
|
+
max-width: 10%;
|
4
|
+
display: inline-block;
|
5
|
+
border: none;
|
6
|
+
}
|
7
|
+
|
8
|
+
td.qsim-record-name {
|
9
|
+
background-color: #ecf0f1;
|
10
|
+
font-weight: bold;
|
11
|
+
width: 1%;
|
12
|
+
white-space: nowrap;
|
13
|
+
}
|
14
|
+
</style>
|
15
|
+
|
16
|
+
<h5><%=I18n.t :records %></h5>
|
17
|
+
<% @result[:records].each_slice(4) do |group| %>
|
18
|
+
<table class="table table-bordered qsim-records">
|
19
|
+
<tbody>
|
20
|
+
<% group.each do |name, value| %>
|
21
|
+
<tr>
|
22
|
+
<td class="qsim-record-name"><%= name %></td>
|
23
|
+
<td class="text-center"><%= value %></td>
|
24
|
+
</tr>
|
25
|
+
<% end %>
|
26
|
+
</tbody>
|
27
|
+
</table>
|
28
|
+
<% end %>
|
data/lib/test_hook.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
class QsimTestHook < Mumukit::Templates::FileHook
|
2
|
+
isolated true
|
3
|
+
mashup :extra, :content
|
4
|
+
|
5
|
+
def tempfile_extension
|
6
|
+
'.qsim'
|
7
|
+
end
|
8
|
+
|
9
|
+
def command_line(filename)
|
10
|
+
"runqsim #{filename} 6"
|
11
|
+
end
|
12
|
+
|
13
|
+
def compile_file_content(request)
|
14
|
+
@examples = parse_test(request)[:examples]
|
15
|
+
(super request).strip
|
16
|
+
end
|
17
|
+
|
18
|
+
def execute!(request)
|
19
|
+
result, _ = run_file! compile request
|
20
|
+
parse_json result
|
21
|
+
end
|
22
|
+
|
23
|
+
def post_process_file(file, result, status)
|
24
|
+
output = parse_json result
|
25
|
+
|
26
|
+
case status
|
27
|
+
when :passed
|
28
|
+
framework.test output, @examples
|
29
|
+
when :failed
|
30
|
+
[output[:error], :errored]
|
31
|
+
else
|
32
|
+
[output, status]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def framework
|
39
|
+
Mumukit::Metatest::Framework.new checker: Qsim::Checker.new,
|
40
|
+
runner: Mumukit::Metatest::IdentityRunner.new
|
41
|
+
end
|
42
|
+
|
43
|
+
def parse_json(json_result)
|
44
|
+
JSON.parse(json_result).deep_symbolize_keys
|
45
|
+
end
|
46
|
+
|
47
|
+
def parse_test(request)
|
48
|
+
YAML.load(request.test).deep_symbolize_keys
|
49
|
+
end
|
50
|
+
end
|
metadata
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mumuki-qsim-runner
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Franco Leonardo Bulgarelli
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-09-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: mumukit
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.4'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.4'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: codeclimate-test-reporter
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: mumukit-bridge
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.3'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.3'
|
97
|
+
description:
|
98
|
+
email:
|
99
|
+
- franco@mumuki.org
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- lib/checker.rb
|
105
|
+
- lib/html_renderer.rb
|
106
|
+
- lib/metadata_hook.rb
|
107
|
+
- lib/qsim_runner.rb
|
108
|
+
- lib/records.html.erb
|
109
|
+
- lib/test_hook.rb
|
110
|
+
homepage: http://github.com/mumuki/mumuki-qsim-server
|
111
|
+
licenses:
|
112
|
+
- MIT
|
113
|
+
metadata: {}
|
114
|
+
post_install_message:
|
115
|
+
rdoc_options: []
|
116
|
+
require_paths:
|
117
|
+
- lib
|
118
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
requirements: []
|
129
|
+
rubyforge_project:
|
130
|
+
rubygems_version: 2.4.8
|
131
|
+
signing_key:
|
132
|
+
specification_version: 4
|
133
|
+
summary: Qsim Runner for Mumuki
|
134
|
+
test_files: []
|