evenodd's People
evenodd's Issues
正确性测试脚本
测试
完成一个正确性测试的脚本:correct.sh。
输入 ./correct.sh evenodd
然后执行下面功能:
- 在该目录进行 N 次文件编码、解码;错误恢复等测试:
- 比如:
-
- 创建一个大小为 file_size 的文件 test_file,然后选择一个质数 p 对它执行 ./evenodd write test_file 编码
-
- 对 test_file 恢复读,即执行 ./evenodd read test_file test_file.read,然后比较 test_file 和 test_file.read 是否相同
-
- 故障读测试:随机删除 disk_{0,p+1} 下的 test_file(不超过2个),然后恢复读,读出 test_file.read 和 test_file 比较。
- 注意:
- 测试的时候,文件大小范围要全,比如 1KiB - GiB
- 质数 p 的选择根据文件大小相应增大减少 @wangyaning45
编解码正确性似乎有点问题,取出来的文件会少一些字节
在项目根目录运行这个脚本:
#!/bin/sh
sh compile.sh
cp /usr/bin/ls ls.orig
cp ls.orig ls
cnt=0
while diff ls.orig ls; do
./evenodd write ls.orig 31
rm -rf disk_9
./evenodd repair 1 9
./evenodd read ls.orig ls
cnt=$((cnt + 1))
done
echo error detected after "$cnt" runs
这个脚本会重复执行以下过程:
- 以
p=31
存入文件ls
- 毁掉第 9 个磁盘
- 修复第 9 个磁盘
- 把
ls
读出来,并且与原始文件比较
正常情况应该是脚本不退出,且 ls 和 ls.orig 始终一致。但是本项目中,这个脚本会在循环 1 至 2 次后退出。检查 ls 和 ls.orig 文件会发现,取出来的 ls 前面部分和 ls.orig 一致,尾部丢失了一些字节……
代码跑得真的很快,谢谢大佬的分享 <3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.