Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmsranking #1125

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
9 changes: 9 additions & 0 deletions cms/grading/languages/cpp11_gpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,12 @@
"-s", "-o", executable_filename]
command += source_filenames
return [command]

def get_compilation_no_link_command(self, source_filenames):
"""See Language.get_compilation_no_link_command."""
command = ["/usr/bin/g++"]
command += ["-std=c++11", "-O2", "-pipe", "-static",

Check warning on line 68 in cms/grading/languages/cpp11_gpp.py

View check run for this annotation

Codecov / codecov/patch

cms/grading/languages/cpp11_gpp.py#L67-L68

Added lines #L67 - L68 were not covered by tests
"-s", "-c"]
command += source_filenames
return [command]

Check warning on line 71 in cms/grading/languages/cpp11_gpp.py

View check run for this annotation

Codecov / codecov/patch

cms/grading/languages/cpp11_gpp.py#L70-L71

Added lines #L70 - L71 were not covered by tests

76 changes: 76 additions & 0 deletions cms/grading/languages/cpp14_gpp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/usr/bin/env python2
# -*- coding: utf-8 -*-

# Contest Management System - http://cms-dev.github.io/
# Copyright © 2016 Stefano Maggiolo <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

"""C++ programming language definition."""

from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals

from cms.grading import CompiledLanguage


__all__ = ["Cpp14Gpp"]


class Cpp14Gpp(CompiledLanguage):
"""This defines the C++ programming language, compiled with g++ (the
version available on the system) using the C++11 standard.

"""

@property
def name(self):
"""See Language.name."""
return "C++14 / g++"

@property
def source_extensions(self):
"""See Language.source_extensions."""
return [".cpp", ".cc", ".cxx", ".c++", ".C"]

@property
def header_extensions(self):
"""See Language.source_extensions."""
return [".h"]

@property
def object_extensions(self):
"""See Language.source_extensions."""
return [".o"]

def get_compilation_commands(self,
source_filenames, executable_filename,
for_evaluation=True):
"""See Language.get_compilation_commands."""
command = ["/usr/bin/g++"]
if for_evaluation:
command += ["-DEVAL"]
command += ["-std=gnu++14", "-O2", "-pipe", "-static",

Check warning on line 65 in cms/grading/languages/cpp14_gpp.py

View check run for this annotation

Codecov / codecov/patch

cms/grading/languages/cpp14_gpp.py#L62-L65

Added lines #L62 - L65 were not covered by tests
"-s", "-o", executable_filename]
command += source_filenames
return [command]

Check warning on line 68 in cms/grading/languages/cpp14_gpp.py

View check run for this annotation

Codecov / codecov/patch

cms/grading/languages/cpp14_gpp.py#L67-L68

Added lines #L67 - L68 were not covered by tests

def get_compilation_no_link_command(self, source_filenames):
"""See Language.get_compilation_no_link_command."""
command = ["/usr/bin/g++"]
command += ["-std=gnu++14", "-O2", "-pipe", "-static",

Check warning on line 73 in cms/grading/languages/cpp14_gpp.py

View check run for this annotation

Codecov / codecov/patch

cms/grading/languages/cpp14_gpp.py#L72-L73

Added lines #L72 - L73 were not covered by tests
"-s", "-c"]
command += source_filenames
return [command]

Check warning on line 76 in cms/grading/languages/cpp14_gpp.py

View check run for this annotation

Codecov / codecov/patch

cms/grading/languages/cpp14_gpp.py#L75-L76

Added lines #L75 - L76 were not covered by tests
10 changes: 6 additions & 4 deletions cms/grading/languages/java_jdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,12 @@
if JavaJDK.USE_JAR:
# executable_filename is a jar file, main is the name of
# the main java class
return [["/usr/bin/java", "-Deval=true", "-Xmx512M", "-Xss64M",
"-cp", executable_filename, main] + args]
return [["/usr/bin/java", "-Deval=true", "-Xmx1024M", "-Xss1024M",
"-Xbatch", "-XX:+UseSerialGC", "-XX:-TieredCompilation",
"-XX:CICompilerCount=1", "-cp", executable_filename, main] + args]
else:
unzip_command = ["/usr/bin/unzip", executable_filename]
command = ["/usr/bin/java", "-Deval=true", "-Xmx512M", "-Xss64M",
main] + args
command = ["/usr/bin/java", "-Deval=true", "-Xmx1024M", "-Xss1024M",

Check warning on line 86 in cms/grading/languages/java_jdk.py

View check run for this annotation

Codecov / codecov/patch

cms/grading/languages/java_jdk.py#L86

Added line #L86 was not covered by tests
"-Xbatch", "-XX:+UseSerialGC", "-XX:-TieredCompilation",
"-XX:CICompilerCount=1", main] + args
return [unzip_command, command]
Loading