[tools] Check C & C++ syntax.
This commit is contained in:
parent
167f0a4a1d
commit
e1adec2133
4 changed files with 23 additions and 4 deletions
1
BUGS
1
BUGS
|
|
@ -7,6 +7,7 @@ Current
|
||||||
- If a job is paused for longer than the timeout period, sometimes it has
|
- If a job is paused for longer than the timeout period, sometimes it has
|
||||||
the timed out status when un-paused.
|
the timed out status when un-paused.
|
||||||
- Tmp files are being left behind after shutdown.
|
- Tmp files are being left behind after shutdown.
|
||||||
|
- gcc is not working inside the sandbox.
|
||||||
|
|
||||||
|
|
||||||
Current (tool related)
|
Current (tool related)
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,9 @@ Extensions | Tools
|
||||||
.pl .pm .t | [perl_syntax](https://en.wikipedia.org/wiki/Perl) • [perldoc](http://perldoc.perl.org/) • [perltidy](http://perltidy.sourceforge.net/)
|
.pl .pm .t | [perl_syntax](https://en.wikipedia.org/wiki/Perl) • [perldoc](http://perldoc.perl.org/) • [perltidy](http://perltidy.sourceforge.net/)
|
||||||
.pod .pod6 | [perldoc](http://perldoc.perl.org/)
|
.pod .pod6 | [perldoc](http://perldoc.perl.org/)
|
||||||
.java | [uncrustify](http://uncrustify.sourceforge.net/)
|
.java | [uncrustify](http://uncrustify.sourceforge.net/)
|
||||||
.c .h | [splint](http://www.splint.org/) • [uncrustify](http://uncrustify.sourceforge.net/)
|
.c .h | [c_syntax](https://gcc.gnu.org/) • [splint](http://www.splint.org/) • [uncrustify](http://uncrustify.sourceforge.net/)
|
||||||
.o | [objdump_headers](https://en.wikipedia.org/wiki/Objdump) • [objdump_disassemble](https://en.wikipedia.org/wiki/Objdump) • [readelf](https://en.wikipedia.org/wiki/Objdump)
|
.o | [objdump_headers](https://en.wikipedia.org/wiki/Objdump) • [objdump_disassemble](https://en.wikipedia.org/wiki/Objdump) • [readelf](https://en.wikipedia.org/wiki/Objdump)
|
||||||
.cpp | bcpp • [uncrustify](http://uncrustify.sourceforge.net/)
|
.cpp | [cpp_syntax](https://gcc.gnu.org/) • bcpp • [uncrustify](http://uncrustify.sourceforge.net/)
|
||||||
.pdf | [pdf2txt](http://www.unixuser.org/~euske/python/pdfminer/)
|
.pdf | [pdf2txt](http://www.unixuser.org/~euske/python/pdfminer/)
|
||||||
.html | [html_syntax](http://www.html-tidy.org/) • [tidy](http://www.html-tidy.org/) • [html2text](http://www.mbayer.de/html2text/)
|
.html | [html_syntax](http://www.html-tidy.org/) • [tidy](http://www.html-tidy.org/) • [html2text](http://www.mbayer.de/html2text/)
|
||||||
.php | [php5_syntax](https://en.wikipedia.org/wiki/PHP)
|
.php | [php5_syntax](https://en.wikipedia.org/wiki/PHP)
|
||||||
|
|
|
||||||
16
tools.py
16
tools.py
|
|
@ -509,6 +509,12 @@ perltidy.url = "http://perltidy.sourceforge.net/"
|
||||||
# perl6_syntax.dependencies = {"rakudo"}
|
# perl6_syntax.dependencies = {"rakudo"}
|
||||||
|
|
||||||
|
|
||||||
|
def c_syntax(path):
|
||||||
|
return _run_command(["gcc", "-fsyntax-only", path])
|
||||||
|
c_syntax.dependencies = {"gcc"}
|
||||||
|
c_syntax.url = "https://gcc.gnu.org/"
|
||||||
|
|
||||||
|
|
||||||
def splint(path):
|
def splint(path):
|
||||||
stdout, stderr, returncode = _do_command(["splint", "-preproc", path])
|
stdout, stderr, returncode = _do_command(["splint", "-preproc", path])
|
||||||
status = Status.ok if returncode == 0 else Status.problem
|
status = Status.ok if returncode == 0 else Status.problem
|
||||||
|
|
@ -595,6 +601,12 @@ html2text.dependencies = {"html2text"}
|
||||||
html2text.url = "html2text"
|
html2text.url = "html2text"
|
||||||
|
|
||||||
|
|
||||||
|
def cpp_syntax(path):
|
||||||
|
return _run_command(["gcc", "-fsyntax-only", path])
|
||||||
|
cpp_syntax.dependencies = {"gcc"}
|
||||||
|
cpp_syntax.url = "https://gcc.gnu.org/"
|
||||||
|
|
||||||
|
|
||||||
def bcpp(path):
|
def bcpp(path):
|
||||||
stdout, stderr, returncode = _do_command(["bcpp", "-fi", path])
|
stdout, stderr, returncode = _do_command(["bcpp", "-fi", path])
|
||||||
status = Status.normal if returncode == 0 else Status.problem
|
status = Status.normal if returncode == 0 else Status.problem
|
||||||
|
|
@ -754,9 +766,9 @@ TOOLS_FOR_EXTENSIONS = \
|
||||||
# (["p6", "pm6"], [perl6_syntax, perldoc]),
|
# (["p6", "pm6"], [perl6_syntax, perldoc]),
|
||||||
(["pod", "pod6"], [perldoc]),
|
(["pod", "pod6"], [perldoc]),
|
||||||
(["java"], [uncrustify]),
|
(["java"], [uncrustify]),
|
||||||
(["c", "h"], [splint, uncrustify]),
|
(["c", "h"], [c_syntax, splint, uncrustify]),
|
||||||
(["o"], [objdump_headers, objdump_disassemble, readelf]),
|
(["o"], [objdump_headers, objdump_disassemble, readelf]),
|
||||||
(["cpp"], [bcpp, uncrustify]),
|
(["cpp"], [cpp_syntax, bcpp, uncrustify]),
|
||||||
(["pdf"], [pdf2txt]),
|
(["pdf"], [pdf2txt]),
|
||||||
(["html"], [html_syntax, tidy, html2text]),
|
(["html"], [html_syntax, tidy, html2text]),
|
||||||
(["php"], [php5_syntax]),
|
(["php"], [php5_syntax]),
|
||||||
|
|
|
||||||
|
|
@ -153,6 +153,9 @@ class ToolsTestCase(unittest.TestCase):
|
||||||
("hello.h", tools.Status.normal),
|
("hello.h", tools.Status.normal),
|
||||||
("hello.cpp", tools.Status.normal)])
|
("hello.cpp", tools.Status.normal)])
|
||||||
|
|
||||||
|
def test_c_syntax(self):
|
||||||
|
self._test_tool(tools.c_syntax, [("hello.c", tools.Status.ok)])
|
||||||
|
|
||||||
def test_splint(self):
|
def test_splint(self):
|
||||||
self._test_tool(tools.splint, [("hello.c", tools.Status.ok),
|
self._test_tool(tools.splint, [("hello.c", tools.Status.ok),
|
||||||
("hello.h", tools.Status.ok)])
|
("hello.h", tools.Status.ok)])
|
||||||
|
|
@ -194,6 +197,9 @@ class ToolsTestCase(unittest.TestCase):
|
||||||
def test_html2text(self):
|
def test_html2text(self):
|
||||||
self._test_tool(tools.html2text, [("hi.html", tools.Status.normal)])
|
self._test_tool(tools.html2text, [("hi.html", tools.Status.normal)])
|
||||||
|
|
||||||
|
def test_cpp_syntax(self):
|
||||||
|
self._test_tool(tools.cpp_syntax, [("hello.cpp", tools.Status.ok)])
|
||||||
|
|
||||||
def test_bcpp(self):
|
def test_bcpp(self):
|
||||||
self._test_tool(tools.bcpp, [("hello.cpp", tools.Status.normal)])
|
self._test_tool(tools.bcpp, [("hello.cpp", tools.Status.normal)])
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue