Skip to content

Commit a9ba992

Browse files
committed
update README & modify homework examples
1 parent 281b5dc commit a9ba992

File tree

138 files changed

+211
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+211
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
deadline="2115-3-8 23:59:59"
3+
4+
disallowed_header = "/mman.h", "valgrind", "/valgrind.h", "/callgrind.h", "/ptrace.h", "/signal.h"
5+
6+
7+
disallowed_func = "syscall", "fork", "vfork","clone", "system", "creat", "mknod", "mknodat","tmpfile"
8+
9+
allow_direct_syscall = "0"
10+
11+
delete_workspace="0"
12+
13+
child_process_timeout_seconds = "86400"
14+
15+
HW_NUM="HW0"
16+
HW_TITLE="Copy Paste"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
with open('input.txt', 'r') as fin, open('output.txt', 'w') as fout:
2+
fout.write(fin.read())
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include <fstream>
2+
3+
4+
int main() {
5+
std::ifstream ifs("input.txt");
6+
std::ofstream ofs("output.txt");
7+
8+
ofs << ifs.rdbuf();
9+
10+
ifs.close();
11+
ofs.close();
12+
13+
return 0;
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include <fstream>
2+
3+
#include "data.hpp"
4+
5+
6+
void solve(tTestData* test_data)
7+
{
8+
std::ofstream ofs("output.txt");
9+
if (!ofs.is_open()) return;
10+
11+
for (int i = 0; i < 3; ++i) {
12+
for (int j = 0; j < 5; ++j) {
13+
ofs << test_data->data[i][j] << ' ';
14+
}
15+
ofs << '\n';
16+
}
17+
18+
ofs.close();
19+
20+
return;
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#ifndef _DATA_H_
2+
#define _DATA_H_
3+
4+
#define SHM_NAME "hw0"
5+
6+
struct tTestData {
7+
int data[3][5];
8+
};
9+
10+
11+
#ifdef WRITER
12+
#include <fstream>
13+
14+
// return true if success, false otherwise
15+
bool load_data(tTestData* test_data) {
16+
std::ifstream ifs("input.txt");
17+
18+
if (!ifs.is_open()) return false;
19+
20+
for (int cases = 0; cases < 3; ++cases) {
21+
for (int i = 0; i < 5; ++i) {
22+
ifs >> test_data->data[cases][i];
23+
}
24+
}
25+
26+
ifs.close();
27+
return true;
28+
}
29+
30+
#endif // WRITER
31+
32+
#endif // _DATA_H_
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#ifndef _DATA_H_
2+
#define _DATA_H_
3+
4+
#define SHM_NAME "hidden_hw0"
5+
6+
struct tTestData {
7+
int data[5][5];
8+
};
9+
10+
11+
#ifdef WRITER
12+
#include <fstream>
13+
14+
// return true if success, false otherwise
15+
bool load_data(tTestData* test_data) {
16+
std::ifstream ifs("input.txt");
17+
18+
if (!ifs.is_open()) return false;
19+
20+
for (int cases = 0; cases < 5; ++cases) {
21+
for (int i = 0; i < 5; ++i) {
22+
ifs >> test_data->data[cases][i];
23+
}
24+
}
25+
26+
ifs.close();
27+
return true;
28+
}
29+
30+
#endif // WRITER
31+
32+
#endif // _DATA_H_
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-5 -10 -354 4564996 1234567
2+
-2840 8213 -12936 -9889 -18711
3+
16183 -45947 5028 8085 -16730
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-5 -10 -354 4564996 1234567
2+
-2840 8213 -12936 -9889 -18711
3+
16183 -45947 5028 8085 -16730
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
0 0 0 0 0
2+
1 1 1 1 1
3+
-1 -1 -1 -1 -1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
0 0 0 0 0
2+
1 1 1 1 1
3+
-1 -1 -1 -1 -1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/python3
2+
# -*- coding: utf-8 -*-
3+
4+
import sys
5+
import os
6+
import datetime
7+
8+
9+
10+
def DetectRuntimeError(filename):
11+
f = open(filename, 'r')
12+
for line in f:
13+
if ( line.find('run_innerloop detected host state invariant failure') >=0 ):
14+
return True
15+
return False
16+
17+
def Log(msg, bStdout = True):
18+
log_file = open('reliable_wrapper_log.report','a')
19+
szLine = '[' + str(datetime.datetime.now()) + ']\t' + msg
20+
log_file.write(szLine + '\n')
21+
if (bStdout):
22+
print(szLine)
23+
log_file.close()
24+
25+
def Equal(out_string, gold_string):
26+
out_words = out_string.split()
27+
gold_words = gold_string.split()
28+
return out_words == gold_words
29+
30+
if (len(sys.argv) != 2):
31+
Log("Syntax: verifier.py clean|checkname")
32+
sys.exit(-1)
33+
34+
if (sys.argv[1]=='clean'):
35+
os.remove('output.txt')
36+
sys.exit(0)
37+
38+
fCP = open('check_pattern_concise_{0}.report.final'.format(sys.argv[1]),'w')
39+
40+
with open('output.txt.{0}'.format(sys.argv[1]), 'r') as f:
41+
outputs = [line.strip() for line in f if line.strip()]
42+
43+
with open('output.txt.gold', 'r') as f:
44+
outputs_gold = [line.strip() for line in f if line.strip()]
45+
46+
nTest = len(outputs_gold)
47+
48+
for k in range(0, min(len(outputs),len(outputs_gold))):
49+
if ( Equal(outputs[k], outputs_gold[k])):
50+
strCheck = 'check {0}: PASSED (1/{1})\n'.format(k+1,nTest)
51+
else:
52+
strCheck = 'check {0}: (0/{1})\n'.format(k+1,nTest)
53+
fCP.write(strCheck)
54+
55+
fCP.close()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
# $1 : check file identifier (e.g. output.txt."memcheck")
4+
5+
./verifier.py $1
6+
7+

HomeworkInspector_php/hidden.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<!DOCTYPE html>
2+
<html>
23
<head>
34
<title>Re-evaluation</title>
45
</head>

README.md

+19-4

0 commit comments

Comments
 (0)