Permalink
Browse files

One fat commit to add the basic working version of codechecker

  • Loading branch information...
1 parent 1aed0f3 commit 45fd60a9e1e5b45959b2dd4598c73ef5dd70c3c7 @surenm committed Nov 27, 2011
Showing with 15,424 additions and 0 deletions.
  1. +4 −0 .gitignore
  2. +7 −0 build_secexec.sh
  3. +43 −0 conf/codechecker.conf
  4. +20 −0 conf/django.conf
  5. +17 −0 conf/settings.conf
  6. +17 −0 conf/settings.conf.sample
  7. +38 −0 docs/README
  8. +97 −0 install.py
  9. +759 −0 media/css/base.css
  10. +286 −0 media/css/changelists.css
  11. +24 −0 media/css/dashboard.css
  12. +354 −0 media/css/forms.css
  13. +142 −0 media/css/global.css
  14. +57 −0 media/css/ie.css
  15. +29 −0 media/css/layout.css
  16. +54 −0 media/css/login.css
  17. +1 −0 media/css/null.css
  18. +8 −0 media/css/patch-iewin.css
  19. +217 −0 media/css/rtl.css
  20. +228 −0 media/css/style.css
  21. +506 −0 media/css/widgets.css
  22. BIN media/img/admin/arrow-down.gif
  23. BIN media/img/admin/arrow-up.gif
  24. BIN media/img/admin/changelist-bg.gif
  25. BIN media/img/admin/changelist-bg_rtl.gif
  26. BIN media/img/admin/chooser-bg.gif
  27. BIN media/img/admin/chooser_stacked-bg.gif
  28. BIN media/img/admin/default-bg-reverse.gif
  29. BIN media/img/admin/default-bg.gif
  30. BIN media/img/admin/deleted-overlay.gif
  31. BIN media/img/admin/icon-no.gif
  32. BIN media/img/admin/icon-unknown.gif
  33. BIN media/img/admin/icon-yes.gif
  34. BIN media/img/admin/icon_addlink.gif
  35. BIN media/img/admin/icon_alert.gif
  36. BIN media/img/admin/icon_calendar.gif
  37. BIN media/img/admin/icon_changelink.gif
  38. BIN media/img/admin/icon_clock.gif
  39. BIN media/img/admin/icon_deletelink.gif
  40. BIN media/img/admin/icon_error.gif
  41. BIN media/img/admin/icon_searchbox.png
  42. BIN media/img/admin/icon_success.gif
  43. 0 media/img/admin/index.php
  44. BIN media/img/admin/inline-delete-8bit.png
  45. BIN media/img/admin/inline-delete.png
  46. BIN media/img/admin/inline-restore-8bit.png
  47. BIN media/img/admin/inline-restore.png
  48. BIN media/img/admin/inline-splitter-bg.gif
  49. BIN media/img/admin/nav-bg-grabber.gif
  50. BIN media/img/admin/nav-bg-reverse.gif
  51. BIN media/img/admin/nav-bg.gif
  52. BIN media/img/admin/selector-add.gif
  53. BIN media/img/admin/selector-addall.gif
  54. BIN media/img/admin/selector-remove.gif
  55. BIN media/img/admin/selector-removeall.gif
  56. BIN media/img/admin/selector-search.gif
  57. BIN media/img/admin/selector_stacked-add.gif
  58. BIN media/img/admin/selector_stacked-remove.gif
  59. BIN media/img/admin/tool-left.gif
  60. BIN media/img/admin/tool-left_over.gif
  61. BIN media/img/admin/tool-right.gif
  62. BIN media/img/admin/tool-right_over.gif
  63. BIN media/img/admin/tooltag-add.gif
  64. BIN media/img/admin/tooltag-add_over.gif
  65. BIN media/img/admin/tooltag-arrowright.gif
  66. BIN media/img/admin/tooltag-arrowright_over.gif
  67. 0 media/img/gis/index.php
  68. BIN media/img/gis/move_vertex_off.png
  69. BIN media/img/gis/move_vertex_on.png
  70. 0 media/img/index.php
  71. BIN media/img/site/arrowleft.png
  72. BIN media/img/site/arrowright.png
  73. BIN media/img/site/headerbg.gif
  74. 0 media/img/site/index.php
  75. 0 media/index.php
  76. +20 −0 media/js/LICENSE-JQUERY.txt
  77. +111 −0 media/js/SelectBox.js
  78. +117 −0 media/js/SelectFilter2.js
  79. +139 −0 media/js/actions.js
  80. +7 −0 media/js/actions.min.js
  81. +85 −0 media/js/admin/CollapsedFieldsets.js
  82. +274 −0 media/js/admin/DateTimeShortcuts.js
  83. +96 −0 media/js/admin/RelatedObjectLookups.js
  84. 0 media/js/admin/index.php
  85. +137 −0 media/js/admin/ordering.js
  86. +156 −0 media/js/calendar.js
  87. +27 −0 media/js/collapse.js
  88. +2 −0 media/js/collapse.min.js
  89. +47 −0 media/js/compress.py
  90. +221 −0 media/js/core.js
  91. +233 −0 media/js/dateparse.js
  92. +167 −0 media/js/getElementsBySelector.js
  93. 0 media/js/index.php
  94. +148 −0 media/js/inlines.js
  95. +6 −0 media/js/inlines.min.js
  96. +4 −0 media/js/jquery.init.js
  97. +6,240 −0 media/js/jquery.js
  98. +154 −0 media/js/jquery.min.js
  99. +34 −0 media/js/prepopulate.js
  100. +1 −0 media/js/prepopulate.min.js
  101. +94 −0 media/js/timeparse.js
  102. +140 −0 media/js/urlify.js
  103. +904 −0 media/styles/coolblue/css/coolblue.css
  104. +45 −0 media/styles/coolblue/css/enhancements.css
  105. +44 −0 media/styles/coolblue/css/reset.css
  106. +7 −0 media/styles/coolblue/css/screen.css
  107. BIN media/styles/coolblue/images/bg.gif
  108. BIN media/styles/coolblue/images/bg.jpg
  109. BIN media/styles/coolblue/images/clock.gif
  110. BIN media/styles/coolblue/images/comment.gif
  111. BIN media/styles/coolblue/images/content.gif
  112. BIN media/styles/coolblue/images/current.gif
  113. BIN media/styles/coolblue/images/current.jpg
  114. BIN media/styles/coolblue/images/date-bg.gif
  115. BIN media/styles/coolblue/images/delicious_32.png
  116. BIN media/styles/coolblue/images/digg_32.png
  117. BIN media/styles/coolblue/images/document.gif
  118. BIN media/styles/coolblue/images/email_32.png
  119. BIN media/styles/coolblue/images/facebook_32.png
  120. BIN media/styles/coolblue/images/firefox-gray.jpg
  121. BIN media/styles/coolblue/images/footer-line.gif
  122. BIN media/styles/coolblue/images/gravatar.jpg
  123. BIN media/styles/coolblue/images/header-bg.jpg
  124. BIN media/styles/coolblue/images/header-bg.png
  125. BIN media/styles/coolblue/images/img-post.jpg
  126. BIN media/styles/coolblue/images/linkedin_32.png
  127. BIN media/styles/coolblue/images/newsvine_32.png
  128. BIN media/styles/coolblue/images/permalink.gif
  129. BIN media/styles/coolblue/images/quote.gif
  130. BIN media/styles/coolblue/images/rss.gif
  131. BIN media/styles/coolblue/images/rss_32.png
  132. BIN media/styles/coolblue/images/search.gif
  133. BIN media/styles/coolblue/images/social_email.png
  134. BIN media/styles/coolblue/images/social_facebook.png
  135. BIN media/styles/coolblue/images/social_rss.png
  136. BIN media/styles/coolblue/images/social_twitter.png
  137. BIN media/styles/coolblue/images/speech_bubble.gif
  138. BIN media/styles/coolblue/images/stumbleupon_32.png
  139. BIN media/styles/coolblue/images/tag.gif
  140. BIN media/styles/coolblue/images/technorati_32.png
  141. BIN media/styles/coolblue/images/thumb.jpg
  142. BIN media/styles/coolblue/images/twitter_32.png
  143. BIN media/styles/coolblue/images/user.gif
  144. +26 −0 setup.py
  145. 0 src/checker/__init__.py
  146. +92 −0 src/checker/cc_backend/Checker.py
  147. +28 −0 src/checker/cc_backend/Config.py
  148. 0 src/checker/cc_backend/__init__.py
  149. BIN src/checker/cc_backend/compiler/._compile.py
  150. 0 src/checker/cc_backend/compiler/__init__.py
  151. +65 −0 src/checker/cc_backend/compiler/compile.py
  152. BIN src/checker/cc_backend/evaluator/._eval.py
  153. 0 src/checker/cc_backend/evaluator/__init__.py
  154. +82 −0 src/checker/cc_backend/evaluator/eval.py
  155. 0 src/checker/cc_backend/score/__init__.py
  156. +3 −0 src/checker/cc_backend/score/score.py
  157. 0 src/checker/cc_backend/se/__init__.py
  158. +185 −0 src/checker/cc_backend/se/secexec.c
  159. +30 −0 src/checker/cc_backend/se/secexec.h
  160. +38 −0 src/checker/cc_backend/se/secexec.py
  161. BIN src/checker/cc_backend/store/._default_store.py
  162. 0 src/checker/cc_backend/store/__init__.py
  163. +90 −0 src/checker/cc_backend/store/default_store.py
  164. +135 −0 src/checker/cc_backend/store/storage_interface.py
  165. BIN src/checker/cc_frontend/._settings.py
  166. BIN src/checker/cc_frontend/._urls.py
  167. 0 src/checker/cc_frontend/__init__.py
  168. +53 −0 src/checker/cc_frontend/deployment.py
  169. +11 −0 src/checker/cc_frontend/manage.py
  170. +62 −0 src/checker/cc_frontend/settings.py
  171. +25 −0 src/checker/cc_frontend/templates/about.html
  172. +27 −0 src/checker/cc_frontend/templates/accounts/login.html
  173. +10 −0 src/checker/cc_frontend/templates/accounts/password_change_done.html
  174. +23 −0 src/checker/cc_frontend/templates/accounts/password_change_form.html
  175. +16 −0 src/checker/cc_frontend/templates/accounts/pchange.html
  176. +15 −0 src/checker/cc_frontend/templates/accounts/register.html
  177. +12 −0 src/checker/cc_frontend/templates/admin/404.html
  178. +12 −0 src/checker/cc_frontend/templates/admin/500.html
  179. +16 −0 src/checker/cc_frontend/templates/admin/actions.html
  180. +15 −0 src/checker/cc_frontend/templates/admin/app_index.html
  181. +14 −0 src/checker/cc_frontend/templates/admin/auth/user/add_form.html
  182. +54 −0 src/checker/cc_frontend/templates/admin/auth/user/change_password.html
  183. +82 −0 src/checker/cc_frontend/templates/admin/base.html
  184. +10 −0 src/checker/cc_frontend/templates/admin/base_site.html
  185. +67 −0 src/checker/cc_frontend/templates/admin/change_form.html
  186. +102 −0 src/checker/cc_frontend/templates/admin/change_list.html
  187. +22 −0 src/checker/cc_frontend/templates/admin/change_list_results.html
  188. +10 −0 src/checker/cc_frontend/templates/admin/date_hierarchy.html
  189. +32 −0 src/checker/cc_frontend/templates/admin/delete_confirmation.html
  190. +37 −0 src/checker/cc_frontend/templates/admin/delete_selected_confirmation.html
  191. +79 −0 src/checker/cc_frontend/templates/admin/edit_inline/stacked.html
  192. +125 −0 src/checker/cc_frontend/templates/admin/edit_inline/tabular.html
  193. +8 −0 src/checker/cc_frontend/templates/admin/filter.html
  194. +28 −0 src/checker/cc_frontend/templates/admin/includes/fieldset.html
  195. +80 −0 src/checker/cc_frontend/templates/admin/index.html
  196. +8 −0 src/checker/cc_frontend/templates/admin/invalid_setup.html
  197. +34 −0 src/checker/cc_frontend/templates/admin/login.html
  198. +42 −0 src/checker/cc_frontend/templates/admin/object_history.html
  199. +12 −0 src/checker/cc_frontend/templates/admin/pagination.html
  200. +23 −0 src/checker/cc_frontend/templates/admin/prepopulated_fields_js.html
  201. +18 −0 src/checker/cc_frontend/templates/admin/search_form.html
  202. +8 −0 src/checker/cc_frontend/templates/admin/submit_line.html
  203. +31 −0 src/checker/cc_frontend/templates/admin/template_validator.html
  204. +110 −0 src/checker/cc_frontend/templates/coder.html
  205. +36 −0 src/checker/cc_frontend/templates/contest.html
  206. +160 −0 src/checker/cc_frontend/templates/coolblue.html
  207. +1 −0 src/checker/cc_frontend/templates/default.html
  208. +9 −0 src/checker/cc_frontend/templates/news.html
  209. +60 −0 src/checker/cc_frontend/templates/problem.html
  210. +14 −0 src/checker/cc_frontend/templates/references.html
  211. +12 −0 src/checker/cc_frontend/templates/registration/logged_out.html
  212. +14 −0 src/checker/cc_frontend/templates/registration/password_change_done.html
  213. +26 −0 src/checker/cc_frontend/templates/registration/password_change_form.html
  214. +16 −0 src/checker/cc_frontend/templates/registration/password_reset_complete.html
  215. +32 −0 src/checker/cc_frontend/templates/registration/password_reset_confirm.html
  216. +14 −0 src/checker/cc_frontend/templates/registration/password_reset_done.html
  217. +15 −0 src/checker/cc_frontend/templates/registration/password_reset_email.html
  218. +19 −0 src/checker/cc_frontend/templates/registration/password_reset_form.html
  219. +38 −0 src/checker/cc_frontend/templates/table.html
  220. +10 −0 src/checker/cc_frontend/urls.py
  221. BIN src/checker/cc_frontend/web/._models.py
  222. +5 −0 src/checker/cc_frontend/web/__init__.py
  223. +62 −0 src/checker/cc_frontend/web/admin.py
  224. +137 −0 src/checker/cc_frontend/web/models.py
  225. +9 −0 src/checker/cc_frontend/web/urls.py
  226. +54 −0 utils/example.sql
  227. +6 −0 utils/make_setuid.sh
