Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
5dcfa08
updated repo
pgbovine May 4, 2016
382af3e
cosmetic
pgbovine May 4, 2016
4bfdd15
minor
pgbovine May 4, 2016
1ac835a
added
pgbovine May 4, 2016
485955e
bam
pgbovine May 4, 2016
6269859
minor
pgbovine May 4, 2016
c7b4f48
bah
pgbovine May 4, 2016
79fa8ae
bah
pgbovine May 4, 2016
5d8bee8
bah
pgbovine May 4, 2016
a2fee52
bam
pgbovine May 4, 2016
ec41ad7
added
pgbovine May 5, 2016
15f7159
minor
pgbovine May 5, 2016
591dc53
got script working independent of directories
pgbovine May 7, 2016
703be26
got kinda working
pgbovine May 8, 2016
a2e0630
bam
pgbovine May 8, 2016
712f5e9
minor
pgbovine May 8, 2016
b940da5
bam
pgbovine May 9, 2016
9b68645
bam
pgbovine May 9, 2016
779843e
bam
pgbovine May 9, 2016
9f7c739
bah scripting
pgbovine May 9, 2016
076d73b
maintenance stuff
pgbovine May 10, 2016
7052ad4
added valgrind trace print code for runtime errors
pgbovine May 10, 2016
077790b
more boring error handling
pgbovine May 10, 2016
b57dafe
don't try to filter
pgbovine May 10, 2016
d7cebad
more valgrind stuff
pgbovine May 10, 2016
06c35d6
added some testz
pgbovine May 10, 2016
cf6f52c
bam updated stuff
pgbovine May 10, 2016
464e16d
yay traced stdout finally!!!
pgbovine May 11, 2016
98f9b1c
bah
pgbovine May 11, 2016
3ac926b
bammmmm giant
pgbovine May 11, 2016
9bcba54
bam
pgbovine May 11, 2016
31d8478
bah
pgbovine May 11, 2016
818a208
bound steps max at 5000
pgbovine May 12, 2016
78dc905
enforced max steps execution limit
pgbovine May 12, 2016
ed8515b
Update README.md
pgbovine May 16, 2016
cb2a38d
added regher test 1!!!
pgbovine May 16, 2016
06ccd2c
moar tests
pgbovine May 16, 2016
da30776
minor Makefile cleanup
pgbovine Jun 24, 2016
1783eb2
yay
pgbovine Jan 30, 2017
cf550d9
minor
pgbovine Jan 30, 2017
0045c10
started fixing bugs with 'const' pointers and 'static' (defined withi…
pgbovine Jan 30, 2017
ded8452
got 'const char*' example working
pgbovine Jan 30, 2017
2960c0c
got static arrays printing better, i think
pgbovine Jan 30, 2017
e14a977
updated tests
pgbovine Jan 30, 2017
ba57ec7
got local static vars working for the most part
pgbovine Jan 31, 2017
539ea79
added some harder test cases
pgbovine Jan 31, 2017
c4553f8
added more test notes
pgbovine Jan 31, 2017
6bb921d
got local static vars defined within functions working much better
pgbovine Feb 1, 2017
7284126
added some regression tests and fixed some simple compiler errors
pgbovine Feb 1, 2017
3f35695
minor
pgbovine Feb 1, 2017
349c08c
display void* as unsigned bytes
pgbovine Feb 1, 2017
3c32380
first attempt at getting multi-dimensional arrays to work
pgbovine Feb 1, 2017
abd583c
added a C_MULTIDIMENSIONAL_ARRAY tag to render multidimensional arrays
pgbovine Feb 2, 2017
9550e11
fixed tiny bug
pgbovine Feb 3, 2017
892115a
minor changes to unit test format
pgbovine Feb 5, 2017
218e68d
added line numbers to stack frames
pgbovine Feb 5, 2017
0a1b73a
implemented a few more trace optimizations for C/C++ traces
pgbovine Feb 5, 2017
7356b7d
minor
pgbovine Feb 5, 2017
c2c556b
updated tests
pgbovine Feb 6, 2017
d319b7a
minor tweaks
pgbovine Feb 7, 2017
39df9a6
refactoring
pgbovine Feb 7, 2017
1233944
imoar refactoringz
pgbovine Feb 7, 2017
adf2b38
yas
pgbovine Feb 7, 2017
8e3cf3b
added new tests
pgbovine Feb 7, 2017
1d0b0da
starting to add valgrind errors to trace
pgbovine Feb 12, 2017
999fc28
passed thru valgrind's error msgs to the trace itself
pgbovine Feb 12, 2017
550c7a8
got enums working by printing them as integers;
pgbovine Feb 12, 2017
59149e7
display unprintable characters in the trace as "??" instead of crashing
pgbovine Feb 13, 2017
16ff390
make unprintable chars print as "???" and make unprintable floats pri…
pgbovine Feb 13, 2017
895b0b4
Run backend script accepts the user input as a parameter
amrondonp Jun 11, 2017
d0f8b6a
Merge pull request #1 from JuezUN/input-from-user
amrondonp Jun 16, 2017
c1ef34c
fixed docker file (make clean rule doesn't exists)
larranaga Nov 29, 2017
cc2d562
Merge pull request #2 from JuezUN/Deployment
larranaga Dec 7, 2017
e7cd71f
Update readme and add files (#3)
Oct 23, 2020
049b4ce
Update UNCode page (#4)
Nov 17, 2020
4b693f2
Update README.md
ferestrepoca Mar 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
*.dSYM/

# misc
Makefile
.deps
.dirstamp

valgrind-3.11.0/
*.trace
*.vgtrace
64 changes: 64 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Contributing to UNCode
We love your input! We want to make contributing to this project as easy and
transparent as possible, whether it's:

- Reporting a bug.
- Discussing the current state of the code.
- Submitting a fix.
- Proposing new features

## Our Development Process

We use github to host code, to track issues and feature requests, as well
as accept pull requests.

## Your First Contribution

Unsure where to begin contributing to UNCode? You can start by looking through these beginner issues:
**Good first issue** - issues which should only require a few lines of code and a not big understanding of UNCode.

Working on your first Pull Request? You can learn how from this *free* series,
[How to Contribute to an Open Source Project on GitHub][contribute_github_url].

## Pull Requests

Pull requests are the best way to propose changes to the codebase
(we use [Github Flow][github_flow_url].

We actively welcome your pull requests.

1. Fork the repo (in case not an admin) and create your branch from `master`.
2. If you've added code that should be tested, add tests.
3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes.
5. Be sure you have followed the code style for the project.
6. If you haven't already, complete the Contributor License Agreement ("CLA"). Note the code of conduct.
7. Create the pull request to `master` branch.

### Code review

UNCode team will check your pull request and one of us will be assigned to review it and
leave feedback. Make to reply the given feedback ASAP.

## Contributor License Agreement ("CLA")
In order to accept your pull request, you will need to sign the Contributor License Agreement.
Once the PR is created, you will be told whether or not you need to sign it and how to do it.

## Issues
We use GitHub issues to track public bugs or Feature Requests. Please ensure your description is
clear and has sufficient instructions to be able to reproduce the issue.

## License
In short, when you submit code changes, your submissions are understood to be under the
same [GNU][license_url] that covers the project.
Feel free to contact the maintainers if that's a concern.

## Community

Chat with us on [Gitter][gitter_url].
We will reply for sure on weekdays at GMT-5 time.

[contribute_github_url]: https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github
[github_flow_url]: https://guides.github.com/introduction/flow/index.html
[license_url]: https://github.com/JuezUN/opt-cpp-backend/blob/master/LICENSE
[gitter_url]: https://gitter.im/uncode-unal/community
36 changes: 36 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# to build:
# docker build -t="pgbovine/opt-cpp-backend:v1" .
#
# to test:
# docker run -t -i --rm --user=netuser --net=none --cap-drop all pgbovine/opt-cpp-backend:v1 bash
#
# remember --rm or else stale old containers will be left around!
# use "docker ps -a" to see all containers

# don't use 'latest' tag since that might change
FROM ubuntu:14.04.1
MAINTAINER Philip Guo <[email protected]>

# if apt-get doesn't work, then follow these instructions:
# http://stackoverflow.com/questions/24991136/docker-build-could-not-resolve-archive-ubuntu-com-apt-get-fails-to-install-a
# Uncomment the following line in /etc/default/docker DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
# Restart the Docker service sudo service docker restart
#
# to get gcc and g++, Valgrind needs libc6-dbg apparently
RUN apt-get update && apt-get install -y \
build-essential \
autotools-dev \
automake \
libc6-dbg \
python

RUN mkdir /tmp/opt-cpp-backend
ADD . /tmp/opt-cpp-backend

# we need to compile Valgrind from scratch within the container (hence
# 'make clean' first) to make it work from within the container, ergh
RUN cd /tmp/opt-cpp-backend/valgrind-3.11.0 && ./autogen.sh && ./configure --prefix=`pwd`/inst && make && make install

RUN useradd netuser

RUN cd /tmp/ && find . | xargs chown netuser
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# build and install the latest Valgrind with my custom pgbovine code
all:
cd valgrind-3.11.0/ && make install


# Docker-specific targets

# build a docker container
docker:
docker build -t="pgbovine/opt-cpp-backend:v1" .

test:
docker run -t -i --rm --user=netuser --net=none --cap-drop all pgbovine/opt-cpp-backend:v1 python /tmp/opt-cpp-backend/run_cpp_backend.py "int main() {int x=12345;}" c

regtest:
docker run -t -i --rm --user=netuser --net=none --cap-drop all -w /tmp/opt-cpp-backend/tests pgbovine/opt-cpp-backend:v1 python golden_test.py --all

bash:
docker run -t -i --rm --user=netuser --net=none --cap-drop all pgbovine/opt-cpp-backend:v1 bash

# older targets

build:
./auto-everything.sh

rawtest:
python $(HOME)/opt-cpp-backend/run_cpp_backend.py "int main() {int x=12345;}" c

valgrindtest:
stdbuf -o0 valgrind-3.11.0/inst/bin/valgrind --tool=memcheck --source-filename=usercode.c --trace-filename=usercode.vgtrace ./usercode.exe
61 changes: 56 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,60 @@
# opt-cpp-backend
prototype C/C++ backend for Online Python Tutor
# UNCode - Online Python Tutor - C/C++ backend

Based on a hacked version of Valgrind 3.11.0, downloaded from:
http://www.valgrind.org/downloads/valgrind-3.11.0.tar.bz2
[![License](https://img.shields.io/github/license/JuezUN/opt-cpp-backend?style=plastic)][license_url]
[![Gitter](https://badges.gitter.im/uncode-unal/community.svg)][gitter_url]
[![CLA assistant](https://cla-assistant.io/readme/badge/JuezUN/opt-cpp-backend)][cla_url]
[![Contributors](https://img.shields.io/github/contributors/JuezUN/opt-cpp-backend?style=plastic)][contributors_url]

Build dependencies:
This is the repository for the C/C++ backend for [Online Python Tutor][python_tutor_repo_url]. We have forked this
repository to add some necessary modifications for our purposes, and correctly provide the python tutor service.

The code of this repository is built using Docker stored in docker hub: [unjudge/opt-cpp-backend][unjudge/opt-cpp-backend],
which at the same time is used by a linux service called *cokapi*, see how we deploy this service [cokapi service][cokapi_url],
also see how Python tutor uses this deployed service in <https://github.com/JuezUN/OnlinePythonTutor/tree/master/v4-cokapi>.
The cokapi service is currently deployed in the port `4000`.

## Built with

- C
- (basic Linux C compiler toolchain)
- binutils-dev
- This code is based on a hacked version of Valgrind 3.11.0, downloaded from: <http://www.valgrind.org/downloads/valgrind-3.11.0.tar.bz2>

## Documentation

For additional documentation, please refer to the [Wiki][uncode_wiki_url].

## Roadmap

See the [UNCode GitHub Project][project_url] for a list of proposed features, known issues and how they are being
tackled.

## Contributing

Go to [CONTRIBUTING][contributing_url] to see the guidelines and how to start contributing to UNCode.

## License

Distributed under the GNU License. See [LICENSE][license_url] for more information.

## Contact

In case of technical questions, please use the [gitter communication channel][gitter_url].

In case you want to host your course on our deployment, email us on: <[email protected]>

UNCode: <https://uncode.unal.edu.co>

Project page: <https://juezun.github.io/>


[license_url]: https://github.com/JuezUN/opt-cpp-backend/blob/master/LICENSE
[contributing_url]: https://github.com/JuezUN/opt-cpp-backend/blob/master/CONTRIBUTING.md
[project_url]: https://github.com/JuezUN/INGInious/issues
[python_tutor_repo_url]: https://github.com/JuezUN/OnlinePythonTutor
[uncode_wiki_url]: https://github.com/JuezUN/INGInious/wiki
[gitter_url]:https://gitter.im/uncode-unal/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge
[cla_url]: https://cla-assistant.io/JuezUN/opt-cpp-backend
[contributors_url]: https://github.com/JuezUN/opt=cpp-backend/graphs/contributors
[unjudge/opt-cpp-backend]: https://hub.docker.com/r/unjudge/opt-cpp-backend
[cokapi_url]: https://github.com/JuezUN/Deployment/blob/master/deployment_scripts/deploy_cokapi_service.sh
27 changes: 27 additions & 0 deletions broken-tests.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Small-ish broken tests as of 2017-01-29

multidimensional arrays -- test in webapp:

./fjalar-MultiDimArrayTest.c
./c-multiarray-2.c
./cpp-array-struct-test.cpp
./c-multiarray-3.c
./fjalar-ArrayTest.c


python run_cpp_backend.py 'const int DIM1 = 3;
const int DIM2 = 4;

void fint(int param[DIM1][DIM2]) {
return;
}

int main() {
int xyz[DIM1][DIM2];
int i, j;
for (i = 0; i < DIM1; i++)
for(j = 0; j < DIM2; j++)
xyz[i][j] = i+j*i;
return 0;
}' c > out 2> err

Loading