rbx.cp 0.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. rbx/__init__.py +0 -0
  2. rbx/annotations.py +127 -0
  3. rbx/autoenum.py +333 -0
  4. rbx/box/__init__.py +0 -0
  5. rbx/box/builder.py +77 -0
  6. rbx/box/cd.py +37 -0
  7. rbx/box/checkers.py +134 -0
  8. rbx/box/code.py +185 -0
  9. rbx/box/compile.py +56 -0
  10. rbx/box/conftest.py +42 -0
  11. rbx/box/contest/__init__.py +0 -0
  12. rbx/box/contest/build_contest_statements.py +347 -0
  13. rbx/box/contest/contest_package.py +76 -0
  14. rbx/box/contest/contest_utils.py +20 -0
  15. rbx/box/contest/main.py +179 -0
  16. rbx/box/contest/schema.py +155 -0
  17. rbx/box/contest/statements.py +82 -0
  18. rbx/box/creation.py +72 -0
  19. rbx/box/download.py +64 -0
  20. rbx/box/environment.py +345 -0
  21. rbx/box/extensions.py +26 -0
  22. rbx/box/generators.py +478 -0
  23. rbx/box/generators_test.py +63 -0
  24. rbx/box/main.py +449 -0
  25. rbx/box/package.py +316 -0
  26. rbx/box/packaging/boca/extension.py +27 -0
  27. rbx/box/packaging/boca/packager.py +245 -0
  28. rbx/box/packaging/contest_main.py +82 -0
  29. rbx/box/packaging/main.py +68 -0
  30. rbx/box/packaging/packager.py +117 -0
  31. rbx/box/packaging/polygon/packager.py +320 -0
  32. rbx/box/packaging/polygon/test.py +81 -0
  33. rbx/box/packaging/polygon/xml_schema.py +106 -0
  34. rbx/box/presets/__init__.py +503 -0
  35. rbx/box/presets/fetch.py +70 -0
  36. rbx/box/presets/lock_schema.py +20 -0
  37. rbx/box/presets/schema.py +59 -0
  38. rbx/box/schema.py +394 -0
  39. rbx/box/solutions.py +792 -0
  40. rbx/box/solutions_test.py +41 -0
  41. rbx/box/statements/__init__.py +0 -0
  42. rbx/box/statements/build_statements.py +359 -0
  43. rbx/box/statements/builders.py +375 -0
  44. rbx/box/statements/joiners.py +113 -0
  45. rbx/box/statements/latex.py +47 -0
  46. rbx/box/statements/latex_jinja.py +214 -0
  47. rbx/box/statements/schema.py +138 -0
  48. rbx/box/stresses.py +292 -0
  49. rbx/box/stressing/__init__.py +0 -0
  50. rbx/box/stressing/finder_parser.py +359 -0
  51. rbx/box/stressing/generator_parser.py +258 -0
  52. rbx/box/testcases.py +54 -0
  53. rbx/box/ui/__init__.py +0 -0
  54. rbx/box/ui/captured_log.py +372 -0
  55. rbx/box/ui/css/app.tcss +48 -0
  56. rbx/box/ui/main.py +38 -0
  57. rbx/box/ui/run.py +209 -0
  58. rbx/box/validators.py +245 -0
  59. rbx/box/validators_test.py +15 -0
  60. rbx/checker.py +128 -0
  61. rbx/clone.py +197 -0
  62. rbx/config.py +271 -0
  63. rbx/conftest.py +38 -0
  64. rbx/console.py +27 -0
  65. rbx/create.py +37 -0
  66. rbx/edit.py +24 -0
  67. rbx/grading/__init__.py +0 -0
  68. rbx/grading/caching.py +356 -0
  69. rbx/grading/conftest.py +33 -0
  70. rbx/grading/judge/__init__.py +0 -0
  71. rbx/grading/judge/cacher.py +503 -0
  72. rbx/grading/judge/digester.py +35 -0
  73. rbx/grading/judge/sandbox.py +748 -0
  74. rbx/grading/judge/sandboxes/__init__.py +0 -0
  75. rbx/grading/judge/sandboxes/isolate.py +683 -0
  76. rbx/grading/judge/sandboxes/stupid_sandbox.py +310 -0
  77. rbx/grading/judge/sandboxes/timeit.py +217 -0
  78. rbx/grading/judge/storage.py +284 -0
  79. rbx/grading/judge/test.py +38 -0
  80. rbx/grading/judge/testiso.py +54 -0
  81. rbx/grading/steps.py +522 -0
  82. rbx/grading/steps_with_caching.py +59 -0
  83. rbx/grading/steps_with_caching_run_test.py +429 -0
  84. rbx/grading_utils.py +148 -0
  85. rbx/hydration.py +101 -0
  86. rbx/main.py +122 -0
  87. rbx/metadata.py +105 -0
  88. rbx/providers/__init__.py +43 -0
  89. rbx/providers/codeforces.py +73 -0
  90. rbx/providers/provider.py +26 -0
  91. rbx/resources/checkers/boilerplate.cpp +20 -0
  92. rbx/resources/default_config.json +48 -0
  93. rbx/resources/envs/default.rbx.yml +37 -0
  94. rbx/resources/envs/isolate.rbx.yml +37 -0
  95. rbx/resources/packagers/boca/checker.sh +43 -0
  96. rbx/resources/packagers/boca/compare +53 -0
  97. rbx/resources/packagers/boca/compile/c +172 -0
  98. rbx/resources/packagers/boca/compile/cc +173 -0
  99. rbx/resources/packagers/boca/compile/cpp +172 -0
  100. rbx/resources/packagers/boca/compile/java +194 -0
  101. rbx/resources/packagers/boca/compile/kt +155 -0
  102. rbx/resources/packagers/boca/compile/pas +172 -0
  103. rbx/resources/packagers/boca/compile/py2 +173 -0
  104. rbx/resources/packagers/boca/compile/py3 +173 -0
  105. rbx/resources/packagers/boca/run/c +128 -0
  106. rbx/resources/packagers/boca/run/cc +128 -0
  107. rbx/resources/packagers/boca/run/cpp +128 -0
  108. rbx/resources/packagers/boca/run/java +194 -0
  109. rbx/resources/packagers/boca/run/kt +159 -0
  110. rbx/resources/packagers/boca/run/py2 +166 -0
  111. rbx/resources/packagers/boca/run/py3 +166 -0
  112. rbx/resources/presets/default/contest/contest.rbx.yml +14 -0
  113. rbx/resources/presets/default/contest/statement/contest.rbx.tex +97 -0
  114. rbx/resources/presets/default/contest/statement/olymp.sty +250 -0
  115. rbx/resources/presets/default/contest/statement/template.rbx.tex +42 -0
  116. rbx/resources/presets/default/preset.rbx.yml +12 -0
  117. rbx/resources/presets/default/problem/.gitignore +6 -0
  118. rbx/resources/presets/default/problem/gen.cpp +9 -0
  119. rbx/resources/presets/default/problem/problem.rbx.yml +44 -0
  120. rbx/resources/presets/default/problem/random.py +3 -0
  121. rbx/resources/presets/default/problem/random.txt +2 -0
  122. rbx/resources/presets/default/problem/sols/main.cpp +9 -0
  123. rbx/resources/presets/default/problem/sols/slow.cpp +15 -0
  124. rbx/resources/presets/default/problem/sols/wa.cpp +9 -0
  125. rbx/resources/presets/default/problem/statement/olymp.sty +250 -0
  126. rbx/resources/presets/default/problem/statement/projecao.png +0 -0
  127. rbx/resources/presets/default/problem/statement/statement.rbx.tex +18 -0
  128. rbx/resources/presets/default/problem/statement/template.rbx.tex +89 -0
  129. rbx/resources/presets/default/problem/tests/samples/000.in +1 -0
  130. rbx/resources/presets/default/problem/tests/samples/001.in +1 -0
  131. rbx/resources/presets/default/problem/validator.cpp +16 -0
  132. rbx/resources/presets/default/problem/wcmp.cpp +34 -0
  133. rbx/resources/templates/template.cpp +19 -0
  134. rbx/run.py +45 -0
  135. rbx/schema.py +64 -0
  136. rbx/submit.py +61 -0
  137. rbx/submitors/__init__.py +18 -0
  138. rbx/submitors/codeforces.py +120 -0
  139. rbx/submitors/submitor.py +25 -0
  140. rbx/test.py +347 -0
  141. rbx/testcase.py +70 -0
  142. rbx/testcase_rendering.py +79 -0
  143. rbx/testdata/box1/gen1.cpp +7 -0
  144. rbx/testdata/box1/gen2.cpp +9 -0
  145. rbx/testdata/box1/genScript.py +2 -0
  146. rbx/testdata/box1/hard-tle.sol.cpp +26 -0
  147. rbx/testdata/box1/ole.cpp +17 -0
  148. rbx/testdata/box1/problem.rbx.yml +39 -0
  149. rbx/testdata/box1/re.sol.cpp +23 -0
  150. rbx/testdata/box1/sol.cpp +22 -0
  151. rbx/testdata/box1/tests/1.in +1 -0
  152. rbx/testdata/box1/tle-and-incorrect.sol.cpp +33 -0
  153. rbx/testdata/box1/tle.sol.cpp +35 -0
  154. rbx/testdata/box1/validator.cpp +11 -0
  155. rbx/testdata/box1/wa.sol.cpp +22 -0
  156. rbx/testdata/caching/executable.py +1 -0
  157. rbx/testdata/compatible +0 -0
  158. rbx/testing_utils.py +65 -0
  159. rbx/utils.py +162 -0
  160. rbx_cp-0.5.0.dist-info/LICENSE +201 -0
  161. rbx_cp-0.5.0.dist-info/METADATA +89 -0
  162. rbx_cp-0.5.0.dist-info/RECORD +164 -0
  163. rbx_cp-0.5.0.dist-info/WHEEL +4 -0
  164. rbx_cp-0.5.0.dist-info/entry_points.txt +4 -0