View
@@ -0,0 +1,4 @@
+build/*
+*.pyc
+*secexec
+*.swp
View
@@ -0,0 +1,7 @@
+cd src/checker/cc_backend/se/
+#gcc -DDBG -DGETOPT -DJAIL -I. -o secexec secexec.c
+gcc -I. -o secexec secexec.c
+sudo chown root:root secexec
+sudo cp secexec /usr/local/bin
+sudo chmod u+s secexec
+sudo chmod u+s /usr/local/bin/secexec
View
@@ -0,0 +1,43 @@
+[BackendMain]
+# Specify the root directory of the Codechecker installation below. It
+# should be an absolute address.
+CheckerRoot=/opt/checker/
+
+#Jail Root director
+JailRoot=/jail/
+
+# Specify the directory in which the codechecker runs all
+# submissions. The input/output/err files, the source file, the
+# executable, and the reference output file are all placed here. It
+# must be an address within the Jail.
+RunsPath=var/run/codechecker/submissions/
+
+# Reference output file paths
+ReferencesPath=/opt/references
+
+# Specify the maximum allowable output file size in MBs. This limits the
+# output file size of any of your submission programs.
+OutputFileSizeLimit=64
+
+#Specify the file where all log messages need to be written to
+LogFile=/tmp/nohup.out
+
+[CompileCommands]
+# Specify the language to be supported and the corresponding compilation command.
+# Format:
+# %s - src file
+# %e - exec file
+C_compile=gcc -lm -Wall -O2 %s -o %e
+C_run=%e
+CPP_compile=g++ -Wall -O2 %s -o %e
+CPP_run=%e
+Py_compile=py_compilefiles %s
+Py_run=python %s
+Pascal_compile=gpc %s -o %e
+Pascal_run=%e
+Java_compile=gcj -C %s
+Java_run=gij -Xmx%l -cp %p %c
+
+[RuntimeLimits]
+# Maximum size of Heap Memory in MB
+HeapSize=256
View
@@ -0,0 +1,20 @@
+# Django Conf
+# The entire codechecker source root is to be linked as checker in /opt for
+# this to work
+
+# Tries to Match All Django URL and The Location Regex pattern has to match
+# the value in settings.py BASE_URL value.
+<Location /site/>
+ SetHandler python-program
+ PythonHandler django.core.handlers.modpython
+ SetEnv DJANGO_SETTINGS_MODULE checker.cc_frontend.deployment
+ # should be the same as in the settings.conf for BASE_URL
+ PythonDebug On /site
+</Location>
+
+# If the request is for media, serve it. Dont allow .htaccess overridding
+# Disable directory listing using -Index
+<Directory /media>
+ AllowOverride None
+ Options -Indexes
+</Directory>
View
@@ -0,0 +1,17 @@
+[django]
+TIME_ZONE=Asia/Kolkata
+MEDIA_URL=http://localhost/media/
+ADMIN_MEDIA_PREFIX=http://localhost/media/
+STYLESHEET=coolblue
+
+[database]
+DATABASE_ENGINE=mysql
+DATABASE_NAME=checker
+DATABASE_USER=root
+DATABASE_PASSWORD=root
+
+[apache]
+BASE_URL=/site/
+SERVERNAME=localhost
+SERVERALIAS=checker.example.com
+
View
@@ -0,0 +1,17 @@
+[django]
+TIME_ZONE=Asia/Kolkata
+MEDIA_URL=http://localhost/media/
+ADMIN_MEDIA_PREFIX=http://localhost/media/
+STYLESHEET=coolblue
+
+[database]
+DATABASE_ENGINE=
+DATABASE_NAME=
+DATABASE_USER=
+DATABASE_PASSWORD=
+
+[apache]
+BASE_URL=/site/
+SERVERNAME=localhost
+SERVERALIAS=checker.example.com
+
View
@@ -0,0 +1,38 @@
+This document explains how the codechecker works.
+
+The codechecker start executing from Main.py. This Main program simply
+waits for a submission with status = "queued" to appear. When this
+happens, it picks up the submission, changes it to status =
+"processing" (atomically - many other codechecker threads can be
+running) and starts processing it.
+
+Some terminology about test cases:
+
+1) Testcase - a testcase is an input file for a single run of a
+submission.
+
+2) Test_group - a collection of one or more testcases that are scored
+together, associated with a score. Eg: If a program passes all
+testcases in a test_group it can get the points for that
+test_group. If it does not pass all testcases, the submission could
+get no points.
+
+3) Result checker - a program submitted by a problem setter that is
+used to check the result of a testcase run by a custom algorithm. This
+program is required only for problems that need a custom result
+verification algorithm. If the result for a testcase is unique, it is
+sufficient to use a reference output file and see that the testcase
+run produces the same output file.
+
+Processing consists of first compiling the submission, and generating
+an executable. Once this is done, the Evaluation module
+begins. Evaluation consists of testing the submission against a set of
+test_groups. Each test_group is fetched in order and the testing for
+the testcases in that test group begins. The submission is executed
+against each testcase by the Secure Execution module (SE). The
+Evaluation module also checks the result of each testcase run with
+either a reference output file for that testcase or a Result_checker
+program. The Result_checker also runs in the SE module.
+
+
+
View
@@ -0,0 +1,97 @@
+import os
+import sys
+import shutil
+from distutils.core import setup
+from django.core.management import execute_manager
+
+
+# TODO:One step installation file
+
+prefix = "/usr/local/"
+backend_conf = os.path.join(prefix, 'etc/checker/')
+frontend_conf = os.path.join(prefix, 'etc/apache/')
+media_dir = os.path.join(prefix, 'share/checker/')
+secexec = os.path.join(prefix, 'bin/secexec')
+
+# check if django exists first
+try :
+ import django
+except ImportError :
+ sys.stderr.write( '''
+---------------------------------------------------------------------------
+Could not find Django, please install Django first.\n
+sys.stderr.write( "Please install Django from www.djagoproject.com.\n
+---------------------------------------------------------------------------
+''' )
+ exit(1)
+# check if python mysql exists
+try :
+ import MySQLdb
+except ImportError :
+ sys.stderr.write( '''
+---------------------------------------------------------------------------
+python-mysqldb is not installed. Please install from apt/yum\n
+---------------------------------------------------------------------------
+''' )
+ exit(1)
+
+# create etc/checker conf directory if not exists already
+if not os.path.exists( backend_conf ):
+ os.mkdir( backend_conf )
+
+# create etc/apache conf directory if not exists already
+if not os.path.exists( frontend_conf ):
+ os.mkdir( frontend_conf )
+
+# create media directory
+if not os.path.exists( media_dir ) :
+ os.mkdir( media_dir )
+
+# Copy the settings.py from sample file and ask to populate the mysql data
+shutil.copy( os.path.join( os.getcwd(), 'conf/settings.conf' ),
+ os.path.join( backend_conf, 'settings.conf' ) )
+
+# copy all python modules
+ret_code = os.system( "python setup.py install" )
+if not ret_code == 0 :
+ sys.exit(ret_code)
+
+
+# copy the codechecker.conf to @prefix/etc/checker
+shutil.copy( os.path.join( os.getcwd(), 'conf/codechecker.conf'), os.path.join( backend_conf, 'codechecker.conf' ) )
+
+# copy the apache conf file
+shutil.copy( os.path.join( os.getcwd(), 'conf/django.conf'), os.path.join( frontend_conf, 'django.conf') )
+
+# copy the media folder to /usr/local/share/checker/media
+# and remove it if already present
+if os.path.exists( media_dir + 'media/'):
+ shutil.rmtree( media_dir + 'media/' )
+
+if os.path.exists( media_dir + 'templates/'):
+ shutil.rmtree( media_dir + 'templates/' )
+
+if os.path.exists( '/var/www/media/' ):
+ shutil.rmtree('/var/www/media/')
+
+shutil.copytree(os.getcwd() + '/media', media_dir + 'media/' )
+
+# Copy templates to /usr/local/share/checker
+shutil.copytree(os.getcwd() + '/src/checker/cc_frontend/templates', media_dir + 'templates/')
+
+# this is a temporary copy to /www/media
+shutil.copytree(os.getcwd() + '/media', '/var/www/media/' )
+
+# copy secexec to /usr/local/bin
+os.system('sudo bash ./build_secexec.sh')
+
+# Now to run syncdb - settings should already be in place
+# It would not have come to this level else
+# currently running manage.py syndb, how to call it here ?
+
+# TODO: call manage.py syncdb from here
+# TODO: add django.conf to apache's include directory
+# TODO: copy media to /usr/share/checker/media - DOcRoot has already added
+# TODO: Default populate
+# TODO: Run a Unit test
+# TODO: Run setuid generation - secexec.o
Oops, something went wrong.

0 comments on commit 45fd60a

Please sign in to comment.