Skip to content

Commit 27886b1

Browse files
committed
fix: lab8 no angr
1 parent 42b748a commit 27886b1

File tree

3 files changed

+3
-69
lines changed

3 files changed

+3
-69
lines changed

.github/workflows/lab-autograding.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,7 @@ jobs:
5656
if [ ${{ steps.lab.outputs.result }} -eq 6 ]; then
5757
sudo apt install -y llvm-14
5858
fi
59+
if [ ${{ steps.lab.outputs.result }} -eq 8 ]; then
60+
python3 -m pip install angr
61+
fi
5962
./validate.sh

lab3/main_test.js

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,53 +3,3 @@ const assert = require('assert');
33
const { Calculator } = require('./main');
44

55
// TODO: write your tests here
6-
describe('Parameterization', () => {
7-
it('exp', () => {
8-
const testcases = [
9-
{param: 0, expected: 1},
10-
{param: 1, expected: 2.718281828459045},
11-
{param: -1, expected: 0.36787944117144233},
12-
{param: 5, expected: 148.4131591025766},
13-
{param: 10, expected: 22026.465794806718}
14-
];
15-
const calculator = new Calculator();
16-
for (const tc of testcases) {
17-
assert.strictEqual(calculator.exp(tc.param), tc.expected);
18-
}
19-
});
20-
it('log', () => {
21-
const testcases = [
22-
{param: 1, expected: 0},
23-
{param: 10, expected: 2.302585092994046},
24-
{param: 8, expected: 2.0794415416798357},
25-
{param: 90, expected: 4.499809670330265},
26-
{param: Math.E, expected: 1}
27-
];
28-
const calculator = new Calculator();
29-
for (const tc of testcases) {
30-
assert.strictEqual(calculator.log(tc.param), tc.expected);
31-
}
32-
});
33-
})
34-
35-
var infinite_number = 1 / 0;
36-
var calculator = new Calculator();
37-
38-
describe('Errors', () => {
39-
it('exp infinite number', () => {
40-
assert.throws(function () {calculator.exp(infinite_number)});
41-
});
42-
it('exp overflow', () => {
43-
cause = 999999999;
44-
assert.throws(function() {calculator.exp(cause)});
45-
});
46-
it('log infinite number', () => {
47-
assert.throws(function() {calculator.log(infinite_number)});
48-
});
49-
it('log math domain error (1)', () => {
50-
assert.throws(function() {calculator.log(0)});
51-
})
52-
it('log math domain error (2)', () => {
53-
assert.throws(function() {calculator.log(-234)})
54-
})
55-
})

lab6/llvm-pass.so.cc

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,6 @@ PreservedAnalyses LLVMPass::run(Module &M, ModuleAnalysisManager &MAM) {
1616

1717
for (auto &F : M) {
1818
errs() << "func: " << F.getName() << "\n";
19-
if(F.getName()=="main"){
20-
BasicBlock &entryBlock = F.getEntryBlock();
21-
IRBuilder<> builder(&*entryBlock.getFirstInsertionPt());
22-
23-
builder.CreateCall(debug_func, debug_arg);
24-
25-
// 把所有用到 argc 的地方 全部替換成48763
26-
ConstantInt *main_argc = ConstantInt::get(Int32Ty, 48763);
27-
Argument *argcArg = F.getArg(0);
28-
argcArg->replaceAllUsesWith(main_argc);
29-
30-
31-
Argument *argvArg = F.getArg(1);
32-
Value *str = builder.CreateGlobalStringPtr("hayaku... motohayaku!");
33-
Type *argvElementType = argvArg->getType()->getPointerElementType();
34-
ConstantInt *offset = ConstantInt::get(Int32Ty, 1);
35-
Value *ptrToArgv1 = builder.CreateInBoundsGEP(argvElementType, argvArg, offset);
36-
builder.CreateStore(str, ptrToArgv1);
37-
}
3819

3920
}
4021
return PreservedAnalyses::none();

0 commit comments

Comments
 (0)