refactor test_fs_lz4fs_package
This commit is contained in:
Родитель
9337ce399e
Коммит
0edb0a904a
|
@ -67,7 +67,12 @@ void EMSCRIPTEN_KEEPALIVE finish() {
|
|||
printf("success. read IO time: %f (%d reads), total time: %f\n", after - before, counter, after - before_it_all);
|
||||
|
||||
// all done
|
||||
int result = 1;
|
||||
int result;
|
||||
#if LOAD_MANUALLY
|
||||
result = 1;
|
||||
#else
|
||||
result = 2;
|
||||
#endif
|
||||
REPORT_RESULT();
|
||||
}
|
||||
|
||||
|
@ -76,6 +81,7 @@ void EMSCRIPTEN_KEEPALIVE finish() {
|
|||
int main() {
|
||||
before_it_all = emscripten_get_now();
|
||||
|
||||
#if LOAD_MANUALLY
|
||||
EM_ASM({
|
||||
var COMPLETE_SIZE = 10*1024*128*3;
|
||||
|
||||
|
@ -122,6 +128,9 @@ int main() {
|
|||
});
|
||||
|
||||
emscripten_exit_with_live_runtime();
|
||||
#else
|
||||
finish();
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -1032,14 +1032,18 @@ keydown(100);keyup(100); // trigger the end
|
|||
self.btest(os.path.join('fs', 'test_workerfs_package.cpp'), '1', args=['--proxy-to-worker'])
|
||||
|
||||
def test_fs_lz4fs_package(self):
|
||||
# generate data
|
||||
import random
|
||||
open('file1.txt', 'w').write('0123456789' * (1024*128))
|
||||
open('file2.txt', 'w').write('1234567890' * (1024*128))
|
||||
random_data = [chr(random.randint(0,255)) for x in range(1024*128*10)]
|
||||
random_data[17] = 'X'
|
||||
open('file3.txt', 'w').write(''.join(random_data))
|
||||
Popen([PYTHON, FILE_PACKAGER, 'files.data', '--preload', 'file1.txt', 'file2.txt', 'file3.txt', '--separate-metadata', '--js-output=files.js']).communicate()
|
||||
self.btest(os.path.join('fs', 'test_lz4fs.cpp'), '1', args=[], timeout=60)
|
||||
|
||||
# load the data into LZ4FS manually at runtime. This means we compress on the client. This is generally not recommended
|
||||
print 'manual'
|
||||
subprocess.check_output([PYTHON, FILE_PACKAGER, 'files.data', '--preload', 'file1.txt', 'file2.txt', 'file3.txt', '--separate-metadata', '--js-output=files.js'])
|
||||
self.btest(os.path.join('fs', 'test_lz4fs.cpp'), '1', args=['-DLOAD_MANUALLY'], timeout=60)
|
||||
|
||||
def test_idbstore(self):
|
||||
secret = str(time.time())
|
||||
|
|
Загрузка…
Ссылка в новой задаче