@@ -0,0 +1,194 @@
1
+ #!/bin/bash
2
+ # ////////////////////////////////////////////////////////////////////////////////
3
+ # //BOCA Online Contest Administrator
4
+ # // Copyright (C) 2003-2014 by BOCA System (bocasystem@gmail.com)
5
+ # //
6
+ # // This program is free software: you can redistribute it and/or modify
7
+ # // it under the terms of the GNU General Public License as published by
8
+ # // the Free Software Foundation, either version 3 of the License, or
9
+ # // (at your option) any later version.
10
+ # //
11
+ # // This program is distributed in the hope that it will be useful,
12
+ # // but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # // GNU General Public License for more details.
15
+ # // You should have received a copy of the GNU General Public License
16
+ # // along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ # ////////////////////////////////////////////////////////////////////////////////
18
+ #Last modified: 04/nov/2014 by cassio@ime.usp.br
19
+ #
20
+ # parameters are:
21
+ # $1 main_class
22
+ # $2 input_file
23
+ # $3 timelimit (limit to run all the repetitions, by default only one repetition)
24
+ # $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit)
25
+ # $5 maximum allowed memory (in MBytes)
26
+ # $6 maximum allowed output size (in KBytes)
27
+ #
28
+ # the output of the submission should be directed to the standard output
29
+ #
30
+ # the return code show what happened (according to safeexec):
31
+ # 0 ok
32
+ # 1 compile error
33
+ # 2 runtime error
34
+ # 3 timelimit exceeded
35
+ # 4 internal error
36
+ # 5 parameter error
37
+ # 6 internal error
38
+ # 7 memory limit exceeded
39
+ # 8 security threat
40
+ # 9 runtime error
41
+ # other_codes are unknown to boca: in this case BOCA will present the
42
+ # last line of standard output to the judge
43
+
44
+ umask 0022
45
+ id -u bocajail >/dev/null 2>/dev/null
46
+ if [ $? == 0 ]; then
47
+ bocau=`id -u bocajail`
48
+ bocag=`id -g bocajail`
49
+ chown bocajail.nogroup .
50
+ else
51
+ bocau=`id -u nobody`
52
+ bocag=`id -g nobody`
53
+ chown nobody.nogroup .
54
+ fi
55
+ if [ "$bocau" == "" -o "$bocag" == "" ]; then
56
+ echo "error finding user to run script"
57
+ exit 43
58
+ fi
59
+
60
+ # this script makes use of safeexec to execute the code with less privilegies
61
+ # make sure that directories below are correct.
62
+ sf=`which safeexec`
63
+ [ -x "$sf" ] || sf=/usr/bin/safeexec
64
+
65
+ if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then
66
+ echo "parameter problem"
67
+ exit 43
68
+ fi
69
+ if [ -r run.exe ]; then
70
+ rm -f run.jar
71
+ cp run.exe run.jar
72
+ fi
73
+ if [ -r "$1" ]; then
74
+ rm -f run.jar
75
+ cp "$1" run.jar
76
+ fi
77
+ if [ ! -r run.jar ]; then
78
+ echo "ERROR: file run.jar not found - possible error during compilation"
79
+ exit 1
80
+ fi
81
+ name=`basename "$1"`
82
+ if [ "${name##*.}" == "class" -a "${name##*.}" == "CLASS" ]; then
83
+ echo "WARNING: removing .class file extension"
84
+ fi
85
+ if [ "${name##*.}" == "class" ]; then
86
+ name=`basename "$1" .class`
87
+ fi
88
+ if [ "${name##*.}" == "CLASS" ]; then
89
+ name=`basename "$1" .CLASS`
90
+ fi
91
+ if [ ! -r "$2" ]; then
92
+ echo "$2 not found (or is not in the current dir) or it's not readable"
93
+ exit 45
94
+ fi
95
+ if [ ! -x "$sf" ]; then
96
+ echo "$sf not found or it's not executable"
97
+ exit 46
98
+ fi
99
+
100
+ time=$3
101
+ if [ "$time" -gt "0" ]; then
102
+ let "ttime = $time + 30"
103
+ else
104
+ time=1
105
+ ttime=30
106
+ fi
107
+
108
+ nruns=1
109
+ if [ "$4" != "" ]; then
110
+ if [ "$4" -gt "0" ]; then
111
+ nruns=$4
112
+ fi
113
+ fi
114
+ maxm=512000
115
+ if [ "$5" != "" ]; then
116
+ if [ "$5" -gt "0" ]; then
117
+ maxm=${5}000
118
+ fi
119
+ fi
120
+ let "maxms = $maxm / 10"
121
+ maxf=1024
122
+ if [ "$6" != "" ]; then
123
+ if [ "$6" -gt "0" ]; then
124
+ maxf=${6}
125
+ fi
126
+ fi
127
+
128
+ rm -f runit.retcode 2>/dev/null
129
+ cp "$2" stdin0 2>/dev/null
130
+
131
+ cdir=`pwd`
132
+ echo "Current directory is $cdir" >&2
133
+ echo $cdir | grep -q "/bocajail"
134
+ if [ $? == 0 ]; then
135
+ cdir=`echo $cdir | sed "s/.*\/bocajail//"`
136
+ cat <<EOF > runit.sh
137
+ #!/bin/bash
138
+ cd "$cdir"
139
+ [ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc
140
+ #/bin/mount --bind /dev /dev
141
+ [ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys
142
+ java=`which java`
143
+ [ -x "\$java" ] || java=/usr/bin/java
144
+ if [ ! -x "\$java" ]; then
145
+ echo "\$java not found or it's not executable"
146
+ exit 47
147
+ fi
148
+ export CLASSPATH=.:./run.jar:$CLASSPATH
149
+ "$sf" -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -ostdout0 -estderr0 -U$bocau -G$bocag -n0 -C. -f20000 -d20000000 -m20000000 -- "\$java" -Xmx${maxm}K -Xss${maxms}K -Xms${maxm}K "$name"
150
+ retval=\$?
151
+ echo \$retval > runit.retcode
152
+ if [ ! -d /bocajail ]; then
153
+ /bin/umount /proc 2>/dev/null
154
+ #/bin/umount /dev
155
+ /bin/umount /sys 2>/dev/null
156
+ fi
157
+ EOF
158
+ chmod 755 runit.sh
159
+ chroot /bocajail "$cdir/runit.sh"
160
+ if [ -r runit.retcode ]; then
161
+ ret=`cat runit.retcode`
162
+ fi
163
+ if [ "$ret" == "" ]; then
164
+ echo "Execution error - check autojudging"
165
+ exit 49
166
+ fi
167
+ else
168
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
169
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
170
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
171
+ java=`which java`
172
+ [ -x "$java" ] || java=/usr/bin/java
173
+ if [ ! -x "$java" ]; then
174
+ echo "$java not found or it's not executable"
175
+ exit 47
176
+ fi
177
+ "$sf" -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d20000000 -m20000000 -- "$java" -cp run.jar -Xmx${maxm}K -Xss${maxms}K -Xms${maxm}K "$name"
178
+ ret=$?
179
+ fi
180
+ if [ $ret -gt 10 ]; then
181
+ if [ -r stderr0 ]; then
182
+ grep -q "not find or load main class" stderr0
183
+ if [ $? == 0 ]; then
184
+ echo "> > > Nonzero return code - possible class name mismatch - do check < < <"
185
+ else
186
+ echo "> > > Nonzero return code - possible runtime error - do check < < <"
187
+ fi
188
+ ret=9
189
+ fi
190
+ fi
191
+ if [ -f stdout0 ]; then
192
+ cat stdout0
193
+ fi
194
+ exit $ret
@@ -0,0 +1,159 @@
1
+ #!/bin/bash
2
+ # ////////////////////////////////////////////////////////////////////////////////
3
+ # //BOCA Online Contest Administrator
4
+ # // Copyright (C) 2003-2014 by BOCA System (bocasystem@gmail.com)
5
+ # //
6
+ # // This program is free software: you can redistribute it and/or modify
7
+ # // it under the terms of the GNU General Public License as published by
8
+ # // the Free Software Foundation, either version 3 of the License, or
9
+ # // (at your option) any later version.
10
+ # //
11
+ # // This program is distributed in the hope that it will be useful,
12
+ # // but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # // GNU General Public License for more details.
15
+ # // You should have received a copy of the GNU General Public License
16
+ # // along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ # ////////////////////////////////////////////////////////////////////////////////
18
+ #Last modified: 04/nov/2014 by cassio@ime.usp.br
19
+ #
20
+ # parameters are:
21
+ # $1 main_class
22
+ # $2 input_file
23
+ # $3 timelimit (limit to run all the repetitions, by default only one repetition)
24
+ # $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit)
25
+ # $5 maximum allowed memory (in MBytes)
26
+ # $6 maximum allowed output size (in KBytes)
27
+ #
28
+ # the output of the submission should be directed to the standard output
29
+ #
30
+ # the return code show what happened (according to safeexec):
31
+ # 0 ok
32
+ # 1 compile error
33
+ # 2 runtime error
34
+ # 3 timelimit exceeded
35
+ # 4 internal error
36
+ # 5 parameter error
37
+ # 6 internal error
38
+ # 7 memory limit exceeded
39
+ # 8 security threat
40
+ # 9 runtime error
41
+ # other_codes are unknown to boca: in this case BOCA will present the
42
+ # last line of standard output to the judge
43
+
44
+ umask 0022
45
+ id -u bocajail >/dev/null 2>/dev/null
46
+ if [ $? == 0 ]; then
47
+ bocau=`id -u bocajail`
48
+ bocag=`id -g bocajail`
49
+ chown bocajail.nogroup .
50
+ else
51
+ bocau=`id -u nobody`
52
+ bocag=`id -g nobody`
53
+ chown nobody.nogroup .
54
+ fi
55
+ if [ "$bocau" == "" -o "$bocag" == "" ]; then
56
+ echo "error finding user to run script"
57
+ exit 43
58
+ fi
59
+
60
+ # this script makes use of safeexec to execute the code with less privilegies
61
+ # make sure that directories below are correct.
62
+ sf=`which safeexec`
63
+ [ -x "$sf" ] || sf=/usr/bin/safeexec
64
+
65
+ if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then
66
+ echo "parameter problem"
67
+ exit 43
68
+ fi
69
+ if [ -r run.exe ]; then
70
+ rm -f run.jar
71
+ cp run.exe run.jar
72
+ fi
73
+ if [ -r "$1" ]; then
74
+ rm -f run.jar
75
+ cp "$1" run.jar
76
+ fi
77
+ if [ ! -r run.jar ]; then
78
+ echo "ERROR: file run.jar not found - possible error during compilation"
79
+ exit 1
80
+ fi
81
+ name=`basename "$1"`
82
+ if [ "${name##*.}" == "class" -a "${name##*.}" == "CLASS" ]; then
83
+ echo "WARNING: removing .class file extension"
84
+ fi
85
+ if [ "${name##*.}" == "class" ]; then
86
+ name=`basename "$1" .class`
87
+ fi
88
+ if [ "${name##*.}" == "CLASS" ]; then
89
+ name=`basename "$1" .CLASS`
90
+ fi
91
+ if [ ! -r "$2" ]; then
92
+ echo "$2 not found (or is not in the current dir) or it's not readable"
93
+ exit 45
94
+ fi
95
+ if [ ! -x "$sf" ]; then
96
+ echo "$sf not found or it's not executable"
97
+ exit 46
98
+ fi
99
+
100
+ time=$3
101
+ if [ "$time" -gt "0" ]; then
102
+ let "ttime = $time + 30"
103
+ else
104
+ time=1
105
+ ttime=30
106
+ fi
107
+
108
+ nruns=1
109
+ if [ "$4" != "" ]; then
110
+ if [ "$4" -gt "0" ]; then
111
+ nruns=$4
112
+ fi
113
+ fi
114
+ maxm=1024000
115
+ if [ "$5" != "" ]; then
116
+ if [ "$5" -gt "0" ]; then
117
+ maxm=${5}000
118
+ fi
119
+ fi
120
+ let "maxms = $maxm / 10"
121
+ maxf=1024
122
+ if [ "$6" != "" ]; then
123
+ if [ "$6" -gt "0" ]; then
124
+ maxf=${6}
125
+ fi
126
+ fi
127
+
128
+ rm -f runit.retcode 2>/dev/null
129
+ cp "$2" stdin0 2>/dev/null
130
+
131
+ cdir=`pwd`
132
+ echo "Current directory is $cdir" >&2
133
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
134
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
135
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
136
+ kotlin=/snap/kotlin/24/bin/kotlin
137
+ [ -x "$kotlin" ] || kotlin=/usr/bin/kotlin
138
+ if [ ! -x "$kotlin" ]; then
139
+ echo "$kotlin not found or it's not executable"
140
+ exit 47
141
+ fi
142
+ "$sf" -r$nruns -t$time -T$ttime -istdin0 -F512 -u512 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d40000000000 -m40000000000 -- "$kotlin" -cp run.jar -J-Xmx${maxm}K -J-Xss${maxms}K -J-Xms${maxm}K "$name"
143
+ #"$kotlin" -cp run.jar -J-Xmx${maxm}K -J-Xss${maxms}K -J-Xms${maxm}K "$name"
144
+ ret=$?
145
+ if [ $ret -gt 10 ]; then
146
+ if [ -r stderr0 ]; then
147
+ grep -q "not find or load main class" stderr0
148
+ if [ $? == 0 ]; then
149
+ echo "> > > Nonzero return code - possible class name mismatch - do check < < <"
150
+ else
151
+ echo "> > > Nonzero return code - possible runtime error - do check < < <"
152
+ fi
153
+ ret=9
154
+ fi
155
+ fi
156
+ if [ -f stdout0 ]; then
157
+ cat stdout0
158
+ fi
159
+ exit $ret
@@ -0,0 +1,166 @@
1
+ #!/bin/bash
2
+ # ////////////////////////////////////////////////////////////////////////////////
3
+ # //BOCA Online Contest Administrator
4
+ # // Copyright (C) 2003-2014 by BOCA System (bocasystem@gmail.com)
5
+ # //
6
+ # // This program is free software: you can redistribute it and/or modify
7
+ # // it under the terms of the GNU General Public License as published by
8
+ # // the Free Software Foundation, either version 3 of the License, or
9
+ # // (at your option) any later version.
10
+ # //
11
+ # // This program is distributed in the hope that it will be useful,
12
+ # // but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # // GNU General Public License for more details.
15
+ # // You should have received a copy of the GNU General Public License
16
+ # // along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ # ////////////////////////////////////////////////////////////////////////////////
18
+ #Last modified: 04/nov/2014 by cassio@ime.usp.br
19
+ #Last modified: 06/sep/2016 by brunoribas@utfpr.edu.br
20
+ #
21
+ # parameters are:
22
+ # $1 main_class
23
+ # $2 input_file
24
+ # $3 timelimit (limit to run all the repetitions, by default only one repetition)
25
+ # $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit)
26
+ # $5 maximum allowed memory (in MBytes)
27
+ # $6 maximum allowed output size (in KBytes)
28
+ #
29
+ # the output of the submission should be directed to the standard output
30
+ #
31
+ # the return code show what happened (according to safeexec):
32
+ # 0 ok
33
+ # 1 compile error
34
+ # 2 runtime error
35
+ # 3 timelimit exceeded
36
+ # 4 internal error
37
+ # 5 parameter error
38
+ # 6 internal error
39
+ # 7 memory limit exceeded
40
+ # 8 security threat
41
+ # 9 runtime error
42
+ # other_codes are unknown to boca: in this case BOCA will present the
43
+ # last line of standard output to the judge
44
+
45
+ umask 0022
46
+ id -u bocajail >/dev/null 2>/dev/null
47
+ if [ $? == 0 ]; then
48
+ bocau=`id -u bocajail`
49
+ bocag=`id -g bocajail`
50
+ chown bocajail.nogroup .
51
+ else
52
+ bocau=`id -u nobody`
53
+ bocag=`id -g nobody`
54
+ chown nobody.nogroup .
55
+ fi
56
+ if [ "$bocau" == "" -o "$bocag" == "" ]; then
57
+ echo "error finding user to run script"
58
+ exit 43
59
+ fi
60
+
61
+ # this script makes use of safeexec to execute the code with less privilegies
62
+ # make sure that directories below are correct.
63
+ sf=`which safeexec`
64
+ [ -x "$sf" ] || sf=/usr/bin/safeexec
65
+
66
+ if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then
67
+ echo "parameter problem"
68
+ exit 43
69
+ fi
70
+ name=`basename "$1"`
71
+ if [ ! -r "$2" ]; then
72
+ echo "$2 not found (or is not in the current dir) or it's not readable"
73
+ exit 45
74
+ fi
75
+ if [ ! -x "$sf" ]; then
76
+ echo "$sf not found or it's not executable"
77
+ exit 46
78
+ fi
79
+
80
+ time=$3
81
+ if [ "$time" -gt "0" ]; then
82
+ let "ttime = $time + 30"
83
+ else
84
+ time=1
85
+ ttime=30
86
+ fi
87
+
88
+ nruns=1
89
+ if [ "$4" != "" ]; then
90
+ if [ "$4" -gt "0" ]; then
91
+ nruns=$4
92
+ fi
93
+ fi
94
+ maxm=512000
95
+ if [ "$5" != "" ]; then
96
+ if [ "$5" -gt "0" ]; then
97
+ maxm=${5}000
98
+ fi
99
+ fi
100
+ let "maxms = $maxm / 10"
101
+ maxf=1024
102
+ if [ "$6" != "" ]; then
103
+ if [ "$6" -gt "0" ]; then
104
+ maxf=${6}
105
+ fi
106
+ fi
107
+
108
+ rm -f runit.retcode 2>/dev/null
109
+ cp "$2" stdin0 2>/dev/null
110
+
111
+ cdir=`pwd`
112
+ echo "Current directory is $cdir" >&2
113
+ echo $cdir | grep -q "/bocajail"
114
+ if [ $? == 0 ]; then
115
+ cdir=`echo $cdir | sed "s/.*\/bocajail//"`
116
+ cat <<EOF > runit.sh
117
+ #!/bin/bash
118
+ cd "$cdir"
119
+ [ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc
120
+ #/bin/mount --bind /dev /dev
121
+ [ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys
122
+ python2=`which python2`
123
+ [ -x "\$python2" ] || python2=/usr/bin/python2
124
+ if [ ! -x "\$python2" ]; then
125
+ echo "\$python2 not found or it's not executable"
126
+ exit 47
127
+ fi
128
+ "$sf" -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -ostdout0 -estderr0 -U$bocau -G$bocag -n0 -C. -f$maxf -d$maxm -m$maxm -- "\$python2" "$name"
129
+ retval=\$?
130
+ echo \$retval > runit.retcode
131
+ if [ ! -d /bocajail ]; then
132
+ /bin/umount /proc 2>/dev/null
133
+ #/bin/umount /dev
134
+ /bin/umount /sys 2>/dev/null
135
+ fi
136
+ EOF
137
+ chmod 755 runit.sh
138
+ chroot /bocajail "$cdir/runit.sh"
139
+ if [ -r runit.retcode ]; then
140
+ ret=`cat runit.retcode`
141
+ fi
142
+ if [ "$ret" == "" ]; then
143
+ echo "Execution error - check autojudging"
144
+ exit 49
145
+ fi
146
+ else
147
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
148
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
149
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
150
+ python2=`which python2`
151
+ [ -x "$python2" ] || python2=/usr/bin/python2
152
+ if [ ! -x "$python2" ]; then
153
+ echo "$python2 not found or it's not executable"
154
+ exit 47
155
+ fi
156
+ "$sf" -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d$maxm -m$maxm -f$maxf -- "$python2" "$name"
157
+ ret=$?
158
+ fi
159
+ if [ $ret -gt 10 ]; then
160
+ echo "> > > > > > > Nonzero return code - possible runtime error - I'M GUESSING IT IS RUNTIME ERROR < < < < < < < <"
161
+ ret=9
162
+ fi
163
+ if [ -f stdout0 ]; then
164
+ cat stdout0
165
+ fi
166
+ exit $ret
@@ -0,0 +1,166 @@
1
+ #!/bin/bash
2
+ # ////////////////////////////////////////////////////////////////////////////////
3
+ # //BOCA Online Contest Administrator
4
+ # // Copyright (C) 2003-2014 by BOCA System (bocasystem@gmail.com)
5
+ # //
6
+ # // This program is free software: you can redistribute it and/or modify
7
+ # // it under the terms of the GNU General Public License as published by
8
+ # // the Free Software Foundation, either version 3 of the License, or
9
+ # // (at your option) any later version.
10
+ # //
11
+ # // This program is distributed in the hope that it will be useful,
12
+ # // but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # // GNU General Public License for more details.
15
+ # // You should have received a copy of the GNU General Public License
16
+ # // along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ # ////////////////////////////////////////////////////////////////////////////////
18
+ #Last modified: 04/nov/2014 by cassio@ime.usp.br
19
+ #Last modified: 06/sep/2016 by brunoribas@utfpr.edu.br
20
+ #
21
+ # parameters are:
22
+ # $1 main_class
23
+ # $2 input_file
24
+ # $3 timelimit (limit to run all the repetitions, by default only one repetition)
25
+ # $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit)
26
+ # $5 maximum allowed memory (in MBytes)
27
+ # $6 maximum allowed output size (in KBytes)
28
+ #
29
+ # the output of the submission should be directed to the standard output
30
+ #
31
+ # the return code show what happened (according to safeexec):
32
+ # 0 ok
33
+ # 1 compile error
34
+ # 2 runtime error
35
+ # 3 timelimit exceeded
36
+ # 4 internal error
37
+ # 5 parameter error
38
+ # 6 internal error
39
+ # 7 memory limit exceeded
40
+ # 8 security threat
41
+ # 9 runtime error
42
+ # other_codes are unknown to boca: in this case BOCA will present the
43
+ # last line of standard output to the judge
44
+
45
+ umask 0022
46
+ id -u bocajail >/dev/null 2>/dev/null
47
+ if [ $? == 0 ]; then
48
+ bocau=`id -u bocajail`
49
+ bocag=`id -g bocajail`
50
+ chown bocajail.nogroup .
51
+ else
52
+ bocau=`id -u nobody`
53
+ bocag=`id -g nobody`
54
+ chown nobody.nogroup .
55
+ fi
56
+ if [ "$bocau" == "" -o "$bocag" == "" ]; then
57
+ echo "error finding user to run script"
58
+ exit 43
59
+ fi
60
+
61
+ # this script makes use of safeexec to execute the code with less privilegies
62
+ # make sure that directories below are correct.
63
+ sf=`which safeexec`
64
+ [ -x "$sf" ] || sf=/usr/bin/safeexec
65
+
66
+ if [ "$1" == "" -o "$2" == "" -o "$3" == "" ]; then
67
+ echo "parameter problem"
68
+ exit 43
69
+ fi
70
+ name=`basename "$1"`
71
+ if [ ! -r "$2" ]; then
72
+ echo "$2 not found (or is not in the current dir) or it's not readable"
73
+ exit 45
74
+ fi
75
+ if [ ! -x "$sf" ]; then
76
+ echo "$sf not found or it's not executable"
77
+ exit 46
78
+ fi
79
+
80
+ time=$3
81
+ if [ "$time" -gt "0" ]; then
82
+ let "ttime = $time + 30"
83
+ else
84
+ time=1
85
+ ttime=30
86
+ fi
87
+
88
+ nruns=1
89
+ if [ "$4" != "" ]; then
90
+ if [ "$4" -gt "0" ]; then
91
+ nruns=$4
92
+ fi
93
+ fi
94
+ maxm=512000
95
+ if [ "$5" != "" ]; then
96
+ if [ "$5" -gt "0" ]; then
97
+ maxm=${5}000
98
+ fi
99
+ fi
100
+ let "maxms = $maxm / 10"
101
+ maxf=1024
102
+ if [ "$6" != "" ]; then
103
+ if [ "$6" -gt "0" ]; then
104
+ maxf=${6}
105
+ fi
106
+ fi
107
+
108
+ rm -f runit.retcode 2>/dev/null
109
+ cp "$2" stdin0 2>/dev/null
110
+
111
+ cdir=`pwd`
112
+ echo "Current directory is $cdir" >&2
113
+ echo $cdir | grep -q "/bocajail"
114
+ if [ $? == 0 ]; then
115
+ cdir=`echo $cdir | sed "s/.*\/bocajail//"`
116
+ cat <<EOF > runit.sh
117
+ #!/bin/bash
118
+ cd "$cdir"
119
+ [ -f /proc/cpuinfo ] || /bin/mount -t proc proc /proc
120
+ #/bin/mount --bind /dev /dev
121
+ [ -d /sys/kernel ] || /bin/mount -t sysfs sysfs /sys
122
+ python3=`which python3`
123
+ [ -x "\$python3" ] || python3=/usr/bin/python3
124
+ if [ ! -x "\$python3" ]; then
125
+ echo "\$python3 not found or it's not executable"
126
+ exit 47
127
+ fi
128
+ "$sf" -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -ostdout0 -estderr0 -U$bocau -G$bocag -n0 -C. -f$maxf -d$maxm -m$maxm -- "\$python3" "$name"
129
+ retval=\$?
130
+ echo \$retval > runit.retcode
131
+ if [ ! -d /bocajail ]; then
132
+ /bin/umount /proc 2>/dev/null
133
+ #/bin/umount /dev
134
+ /bin/umount /sys 2>/dev/null
135
+ fi
136
+ EOF
137
+ chmod 755 runit.sh
138
+ chroot /bocajail "$cdir/runit.sh"
139
+ if [ -r runit.retcode ]; then
140
+ ret=`cat runit.retcode`
141
+ fi
142
+ if [ "$ret" == "" ]; then
143
+ echo "Execution error - check autojudging"
144
+ exit 49
145
+ fi
146
+ else
147
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
148
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
149
+ echo "CODE NOT BEING CHROOTED. DO NOT RUN THIS ON THE MAIN SERVER" >&2
150
+ python3=`which python3`
151
+ [ -x "$python3" ] || python3=/usr/bin/python3
152
+ if [ ! -x "$python3" ]; then
153
+ echo "$python3 not found or it's not executable"
154
+ exit 47
155
+ fi
156
+ "$sf" -r$nruns -t$time -T$ttime -istdin0 -F256 -u256 -U$bocau -G$bocag -ostdout0 -estderr0 -n0 -C. -d$maxm -m$maxm -f$maxf -- "$python3" "$name"
157
+ ret=$?
158
+ fi
159
+ if [ $ret -gt 10 ]; then
160
+ echo "> > > > > > > Nonzero return code - possible runtime error - I'M GUESSING IT IS RUNTIME ERROR < < < < < < < <"
161
+ ret=9
162
+ fi
163
+ if [ -f stdout0 ]; then
164
+ cat stdout0
165
+ fi
166
+ exit $ret