diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0b974c6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.DS_Store +ace/*.log +build/ +harness diff --git a/ace/ace.py b/ace/ace.py new file mode 100755 index 0000000..fcfd234 --- /dev/null +++ b/ace/ace.py @@ -0,0 +1,1464 @@ +#!/usr/bin/env python + +#To run : python ace.py -l -n -d +import os +import re +import sys +import stat +import subprocess +import argparse +import time +import itertools +import json +import pprint +import collections +import threading +from progressbar import * +from shutil import copyfile +from string import maketrans +from multiprocessing import Pool +from progress.bar import * + + +#All functions that has options go here + +FallocOptions = ['FALLOC_FL_ZERO_RANGE', 'FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE','FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE','FALLOC_FL_KEEP_SIZE', 0] + +FsyncOptions = ['fsync','fdatasync', 'sync'] + +#This should take care of file name/ dir name +#Default option : test, test/A [foo, bar] , test/B [foo, bar] +# We have seperated it out into two sets, first and second, in order to eliminate duplicate workloads that differ just in terms of file names. +FileOptions = ['foo', 'A/foo'] #foo +SecondFileOptions = ['bar', 'A/bar'] #bar + +#A,B are subdirectories under test +# test directory(root) is under a separate list because we don't want to try to create/remove it in the workload. But we should be able to fsync it. +DirOptions = ['A'] +TestDirOptions = ['test'] +SecondDirOptions = ['B'] + + +#this will take care of offset + length combo +#Start = 4-16K , append = 16K-20K, overlap = 8000 - 12096, prepend = 0-4K + +#Append should append to file size, and overwrites should be possible +#WriteOptions = ['append', 'overlap_unaligned_start', 'overlap_extend', 'overlap_unaligned_end'] +WriteOptions = ['append', 'overlap_unaligned_start', 'overlap_extend'] # 'overlap_unaligned_end' + + +#d_overlap = 8K-12K (has to be aligned) +#dWriteOptions = ['append', 'overlap_start', 'overlap_end'] +dWriteOptions = ['append', 'overlap_start'] # 'overlap_end' + +#Truncate file options 'aligned' +TruncateOptions = ['unaligned'] + +#Set of file-system operations to be used in test generation. +# We currently support : creat, mkdir, falloc, write, dwrite, link, unlink, remove, rename, fsetxattr, removexattr, truncate, mmapwrite, symlink, fsync, fdatasync, sync +OperationSet = ['creat', 'mkdir', 'falloc', 'write', 'dwrite','mmapwrite', 'link', 'unlink', 'remove', 'rename', 'fsetxattr', 'removexattr', 'truncate', 'fdatasync'] + +#The sequences we want to reach to, to reproduce known bugs. +expected_sequence = [] +expected_sync_sequence = [] + + +#return sibling of a file/directory +def SiblingOf(file): + if file == 'foo': + return 'bar' + elif file == 'bar' : + return 'foo' + elif file == 'A/foo': + return 'A/bar' + elif file == 'A/bar': + return 'A/foo' + elif file == 'B/foo': + return 'B/bar' + elif file == 'B/bar' : + return 'B/foo' + elif file == 'AC/foo': + return 'AC/bar' + elif file == 'AC/bar' : + return 'AC/foo' + elif file == 'A' : + return 'B' + elif file == 'B': + return 'A' + elif file == 'AC' : + return 'AC' + elif file == 'test': + return 'test' + +#Return parent of a file/directory +def Parent(file): + if file == 'foo' or file == 'bar': + return 'test' + if file == 'A/foo' or file == 'A/bar' or file == 'AC': + return 'A' + if file == 'B/foo' or file == 'B/bar': + return 'B' + if file == 'A' or file == 'B' or file == 'test': + return 'test' + if file == 'AC/foo' or file == 'AC/bar': + return 'AC' + + +# Given a list of files, return a list of related files. +# These are optimizations to reduce the effective workload set, by persisting only related files during workload generation. +def file_range(file_list): + file_set = list(file_list) + for i in xrange(0, len(file_list)): + file_set.append(SiblingOf(file_list[i])) + file_set.append(Parent(file_list[i])) + return list(set(file_set)) + + +#----------------------Known Bug summary-----------------------# + +#Length 1 = 3 +#Length 2 = 14 +#length 3 = 9 + +# Total encoded = 26 +#--------------------------------------------------------------# +#TODO: Update this list carefully. +#If we don't allow dependency ops on same file, we'll miss this in seq2 +#This is actually seq 2 = [link foo-bar, 'sync', unlink bar, 'fsync-bar'] +# 1. btrfs_link_unlink 3 (yes finds in 2) +expected_sequence.append([('link', ('foo', 'bar')), ('unlink', ('bar')), ('creat', ('bar'))]) +expected_sync_sequence.append([('sync'), ('none'), ('fsync', 'bar')]) + + +# 2. btrfs_rename_special_file 3 (yes in 3) +expected_sequence.append([('mknod', ('foo')), ('rename', ('foo', 'bar')), ('link', ('bar', 'foo'))]) +expected_sync_sequence.append([('fsync', 'bar'), ('none'), ('fsync', 'bar')]) + +# 3. new_bug1_btrfs 2 (Yes finds in 2) +expected_sequence.append([('write', ('foo', 'append')), ('falloc', ('foo', 'FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE', 'append'))]) +expected_sync_sequence.append([('fsync', 'foo'), ('fsync', 'foo')]) + +# 4. new_bug2_f2fs 3 (Yes finds in 2) +expected_sequence.append([('write', ('foo', 'append')), ('falloc', ('foo', 'FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE', 'append')), ('fdatasync', ('foo'))]) +expected_sync_sequence.append([('sync'), ('none'), ('none')]) + +#We miss this in seq-2, because we disallow workloads of sort creat, creat +# 5. generic_034 2 +expected_sequence.append([('creat', ('A/foo')), ('creat', ('A/bar'))]) +expected_sync_sequence.append([('sync'), ('fsync', 'A')]) + +# 6. generic_039 2 (Yes finds in 2) +expected_sequence.append([('link', ('foo', 'bar')), ('remove', ('bar'))]) +expected_sync_sequence.append([('sync'), ('fsync', 'foo')]) + +# 7. generic_059 2 (yes finds in 2) +expected_sequence.append([('write', ('foo', 'append')), ('falloc', ('foo', 'FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE', 'overlap_unaligned'))]) +expected_sync_sequence.append([('sync'), ('fsync', 'foo')]) + +# 8. generic_066 2 (Yes finds in 2) +expected_sequence.append([('fsetxattr', ('foo')), ('removexattr', ('foo'))]) +expected_sync_sequence.append([('sync'), ('fsync', 'foo')]) + +#Reachable from current seq 2 generator (#1360 : creat A/foo, rename A,B) (sync, fsync A) +#We will miss this, if we restrict that op2 reuses files from op1 +# 9. generic_341 3 (Yes finds in 2) +expected_sequence.append([('creat', ('A/foo')), ('rename', ('A', 'B')), ('mkdir', ('A'))]) +expected_sync_sequence.append([('sync'), ('none'), ('fsync', 'A')]) + +# 10. generic_348 1 (yes finds in 1) +expected_sequence.append([('symlink', ('foo', 'A/bar'))]) +expected_sync_sequence.append([('fsync', 'A')]) + +# 11. generic_376 2 (yes finds in 2) +expected_sequence.append([('rename', ('foo', 'bar')), ('creat', ('foo'))]) +expected_sync_sequence.append([('none'), ('fsync', 'bar')]) + +#Yes reachable from sseeq2 - (falloc (foo, append), fdatasync foo) +# 12. generic_468 3 (yes, finds in 2) +expected_sequence.append([('write', ('foo', 'append')), ('falloc', ('foo', 'FALLOC_FL_KEEP_SIZE', 'append')), ('fdatasync', ('foo'))]) +expected_sync_sequence.append([('sync'), ('none'), ('none')]) + +#We miss this if we sync only used file set - or we need an option 'none' to end the file with +# 13. ext4_direct_write 2 +expected_sequence.append([('write', ('foo', 'append')), ('dwrite', ('foo', 'overlap'))]) +expected_sync_sequence.append([('none'), ('fsync', 'bar')]) + +#14 btrfs_EEXIST (Seq 1) +#creat foo, fsync foo +#write foo 0-4K, fsync foo + +#btrfs use -O extref during mkfs +#15. generic 041 (If we consider the 3000 as setup, then seq length 3) +#create 3000 link(foo, foo_i), sync, unlink(foo_0), link(foo, foo_3001), link(foo, foo_0), fsync foo + +#16. generic 056 (seq2) +#write(foo, 0-4K), fsync foo, link(foo, bar), fsync some random file/dir + +#requires that we allow repeated operations (check if mmap write works here) +#17 generic 090 (seq3) +#write(foo 0-4K), sync, link(foo, bar), sync, append(foo, 4K-8K), fsync foo + +#18 generic_104 (seq2) larger file set +#link(foo, foo1), link(bar, bar1), fsync(bar) + +#19 generic 106 (seq 2) +#link(foo, bar), sync, unlink(bar) *drop cache* fsync foo + +#20 generic 107 (seq 3) +#link(foo, A/foo), link(foo, A/bar), sync, unlink(A/bar), fsync(foo) + +#21 generic 177 +#write(foo, 0-32K), sync, punch_hole(foo, 24K-32K), punch_hole(foo, 4K-64K) fsync foo + +#22 generic 321 2 fsyncs? +#rename(foo, A/foo), fsync A, fsync A/foo + +#23 generic 322 (yes, seq1) +#rename(A/foo, A/bar), fsync(A/bar) + +#24 generic 335 (seq 2) but larger file set +#rename(A/foo, foo), creat bar, fsync(test) + +#25 generic 336 (seq 4) +#link(A/foo, B/foo), creat B/bar, sync, unlink(B/foo), mv(B/bar, C/bar), fsync A/foo + + +#26 generic 342 (seq 3) +# write foo 0-4K, sync, rename(foo,bar), write(foo) fsync(foo) + +#27 generic 343 (seq 2) +#link(A/foo, A/bar) , rename(B/foo_new, A/foo_new), fsync(A/foo) + +#28 generic 325 (seq3) +#write,(foo, 0-256K), mmapwrite(0-4K), mmapwrite(252-256K), msync(0-64K), msync(192-256K) + + + +def build_parser(): + parser = argparse.ArgumentParser(description='Automatic Crash Explorer v0.1') + + # global args + parser.add_argument('--sequence_len', '-l', default='3', help='Number of critical ops in the bugy workload') + parser.add_argument('--nested', '-n', default='False', help='Add an extra level of nesting?') + parser.add_argument('--demo', '-d', default='False', help='Create a demo workload set?') + + return parser + + +def print_setup(parsed_args): + print '\n{: ^50s}'.format('Automatic Crash Explorer v0.1\n') + print '='*20, 'Setup' , '='*20, '\n' + print '{0:20} {1}'.format('Sequence length', parsed_args.sequence_len) + print '{0:20} {1}'.format('Nested', parsed_args.nested) + print '{0:20} {1}'.format('Demo', parsed_args.demo) + print '\n', '='*48, '\n' + + +# Helper to build all possible combination of parameters to a given file-system operation +def buildTuple(command): + if command == 'creat': + d = tuple(FileOptions) + elif command == 'mkdir' or command == 'rmdir': + d = tuple(DirOptions) + elif command == 'mknod': + d = tuple(FileOptions) + elif command == 'falloc': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(FallocOptions) + d_tmp.append(WriteOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'write': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(WriteOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'dwrite': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(dWriteOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'link' or command == 'symlink': + d_tmp = list() + d_tmp.append(FileOptions + SecondFileOptions) + d_tmp.append(SecondFileOptions) + d = list() + for i in itertools.product(*d_tmp): + if len(set(i)) == 2: + d.append(i) + elif command == 'rename': + d_tmp = list() + d_tmp.append(FileOptions + SecondFileOptions) + d_tmp.append(SecondFileOptions) + d = list() + for i in itertools.product(*d_tmp): + if len(set(i)) == 2: + d.append(i) + d_tmp = list() + d_tmp.append(DirOptions + SecondDirOptions) + d_tmp.append(SecondDirOptions) + for i in itertools.product(*d_tmp): + if len(set(i)) == 2: + d.append(i) + elif command == 'remove' or command == 'unlink': + d = tuple(FileOptions +SecondFileOptions) + elif command == 'fdatasync' or command == 'fsetxattr' or command == 'removexattr': + d = tuple(FileOptions) + elif command == 'fsync': + d = tuple(FileOptions + DirOptions + TestDirOptions + SecondFileOptions + SecondDirOptions) + elif command == 'truncate': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(TruncateOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'mmapwrite': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(dWriteOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + else: + d=() + return d + + +# Given a restricted list of files, this function builds all combinations of input parameters to persistence operations. +# Once the parameters to core-ops are picked, it is not required to persist a file totally unrelated to the set of used files in the workload. So we can restrict the set of files for persistence to either related files(includes the parent and siblings of files used in the workload) or further restrict it to strictly pick from the set of used files only. +# We can optionally add a persistence point after each core-FS op, except for the last one. The last core-op must be followed by a persistence op, so that we don't truncate it to a workload of lower sequence. +def buildCustomTuple(file_list): + global num_ops + + d = list(file_list) + fsync = ('fsync',) + sync = ('sync') + none = ('none') + SyncSetCustom = list() + SyncSetNoneCustom = list() + for i in xrange(0, len(d)): + tup = list(fsync) + tup.append(d[i]) + SyncSetCustom.append(tuple(tup)) + SyncSetNoneCustom.append(tuple(tup)) + + SyncSetCustom.append(sync) + SyncSetNoneCustom.append(sync) + SyncSetCustom.append(none) + SyncSetCustom = tuple(SyncSetCustom) + SyncSetNoneCustom = tuple(SyncSetNoneCustom) + syncPermutationsCustom = list() + + if int(num_ops) == 1: + for i in itertools.product(SyncSetNoneCustom): + syncPermutationsCustom.append(i) + + elif int(num_ops) == 2: + for i in itertools.product(SyncSetCustom, SyncSetNoneCustom): + syncPermutationsCustom.append(i) + + elif int(num_ops) == 3: + for i in itertools.product(SyncSetCustom, SyncSetCustom, SyncSetNoneCustom): + syncPermutationsCustom.append(i) + + elif int(num_ops) == 4: + for i in itertools.product(SyncSetCustom, SyncSetCustom, SyncSetCustom, SyncSetNoneCustom): + syncPermutationsCustom.append(i) + + return syncPermutationsCustom + + +# Find the auto-generated workload that matches the necoded sequence of known bugs. This is to sanity check that Ace can indeed generate workloads to reproduce the bug, if run on appropriate kernel veersions. +def isBugWorkload(opList, paramList, syncList): + for i in xrange(0,len(expected_sequence)): + if len(opList) != len(expected_sequence[i]): + continue + + flag = 1 + + for j in xrange(0, len(expected_sequence[i])): + if opList[j] == expected_sequence[i][j][0] and paramList[j] == expected_sequence[i][j][1] and tuple(syncList[j]) == tuple(expected_sync_sequence[i][j]): + continue + else: + flag = 0 + break + + if flag == 1: + print 'Found match to Bug # ', i+1, ' : in file # ' , global_count + print 'Length of seq : ', len(expected_sequence[i]) + print 'Expected sequence = ' , expected_sequence[i] + print 'Expected sync sequence = ', expected_sync_sequence[i] + print 'Auto generator found : ' + print opList + print paramList + print syncList + print '\n\n' + return True + + +# A bunch of functions to insert ops into the j-lang file. +def insertUnlink(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + open_file_map.pop(file_name, None) + return ('unlink', file_name) + +def insertRmdir(file_name,open_dir_map, open_file_map, file_length_map, modified_pos): + open_dir_map.pop(file_name, None) + return ('rmdir', file_name) + +def insertXattr(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + return ('fsetxattr', file_name) + +def insertOpen(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + if file_name in FileOptions or file_name in SecondFileOptions: + open_file_map[file_name] = 1 + elif file_name in DirOptions or file_name in SecondDirOptions or file_name in TestDirOptions: + open_dir_map[file_name] = 1 + return ('open', file_name) + +def insertMkdir(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + if file_name in DirOptions or file_name in SecondDirOptions or file_name in TestDirOptions: + open_dir_map[file_name] = 0 + return ('mkdir', file_name) + +def insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + if file_name in FileOptions or file_name in SecondFileOptions: + open_file_map[file_name] = 0 + elif file_name in DirOptions or file_name in SecondDirOptions or file_name in TestDirOptions: + open_dir_map[file_name] = 0 + return ('close', file_name) + +def insertWrite(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + if file_name not in file_length_map: + file_length_map[file_name] = 0 + file_length_map[file_name] += 1 + return ('write', (file_name, 'append')) + + +#Dependency checks : Creat - file should not exist. If it does, remove it. +def checkCreatDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_name = current_sequence[pos][1] + + + #Either open or closed doesn't matter. File should not exist at all + if file_name in open_file_map: + #Insert dependency before the creat command + modified_sequence.insert(modified_pos, insertUnlink(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + return modified_pos + +#Dependency checks : Mkdir +def checkDirDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_name = current_sequence[pos][1] + if file_name not in DirOptions and file_name not in SecondDirOptions: + print 'Invalid param list for mkdir' + + #Either open or closed doesn't matter. Directory should not exist at all + # TODO : We heavily depend on the pre-defined file list. Need to generalize it at some point. + if file_name in open_dir_map and file_name != 'test': + #if dir is A, remove contents within it too + if file_name == 'A': + if 'A/foo' in open_file_map and open_file_map['A/foo'] == 1: + file = 'A/foo' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'A/foo' in open_file_map and open_file_map['A/foo'] == 0: + file = 'A/foo' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + if 'A/bar' in open_file_map and open_file_map['A/bar'] == 1: + file = 'A/bar' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'A/bar' in open_file_map and open_file_map['A/bar'] == 0: + file = 'A/bar' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + if 'AC' in open_dir_map and open_dir_map['AC'] == 1: + file = 'AC' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + if 'AC' in open_dir_map: + if 'AC/foo' in open_file_map and open_file_map['AC/foo'] == 1: + file = 'AC/foo' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'AC/foo' in open_file_map and open_file_map['AC/foo'] == 0: + file = 'AC/foo' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + if 'AC/bar' in open_file_map and open_file_map['AC/bar'] == 1: + file = 'AC/bar' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'AC/bar' in open_file_map and open_file_map['AC/bar'] == 0: + file = 'AC/bar' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + file = 'AC' + modified_sequence.insert(modified_pos, insertRmdir(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + + if file_name == 'B': + if 'B/foo' in open_file_map and open_file_map['B/foo'] == 1: + file = 'B/foo' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'B/foo' in open_file_map and open_file_map['B/foo'] == 0: + file = 'B/foo' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + if 'B/bar' in open_file_map and open_file_map['B/bar'] == 1: + file = 'B/bar' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'B/bar' in open_file_map and open_file_map['B/bar'] == 0: + file = 'B/bar' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + if file_name == 'AC': + if 'AC/foo' in open_file_map and open_file_map['AC/foo'] == 1: + file = 'AC/foo' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'AC/foo' in open_file_map and open_file_map['AC/foo'] == 0: + file = 'AC/foo' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + if 'AC/bar' in open_file_map and open_file_map['AC/bar'] == 1: + file = 'AC/bar' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'AC/bar' in open_file_map and open_file_map['AC/bar'] == 0: + file = 'AC/bar' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + + #Insert dependency before the creat command + modified_sequence.insert(modified_pos, insertRmdir(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + return modified_pos + +# Check if parent directories exist, if not create them. +def checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_names = current_sequence[pos][1] + if isinstance(file_names, basestring): + file_name = file_names + #Parent dir doesn't exist + if (Parent(file_name) == 'A' or Parent(file_name) == 'B') and Parent(file_name) not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir(Parent(file_name), open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + if Parent(file_name) == 'AC' and Parent(file_name) not in open_dir_map: + if Parent(Parent(file_name)) not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir(Parent(Parent(file_name)), open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + modified_sequence.insert(modified_pos, insertMkdir(Parent(file_name), open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + + + else: + file_name = file_names[0] + file_name2 = file_names[1] + + #Parent dir doesn't exist + if (Parent(file_name) == 'A' or Parent(file_name) == 'B') and Parent(file_name) not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir(Parent(file_name), open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + if Parent(file_name) == 'AC' and Parent(file_name) not in open_dir_map: + if Parent(Parent(file_name)) not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir(Parent(Parent(file_name)), open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + modified_sequence.insert(modified_pos, insertMkdir(Parent(file_name), open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + #Parent dir doesn't exist + if (Parent(file_name2) == 'A' or Parent(file_name2) == 'B') and Parent(file_name2) not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir(Parent(file_name2), open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + if Parent(file_name2) == 'AC' and Parent(file_name2) not in open_dir_map: + if Parent(Parent(file_name2)) not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir(Parent(Parent(file_name2)), open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + modified_sequence.insert(modified_pos, insertMkdir(Parent(file_name2), open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + return modified_pos + + +# Check the dependency that file already exists and is open, eg. before writing to a file +def checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_names = current_sequence[pos][1] + if isinstance(file_names, basestring): + file_name = file_names + else: + file_name = file_names[0] + + # If we are trying to fsync a dir, ensure it exists + if file_name in DirOptions or file_name in SecondDirOptions or file_name in TestDirOptions: + if file_name not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + if file_name in open_dir_map and open_dir_map[file_name] == 0: + modified_sequence.insert(modified_pos, insertOpen(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + + if file_name in FileOptions or file_name in SecondFileOptions: + if file_name not in open_file_map or open_file_map[file_name] == 0: + #Insert dependency - open before the command + modified_sequence.insert(modified_pos, insertOpen(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + return modified_pos + +#Ensures that the file is closed. If not, closes it. +def checkClosed(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + + file_names = current_sequence[pos][1] + if isinstance(file_names, basestring): + file_name = file_names + else: + file_name = file_names[0] + + if file_name in open_file_map and open_file_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + if file_name in open_dir_map and open_dir_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + return modified_pos + +#If the op is remove xattr, we need to ensure, there's atleast one associated xattr to the file +def checkXattr(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_name = current_sequence[pos][1] + if open_file_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertXattr(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + return modified_pos + +# For overwrites ensure that the file is not empty. +def checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + + file_names = current_sequence[pos][1] + if isinstance(file_names, basestring): + file_name = file_names + else: + file_name = file_names[0] + + # 0 length file + if file_name not in file_length_map: + modified_sequence.insert(modified_pos, insertWrite(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + return modified_pos + + +# Handles satisfying dependencies, for a given core FS op +def satisfyDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + if isinstance(current_sequence[pos], basestring): + command = current_sequence[pos] + else: + command = current_sequence[pos][0] + + # print 'Command = ', command + + if command == 'creat' or command == 'mknod': + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkCreatDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + file = current_sequence[pos][1] + open_file_map[file] = 1 + + elif command == 'mkdir': + modified_pos = checkDirDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + dir = current_sequence[pos][1] + open_dir_map[dir] = 0 + + elif command == 'falloc': + file = current_sequence[pos][1][0] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #if file doesn't exist, has to be created and opened + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + #Whatever the op is, let's ensure file size is non zero + modified_pos = checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + + elif command == 'write' or command == 'dwrite' or command == 'mmapwrite': + file = current_sequence[pos][1][0] + option = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #if file doesn't exist, has to be created and opened + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + + #if we chose to do an append, let's not care about the file size + # however if its an overwrite or unaligned write, then ensure file is atleast one page long + if option == 'append': + if file not in file_length_map: + file_length_map[file] = 0 + file_length_map[file] += 1 +# elif option == 'overlap_unaligned_start' or 'overlap_unaligned_end' or 'overlap_start' or 'overlap_end' or 'overlap_extend': + elif option == 'overlap' or 'overlap_aligned' or 'overlap_unaligned': + modified_pos = checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #If we do a dwrite, let's close the file after that + if command == 'dwrite': + if file in FileOptions or file in SecondFileOptions: + open_file_map[file] = 0 + + + elif command == 'link': + second_file = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + if second_file in open_file_map and open_file_map[second_file] == 1: + #Insert dependency - open before the command + modified_sequence.insert(modified_pos, insertClose(second_file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + #if we have a closed file, remove it + if second_file in open_file_map and open_file_map[second_file] == 0: + #Insert dependency - open before the command + modified_sequence.insert(modified_pos, insertUnlink(second_file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + + #We have created a new file, but it isn't open yet + open_file_map[second_file] = 0 + + elif command == 'rename': + #If the file was open during rename, does the handle now point to new file? + first_file = current_sequence[pos][1][0] + second_file = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #Checks if first file is closed + modified_pos = checkClosed(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + if second_file in open_file_map and open_file_map[second_file] == 1: + #Insert dependency - close the second file + modified_sequence.insert(modified_pos, insertClose(second_file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + #We have removed the first file, and created a second file + if first_file in FileOptions or first_file in SecondFileOptions: + open_file_map.pop(first_file, None) + open_file_map[second_file] = 0 + elif first_file in DirOptions or first_file in SecondDirOptions: + open_dir_map.pop(first_file, None) + open_dir_map[second_file] = 0 + + + elif command == 'symlink': + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #No dependency checks + pass + + elif command == 'remove' or command == 'unlink': + #Close any open file handle and then unlink + file = current_sequence[pos][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos,open_dir_map, open_file_map, file_length_map) + modified_pos = checkClosed(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #Remove file from map + open_file_map.pop(file, None) + + + elif command == 'removexattr': + #Check that file exists + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + #setxattr + modified_pos = checkXattr(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + elif command == 'fsync' or command == 'fdatasync' or command == 'fsetxattr': + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + elif command == 'none' or command == 'sync': + pass + + elif command == 'truncate': + file = current_sequence[pos][1][0] + option = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + # if file doesn't exist, has to be created and opened + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + # Put some data into the file + modified_pos = checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + else: + print command + print 'Invalid command' + + return modified_pos + +#Helper to merge lists +def flatList(op_list): + flat_list = list() + if not isinstance(op_list, basestring): + for sublist in op_list: + if not isinstance(sublist, basestring): + for item in sublist: + flat_list.append(item) + else: + flat_list.append(sublist) + else: + flat_list.append(op_list) + + return flat_list + + +# Creates the actual J-lang file. +def buildJlang(op_list, length_map): + flat_list = list() + if not isinstance(op_list, basestring): + for sublist in op_list: + if not isinstance(sublist, basestring): + for item in sublist: + flat_list.append(item) + else: + flat_list.append(sublist) + else: + flat_list.append(op_list) + + command_str = '' + command = flat_list[0] + if command == 'open': + file = flat_list[1] + if file in DirOptions or file in SecondDirOptions or file in TestDirOptions: + command_str = command_str + 'opendir ' + file.replace('/','') + ' 0777' + else: + command_str = command_str + 'open ' + file.replace('/','') + ' O_RDWR|O_CREAT 0777' + + if command == 'creat': + file = flat_list[1] + command_str = command_str + 'open ' + file.replace('/','') + ' O_RDWR|O_CREAT 0777' + + if command == 'mkdir': + file = flat_list[1] + command_str = command_str + 'mkdir ' + file.replace('/','') + ' 0777' + + if command == 'mknod': + file = flat_list[1] + command_str = command_str + 'mknod ' + file.replace('/','') + ' TEST_FILE_PERMS|S_IFCHR|S_IFBLK' + ' 0' + + + if command == 'falloc': + file = flat_list[1] + option = flat_list[2] + write_op = flat_list[3] + command_str = command_str + 'falloc ' + file.replace('/','') + ' ' + str(option) + ' ' + if write_op == 'append': + off = str(length_map[file]) + lenn = '32768' + length_map[file] += 32768 + elif write_op == 'overlap_unaligned_start': + off = '0' + lenn = '5000' + elif write_op == 'overlap_unaligned_end': + size = length_map[file] + off = str(size-5000) + lenn = '5000' + elif write_op == 'overlap_extend': + size = length_map[file] + off = str(size-2000) + lenn = '5000' + length_map[file] += 3000 + + command_str = command_str + off + ' ' + lenn + + if command == 'write': + file = flat_list[1] + write_op = flat_list[2] + command_str = command_str + 'write ' + file.replace('/','') + ' ' + if write_op == 'append': + lenn = '32768' + if file not in length_map: + length_map[file] = 0 + off = '0' + else: + off = str(length_map[file]) + + length_map[file] += 32768 + + elif write_op == 'overlap_unaligned_start': + off = '0' + lenn = '5000' + elif write_op == 'overlap_unaligned_end': + size = length_map[file] + off = str(size-5000) + lenn = '5000' + elif write_op == 'overlap_extend': + size = length_map[file] + off = str(size-2000) + lenn = '5000' + + command_str = command_str + off + ' ' + lenn + + if command == 'dwrite': + file = flat_list[1] + write_op = flat_list[2] + command_str = command_str + 'dwrite ' + file.replace('/','') + ' ' + + if write_op == 'append': + lenn = '32768' + if file not in length_map: + length_map[file] = 0 + off = '0' + else: + off = str(length_map[file]) + length_map[file] += 32768 + + elif write_op == 'overlap_start': + off = '0' + lenn = '8192' + elif write_op == 'overlap_end': + size = length_map[file] + off = str(size-8192) + lenn = '8192' + + command_str = command_str + off + ' ' + lenn + + if command == 'mmapwrite': + file = flat_list[1] + write_op = flat_list[2] + ret = flat_list[3] + command_str = command_str + 'mmapwrite ' + file.replace('/','') + ' ' + + if write_op == 'append': + lenn = '32768' + if file not in length_map: + length_map[file] = 0 + off = '0' + else: + off = str(length_map[file]) + length_map[file] += 32768 + + elif write_op == 'overlap_start': + off = '0' + lenn = '8192' + elif write_op == 'overlap_end': + size = length_map[file] + off = str(size-8192) + lenn = '8192' + + command_str = command_str + off + ' ' + lenn + '\ncheckpoint ' + ret + + + + if command == 'link' or command =='rename' or command == 'symlink': + file1 = flat_list[1] + file2 = flat_list[2] + command_str = command_str + command + ' ' + file1.replace('/','') + ' ' + file2.replace('/','') + + if command == 'unlink'or command == 'remove' or command == 'rmdir' or command == 'close' or command == 'fsetxattr' or command == 'removexattr': + file = flat_list[1] + command_str = command_str + command + ' ' + file.replace('/','') + + if command == 'fsync': + file = flat_list[1] + ret = flat_list[2] + command_str = command_str + command + ' ' + file.replace('/','') + '\ncheckpoint ' + ret + + if command =='fdatasync': + file = flat_list[1] + ret = flat_list[2] + command_str = command_str + command + ' ' + file.replace('/','') + '\ncheckpoint ' + ret + + + if command == 'sync': + ret = flat_list[1] + command_str = command_str + command + '\ncheckpoint ' + ret + + if command == 'none': + command_str = command_str + command + + + if command == 'truncate': + file = flat_list[1] + trunc_op = flat_list[2] + command_str = command_str + command + ' ' + file.replace('/','') + ' ' + if trunc_op == 'aligned': + len = '0' + length_map[file] = 0 + elif trunc_op == 'unaligned': + len = '2500' + command_str = command_str + len + + return command_str + + +# Main function that exhaustively generates combinations of ops. +def doPermutation(perm): + + global global_count + global parameterList + global num_ops + global nested + global demo + global syncPermutations + global count + global permutations + global SyncSet + global log_file_handle + global count_param + + dest_dir = 'seq'+num_ops + + if nested: + dest_dir += '_nested' + + if demo: + dest_dir += '_demo' + + + # Hacks to reduce the workload set (#1): + # Eliminate workloads of seq-3 in which all three core-ops are write, because we have a write specific workload generator to explore these cases. + if int(num_ops)==3 and len(set(perm)) == 1 and list(set(perm))[0] == 'write': + return + + permutations.append(perm) + log = ', '.join(perm); + log = '\n' + `count` + ' : ' + log + '\n' + count +=1 + log_file_handle.write(log) + + #Now for each of this permutation of file-system operations, find all possible permutation of paramters + combination = list() + for length in xrange(0,len(permutations[count-1])): + combination.append(parameterList[permutations[count-1][length]]) + + count_param = 0 + + # **PHASE 2** : Exhaustively populate parameters to the chosen skeleton in phase 1 + for currentParameterOption in itertools.product(*combination): + + #files used so far + usedSofar = list() + intersect = list() + + # Hacks to reduce the workload set (#2): + # Allow this combination of parameters only if we reuse files across the chosen operations. + toSkip = False + for paramLength in xrange(0, int(num_ops)): + intersect = list(set(currentParameterOption[paramLength]) & set(usedSofar)) + if currentParameterOption[paramLength][0] == 'A' or currentParameterOption[paramLength][0] == 'B' or currentParameterOption[paramLength][0] == 'AC': + intersect.append('A') + elif len(usedSofar) == 2 and (usedSofar[0] == 'A' or usedSofar[0] == 'B' or usedSofar[0] == 'AC'): + intersect.append('A') + usedSofar = list(set(currentParameterOption[paramLength]) | set(usedSofar)) + if len(intersect) == 0 and paramLength > 0 and int(num_ops) == 3: + #print 'Skip this option' + toSkip = True + continue + + if toSkip: + continue + + log = '{0}'.format(currentParameterOption) + log = '\t' + `count_param` + ' : ' + log + '\n' + count_param += 1 + log_file_handle.write(log) + + #Let's insert fsync combinations here. + count_sync = 0 + usedFiles = list() + flat_used_list = flatList(currentParameterOption) + for file_len in xrange(0, len(flat_used_list)): + if isinstance(flat_used_list[file_len], basestring): + usedFilesList = list(set(flat_used_list) & set(FileOptions + SecondFileOptions + DirOptions + SecondDirOptions + TestDirOptions)) + usedFiles.append(tuple(usedFilesList)) + #else: + # usedFilesList = [filter(lambda x: x in list(FileOptions + SecondFileOptions + DirOptions + SecondDirOptions + TestDirOptions), sublist) for sublist in currentParameterOption] + # usedFilesList = flatList(usedFilesList) + # usedFiles = list(set(set(usedFilesList) | set(usedFiles))) + + usedFiles = flatList(set(usedFiles)) + + #For lower sequences, let's allow fsync on any related file - sibling/parent + if int(num_ops) < 3 and not demo: + syncPermutationsCustom = buildCustomTuple(file_range(usedFiles)) + else: + syncPermutationsCustom = buildCustomTuple(usedFiles) + + # Logging the list of used files + log = '\n\t\tUsed Files = {0}\n'.format(usedFiles) + log = log + '\t\tFile range = {0}\n'.format(file_range(usedFiles)) + log_file_handle.write(log) + + + # Fdatasync could be used as a file-system op itself. + # So, we need to ensure that we don't insert an additional persistence point after it. + # Also, mmapwrite has msync attached to it. So we'll skip adding persistence point after mmapwrite as well. + isFadatasync = False + + # **PHASE 3** : Insert all combinations of persistence ops to the generated phase-2 workloads. + for insSync in range(0, len(syncPermutationsCustom)): + if int(num_ops) < 4: + log = '{0}'.format(syncPermutationsCustom[insSync]); + log = '\n\t\tFile # ' + `global_count` + ' : ' + `count_sync` + ' : ' + log + '\n' + log_file_handle.write(log) + global_count +=1 + count_sync+=1 + seq = [] + + #merge the lists here . Just check if perm has fdatasync. If so skip adding any sync: + for length in xrange(0, len(perm)): + skip_sync = False + op = list() + if perm[length] == 'fdatasync' or perm[length] == 'mmapwrite': + skip_sync = True + isFadatasync = True + else: + op.append(perm[length]) + + # Now merge parameters and add return value to the persistence point. + # A CM checkpoint() is added after persistence point, which has to return 1 if its the last persistence point in the workload, else 0. We handle this CM specific requirement here. + if skip_sync: + op.append(perm[length]) + op.append(currentParameterOption[length]) + if length == len(perm)-1: + op.append('1') + else: + op.append('0') + op = tuple(flatList(op)) + + else: + op.append(currentParameterOption[length]) + + + seq.append(tuple(op)) + + if not skip_sync: + sync_op = list() + sync_op.append(syncPermutationsCustom[insSync][length]) + if length == len(perm)-1: + sync_op.append('1') + else: + sync_op.append('0') + seq.append(tuple(flatList(sync_op))) + + # Logging the skeleton of the workload, including persistence operations and paramters. + log = '\t\t\tCurrent Sequence = {0}'.format(seq); + log_file_handle.write(log) + + + #--------------Satisy dependencies now-------------------- + # **PHASE 4** : Deterministic stage - satisfy dependencies for all ops in the list so far. + modified_pos = 0 + modified_sequence = list(seq) + open_file_map = {} + file_length_map = {} + open_dir_map = {} + + #test dir exists + open_dir_map['test'] = 0 + + # Go over the current sequence of operations and satisfy dependencies for each file-system op + for i in xrange(0, len(seq)): + modified_pos = satisfyDep(seq, i, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + modified_pos += 1 + + #now close all open files + for file_name in open_file_map: + if open_file_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + #close all open directories + for file_name in open_dir_map: + if open_dir_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + #--------------Now build the j-lang file------------------- + j_lang_file = 'j-lang' + str(global_count) + source_j_lang_file = '../src/tests/' + dest_dir + '/base-j-lang' + copyfile(source_j_lang_file, j_lang_file) + length_map = {} + + with open(j_lang_file, 'a') as f: + run_line = '\n\n# run\n' + f.write(run_line) + + for insert in xrange(0, len(modified_sequence)): + cur_line = buildJlang(modified_sequence[insert], length_map) + cur_line_log = '{0}'.format(cur_line) + '\n' + f.write(cur_line_log) + + f.close() + + exec_command = 'python cmAdapter.py -b ../src/tests/' + dest_dir + '/base.cpp -t ' + j_lang_file + ' -p ../src/tests/' + dest_dir + '/ -o ' + str(global_count) + subprocess.call(exec_command, shell=True) + + + log = '\n\t\t\tModified sequence = {0}\n'.format(modified_sequence); + log_file_handle.write(log) + + # Uncomment only if you want to match the generated workloads to the list of encoded workloads. It could slow down generation! + #isBugWorkload(permutations[count-1], j, syncPermutationsCustom[insSync]) + +class SlowBar(FillingCirclesBar): + suffix = '%(percent).0f%% (Completed %(index)d skeletons with %(global_count)d workloads)' + @property + def global_count(self): + return global_count + +global_count = 0 +parameterList = {} +SyncSet = list() +num_ops = 0 +nested = False +demo = False +syncPermutations = [] +count = 0 +permutations = [] +log_file_handle = 0 +count_param = 0 + +def main(): + + global global_count + global parameterList + global num_ops + global syncPermutations + global count + global nested + global permutations + global SyncSet + global demo + global log_file_handle + global count_param + global FileOptions + global SecondFileOptions + global SecondDirOptions + global OperationSet + global FallocOptions + + #open log file + log_file = time.strftime('%Y%m%d_%H%M%S') + '-bugWorkloadGen.log' + log_file_handle = open(log_file, 'w') + + #Parse input args + parsed_args = build_parser().parse_args() + + #Print the test setup - just for sanity + print_setup(parsed_args) + + num_ops = parsed_args.sequence_len + + if parsed_args.nested == ('True' or 'true'): + nested = True + + else: + nested = False + + if parsed_args.demo == ('True' or 'true'): + demo = True + OperationSet = ['link','falloc'] + FallocOptions = ['FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE'] + FileOptions = ['foo'] + SecondFileOptions = ['A/bar'] + + else: + demo = False + + # In case the user requests for an additional level of nesting, add one nested dir A/C and one file within it A/C/foo. + if nested: + FileOptions = FileOptions + ['AC/foo'] + SecondFileOptions = SecondFileOptions + ['AC/bar'] + SecondDirOptions = SecondDirOptions + ['AC'] + + # We just print all known bugs + #for i in xrange(0,len(expected_sequence)): + # print 'Bug #', i+1 + # print expected_sequence[i] + # print expected_sync_sequence[i] + # print '\n' + + + # This is basically the list of possible paramter options for each file-system operation. For example, if the fileset has 4 files and the op is creat, then there are 4 parameter options to creat. We log it just to get an estimate of the increase in the options as we expand the file set. + for i in OperationSet: + parameterList[i] = buildTuple(i) + log = '{0}'.format(parameterList[i]); + log = `i` + ' : Options = ' + `len(parameterList[i])` + '\n' + log + '\n\n' + log_file_handle.write(log) + + d = buildTuple('fsync') + fsync = ('fsync',) + sync = ('sync') + none = ('none') + fdatasync = ('fdatasync',) + + for i in xrange(0, len(d)): + tup = list(fsync) + tup.append(d[i]) + SyncSet.append(tup) + + for i in xrange(0, len(d)): + tup = list(fdatasync) + tup.append(d[i]) + SyncSet.append(tup) + + SyncSet.append(sync) + SyncSet.append(none) + SyncSet = tuple(SyncSet) + + + dest_dir = 'seq'+num_ops + + if nested: + dest_dir += '_nested' + + if demo: + dest_dir += '_demo' + + + # Create a target directory for the final .cpp test files + # The corresponding high-level language file for each test case can be found wthin the directory j-lang-files in the same target directory. + target_path = '../src/tests/' + dest_dir + '/j-lang-files/' + if not os.path.exists(target_path): + os.makedirs(target_path) + + #copy base files into this directory + # We assume that a directory ace-base exists with skeleton for the base j-lang and .cpp files. This has to be something pre-written according to the format required by your record-and-replay tool. + dest_j_lang_file = '../src/tests/' + dest_dir + '/base-j-lang' + source_j_lang_file = '../src/tests/ace-base/base-j-lang' + copyfile(source_j_lang_file, dest_j_lang_file) + + dest_j_lang_cpp = '../src/tests/' + dest_dir + '/base.cpp' + source_j_lang_cpp = '../src/tests/ace-base/base.cpp' + copyfile(source_j_lang_cpp, dest_j_lang_cpp) + + # Workloads can take really long to generate. SO let's create a progress bar. + + # Create all permutations of persistence ops of given sequence length. This will be merged to the phase-2 workload. + for i in itertools.product(SyncSet, repeat=int(num_ops)): + syncPermutations.append(i) + + + # This is the number of input operations + log = 'Total file-system operations tested = ' + `len(OperationSet)` + '\n' + print log + log_file_handle.write(log) + + + + # Time workload generation + start_time = time.time() + + # **PHASE 1** : Create all permutations of file-system operations of given sequence lengt. ops can repeat. + # To create only permutations of ops with no repeptions allowed, use this + #for i in itertools.permutations(OperationSet, int(num_ops)): + totalOpCombinations = len(OperationSet) ** int(num_ops) + #bar = FillingCirclesBar('Generating workloads.. ', max=totalOpCombinations, suffix='%(percent).0f%% (Completed %(index)d/%(global_count)d)') + bar = SlowBar('Generating workloads.. ', max=totalOpCombinations) + + # This is the number of input operations + log = 'Total Phase-1 Skeletons = ' + `totalOpCombinations` + '\n' + if not demo: + print log + log_file_handle.write(log) + + bar.start() + for i in itertools.product(OperationSet, repeat=int(num_ops)): + doPermutation(i) + bar.next() + + + + # To parallelize workload generation, we will need to modify how we number the workloads. If we enable this as it is, the threads will overwrite workloads, as they don't see the global_count. + #pool = Pool(processes = 4) + #pool.map(doPermutation, itertools.permutations(OperationSet, int(num_ops))) + #pool.close() + + + # End timer + end_time = time.time() + bar.finish() + + + # This is the total number of workloads generated + log = '\nTotal workloads generated = ' + `global_count` + '\n' + print log + log_file_handle.write(log) + + # Time to create the above workloads + log = 'Time taken to generate workloads = ' + `round(end_time-start_time,2)` + ' seconds\n' + if not demo: + print log + log_file_handle.write(log) + + # Print target directory + log = 'Generated workloads can be found at ../src/tests/' + dest_dir + '\n' + print log + log_file_handle.write(log) + + log_file_handle.close() + + + # Move the resultant high-level lang files to target directory. We could choose to delete them too. But if we wanted to analyze the core-ops in a workload, looking at this file is an easier way of doing it. Also if you modify the adapter, you can simply supply the directory of j-lang files to convert to cpp. No need to go through the entire generation process. + target = 'mv j-lang* ' + target_path + subprocess.call(target, shell = True) + + +if __name__ == '__main__': + main() diff --git a/ace/cmAdapter.py b/ace/cmAdapter.py new file mode 100755 index 0000000..ccb13eb --- /dev/null +++ b/ace/cmAdapter.py @@ -0,0 +1,697 @@ +#!/usr/bin/env python + +#To run : python cmAdapter.py -b src/tests/generic_039/base_test.cpp -t src/tests/generic_039/generic_039 -p src/tests/generic_039 +import os +import re +import sys +import stat +import subprocess +import argparse +import time +import itertools +from shutil import copyfile +from string import maketrans + + +#All functions that has options go here +FallocOptions = ['FALLOC_FL_ZERO_RANGE','FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE','FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE', '0', 'FALLOC_FL_KEEP_SIZE'] + +FsyncOptions = ['fsync','fdatasync'] + +RemoveOptions = ['remove','unlink'] + +LinkOptions = ['link','symlink'] + +WriteOptions = ['WriteData','WriteDataMmap', 'pwrite'] + +redeclare_map = {} + +def build_parser(): + parser = argparse.ArgumentParser(description='Workload Generator for XFSMonkey v1.0') + + # global args + parser.add_argument('--base_file', '-b', default='', help='Base test file to generate workload') + parser.add_argument('--test_file', '-t', default='', help='J lang test skeleton to generate workload') + + # crash monkey args + parser.add_argument('--target_path', '-p', default='../src/tests/', help='Directory to save the generated test files') + + parser.add_argument('--output_name', '-o', default='file', help='Name of the generated file') + return parser + + +def print_setup(parsed_args): + print '\n{: ^50s}'.format('XFSMonkey Workload generatorv0.1\n') + print '='*20, 'Setup' , '='*20, '\n' + print '{0:20} {1}'.format('Base test file', parsed_args.base_file) + print '{0:20} {1}'.format('Test skeleton', parsed_args.test_file) + print '{0:20} {1}'.format('Target directory', parsed_args.target_path) + print '{0:20} {1}'.format('Output file', parsed_args.output_name) + print '\n', '='*48, '\n' + + +def create_dir(dir_path): + try: + os.makedirs(dir_path) + except OSError: + if not os.path.isdir(dir_path): + raise + +def create_dict(): + operation_map = {'fsync': 0, 'fallocate': 0, 'open': 0, 'remove': 0} + return operation_map + + +#These maps keep track of the line number in each method, to add the next function to in the C++ file +def updateSetupMap(index_map, num): + index_map['setup'] += num + index_map['run'] += num + index_map['check'] += num + index_map['define'] += num + +def updateRunMap(index_map, num): + index_map['run'] += num + index_map['check'] += num + index_map['define'] += num + +def updateCheckMap(index_map, num): + index_map['check'] += num + index_map['define'] += num + +def updateDefineMap(index_map, num): + index_map['define'] += num + + + +def insertDeclare(line, file, index_map): + + with open(file, 'r+') as declare: + contents = declare.readlines() + + updateRunMap(index_map, 1) + + to_insert = '\t\t\t\tint ' + line + ' = 0 ;\n' + contents.insert(index_map['run'], to_insert) + + declare.seek(0) + declare.writelines(contents) + declare.close() + + +# Add the 'line' which declares a file/dir used in the workload into the 'file' +# at position specified in the 'index_map' +def insertDefine(line, file, index_map): + with open(file, 'r+') as define: + + contents = define.readlines() + + #Initialize paths in setup phase + updateSetupMap(index_map, 1) + file_str = '' + if len(line.split('/')) != 1 : + for i in xrange(0, len(line.split('/'))): + file_str += line.split('/')[i] + else: + file_str = line.split('/')[-1] + + if file_str == 'test': + to_insert = '\t\t\t\t' + file_str + '_path = mnt_dir_ ;\n' + else: + to_insert = '\t\t\t\t' + file_str + '_path = mnt_dir_' + ' + "/' + line + '";\n' + + contents.insert(index_map['setup'], to_insert) + + #Initialize paths in run phase + updateRunMap(index_map, 1) + file_str = '' + if len(line.split('/')) != 1 : + for i in xrange(0, len(line.split('/'))): + file_str += line.split('/')[i] + else: + file_str = line.split('/')[-1] + + if file_str == 'test': + to_insert = '\t\t\t\t' + file_str + '_path = mnt_dir_ ;\n' + else: + to_insert = '\t\t\t\t' + file_str + '_path = mnt_dir_' + ' + "/' + line + '";\n' + contents.insert(index_map['run'], to_insert) + + #Initialize paths in check phase + updateCheckMap(index_map, 1) + file_str = '' + if len(line.split('/')) != 1 : + for i in xrange(0, len(line.split('/'))): + file_str += line.split('/')[i] + else: + file_str = line.split('/')[-1] + + if file_str == 'test': + to_insert = '\t\t\t\t' + file_str + '_path = mnt_dir_ ;\n' + else: + to_insert = '\t\t\t\t' + file_str + '_path = mnt_dir_' + ' + "/' + line + '";\n' + contents.insert(index_map['check'], to_insert) + + #Update defines portion + #Get only the file name. We don't want the path here + updateDefineMap(index_map, 1) + file_str = '' + if len(line.split('/')) != 1 : + for i in xrange(0, len(line.split('/'))): + file_str += line.split('/')[i] + else: + file_str = line.split('/')[-1] + to_insert = '\t\t\t string ' + file_str + '_path; \n' + + contents.insert(index_map['define'], to_insert) + + define.seek(0) + define.writelines(contents) + define.close() + + +def insertFalloc(contents, line, index_map, method): + + to_insert = '\n\t\t\t\tif ( fallocate( fd_' + line.split(' ')[1] + ' , ' + line.split(' ')[2] + ' , ' + line.split(' ')[3] + ' , ' + line.split(' ')[4] + ') < 0){ \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] +');\n\t\t\t\t\t return errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 5) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 5) + +def insertMkdir(contents, line, index_map, method): + + to_insert = '\n\t\t\t\tif ( mkdir(' + line.split(' ')[1] + '_path.c_str() , ' + line.split(' ')[2] + ') < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + + +def insertOpenFile(contents, line, index_map, method): + + name = 'fd_' + line.split(' ')[1] + decl = ' ' + if name not in redeclare_map: + decl = 'int ' + redeclare_map[name] = 1 + + # TODO: prevent redeclations here + to_insert = '\n\t\t\t\t' + decl + 'fd_' + line.split(' ')[1] + ' = cm_->CmOpen(' + line.split(' ')[1] + '_path.c_str() , ' + line.split(' ')[2] + ' , ' + line.split(' ')[3] + '); \n\t\t\t\tif ( fd_' + line.split(' ')[1] + ' < 0 ) { \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] + '); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 6) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 6) + +def insertMknodFile(contents, line, index_map, method): + + name = 'fd_' + line.split(' ')[1] + decl = ' ' + if name not in redeclare_map: + decl = 'int ' + redeclare_map[name] = 1 + + # TODO: prevent redeclations here + to_insert = '\n\t\t\t\t' + decl + 'fd_' + line.split(' ')[1] + ' = mknod(' + line.split(' ')[1] + '_path.c_str() , ' + line.split(' ')[2] + ' , ' + line.split(' ')[3] + '); \n\t\t\t\tif ( fd_' + line.split(' ')[1] + ' < 0 ) { \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] + '); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 6) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 6) + +def insertOpenDir(contents, line, index_map, method): + + name = 'fd_' + line.split(' ')[1] + decl = ' ' + if name not in redeclare_map: + decl = 'int ' + redeclare_map[name] = 1 + + # TODO: prevent redeclations here + to_insert = '\n\t\t\t\t' + decl + 'fd_' + line.split(' ')[1] + ' = cm_->CmOpen(' + line.split(' ')[1] + '_path.c_str() , O_DIRECTORY , ' + line.split(' ')[2] + '); \n\t\t\t\tif ( fd_' + line.split(' ')[1] + ' < 0 ) { \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] + '); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 6) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 6) + + +def insertRemoveFile(contents,option, line, index_map, method): + + to_insert = '\n\t\t\t\tif ( '+ option +'(' + line.split(' ')[1] + '_path.c_str() ) < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + +def insertTruncateFile(contents, line, index_map, method): + + to_insert = '\n\t\t\t\tif ( truncate (' + line.split(' ')[1] + '_path.c_str(), ' + line.split(' ')[2] + ') < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + +def insertClose(contents, line, index_map, method): + to_insert = '\n\t\t\t\tif ( cm_->CmClose ( fd_' + line.split(' ')[1] + ') < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + +def insertRmdir(contents, line, index_map, method): + to_insert = '\n\t\t\t\tif ( ' + line.split(' ')[0] + '(' + line.split(' ')[1] + '_path.c_str()) < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + +def insertFsync(contents, option, line, index_map, method): + if option == 'fsync': + ins = 'cm_->CmFsync' + elif option == 'fdatasync': + ins = 'cm_->CmFdatasync' + + to_insert = '\n\t\t\t\tif ( ' + ins + '( fd_' + line.split(' ')[1] + ') < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + +def insertSync(contents, line, index_map, method): + to_insert = '\n\t\t\t\tcm_->CmSync(); \n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 2) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 2) + + +def insertLink(contents, option, line, index_map, method): + to_insert = '\n\t\t\t\tif ( ' + option + '(' + line.split(' ')[1] + '_path.c_str() , '+ line.split(' ')[2] + '_path.c_str() '+ ') < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + +#def insertCheckpoint(contents, line, index_map, method): +# +# to_insert = '\n\t\t\t\tif ( Checkpoint() < 0){ \n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\tlocal_checkpoint += 1; \n\t\t\t\tif (local_checkpoint == checkpoint) { \n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\n' +# +# if method == 'setup': +# contents.insert(index_map['setup'], to_insert) +# updateSetupMap(index_map, 8) +# else: +# contents.insert(index_map['run'], to_insert) +# updateRunMap(index_map, 8) + +def insertCheckpoint(contents, line, index_map, method): + + to_insert = '\n\t\t\t\tif ( cm_->CmCheckpoint() < 0){ \n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\tlocal_checkpoint += 1; \n\t\t\t\tif (local_checkpoint == checkpoint) { \n\t\t\t\t\treturn '+ line.split(' ')[1] + ';\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 8) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 8) + + +def insertRename(contents, line, index_map, method): + to_insert = '\n\t\t\t\tif ( cm_->CmRename (' + line.split(' ')[1] + '_path.c_str() , '+ line.split(' ')[2] + '_path.c_str() '+ ') < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + +def insertFsetxattr(contents, line, index_map, method): + to_insert = '\n\t\t\t\tif ( ' + line.split(' ')[0] + '( fd_' + line.split(' ')[1] + ', \"user.xattr1\", \"val1 \", 4, 0 ) < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + +def insertRemovexattr(contents, line, index_map, method): + to_insert = '\n\t\t\t\tif ( ' + line.split(' ')[0] + '(' + line.split(' ')[1] + '_path.c_str() , \"user.xattr1\") < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + +def insertWrite(contents, option, line, index_map, method): + if option == 'mmapwrite': + name = 'filep_' + line.split(' ')[1] + decl = ' ' + data_decl = ' ' + text_decl = ' ' + filep_decl = ' ' + + + if name not in redeclare_map: + decl = 'int ' + filep_decl = 'char *' + data_decl = 'void* mdata_' +line.split(' ')[1] + ';' + text_decl = 'const char *mtext_' + line.split(' ')[1] +' = \"mmmmmmmmmmklmnopqrstuvwxyz123456\";' + redeclare_map[name] = 1 + + + to_insert = '\n\t\t\t\tif ( fallocate( fd_' + line.split(' ')[1] + ' , 0 , ' + line.split(' ')[2] + ' , ' + line.split(' ')[3] + ') < 0){ \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] +');\n\t\t\t\t\t return errno;\n\t\t\t\t}\n\t\t\t\t' + filep_decl + 'filep_' + line.split(' ')[1] + ' = (char *) cm_->CmMmap(NULL, ' + line.split(' ')[3] + ' + ' + line.split(' ')[2] +', PROT_WRITE|PROT_READ, MAP_SHARED, fd_' + line.split(' ')[1] + ', 0);\n\t\t\t\tif (filep_' + line.split(' ')[1] + ' == MAP_FAILED) {\n\t\t\t\t\t return -1;\n\t\t\t\t}\n\n\t\t\t\t' +decl+ 'moffset_'+ line.split(' ')[1] +' = 0;\n\t\t\t\t' + decl +'to_write_'+line.split(' ')[1] +' = ' + line.split(' ')[3] + ' ;\n\t\t\t\t'+ text_decl+ '\n\n\t\t\t\twhile (moffset_'+line.split(' ')[1]+' < '+ line.split(' ')[3] +'){\n\t\t\t\t\tif (to_write_'+ line.split(' ')[1] +' < 32){\n\t\t\t\t\t\tmemcpy(filep_'+ line.split(' ')[1]+ ' + ' + line.split(' ')[2] + ' + moffset_'+ line.split(' ')[1] +', mtext_'+ line.split(' ')[1] +', to_write_' +line.split(' ')[1]+');\n\t\t\t\t\t\tmoffset_'+ line.split(' ')[1]+' += to_write_'+ line.split(' ')[1] +';\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tmemcpy(filep_'+ line.split(' ')[1] + ' + ' + line.split(' ')[2] + ' + moffset_' +line.split(' ')[1] + ',mtext_'+line.split(' ')[1] + ', 32);\n\t\t\t\t\t\tmoffset_'+line.split(' ')[1] +' += 32; \n\t\t\t\t\t} \n\t\t\t\t}\n\n\t\t\t\tif ( cm_->CmMsync ( filep_' + line.split(' ')[1] + ' + ' + line.split(' ')[2] + ', 8192 , MS_SYNC) < 0){\n\t\t\t\t\tcm_->CmMunmap( filep_' + line.split(' ')[1] + ',' + line.split(' ')[2] + ' + ' + line.split(' ')[3] +'); \n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\tcm_->CmMunmap( filep_' + line.split(' ')[1] + ' , ' + line.split(' ')[2] + ' + ' + line.split(' ')[3] +');\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 30) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 30) + + + + elif option == 'write': + to_insert = '\n\t\t\t\tif ( WriteData ( fd_' + line.split(' ')[1] + ', ' + line.split(' ')[2] + ', ' + line.split(' ')[3] + ') < 0){ \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] + '); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 5) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 5) + else: + + name = 'offset_' + line.split(' ')[1] + decl = ' ' + data_decl = ' ' + text_decl = ' ' + + if name not in redeclare_map: + decl = 'int ' + data_decl = 'void* data_' +line.split(' ')[1] + ';' + text_decl = 'const char *text_' + line.split(' ')[1] +' = \"ddddddddddklmnopqrstuvwxyz123456\";' + redeclare_map[name] = 1 + + # TODO: prevent redeclations here + to_insert ='\n\t\t\t\tcm_->CmClose(fd_' + line.split(' ')[1] + '); \n\t\t\t\tfd_' + line.split(' ')[1] + ' = cm_->CmOpen(' + line.split(' ')[1] +'_path.c_str() , O_RDWR|O_DIRECT|O_SYNC , 0777); \n\t\t\t\tif ( fd_' + line.split(' ')[1] +' < 0 ) { \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] +'); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n\t\t\t\t' + data_decl+'\n\t\t\t\tif (posix_memalign(&data_' + line.split(' ')[1] +' , 4096, ' + line.split(' ')[3] +' ) < 0) {\n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n\t\t\t\t \n\t\t\t\t' +decl+ 'offset_'+ line.split(' ')[1] +' = 0;\n\t\t\t\t' + decl +'to_write_'+line.split(' ')[1] +' = ' + line.split(' ')[3] + ' ;\n\t\t\t\t'+ text_decl+ '\n\t\t\t\twhile (offset_'+line.split(' ')[1]+' < '+ line.split(' ')[3] +'){\n\t\t\t\t\tif (to_write_'+ line.split(' ')[1] +' < 32){\n\t\t\t\t\t\tmemcpy((char *)data_'+ line.split(' ')[1]+ '+ offset_'+ line.split(' ')[1] +', text_'+ line.split(' ')[1] +', to_write_' +line.split(' ')[1]+');\n\t\t\t\t\t\toffset_'+ line.split(' ')[1]+' += to_write_'+ line.split(' ')[1] +';\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tmemcpy((char *)data_'+ line.split(' ')[1] +'+ offset_'+line.split(' ')[1] +',text_'+line.split(' ')[1] +', 32);\n\t\t\t\t\t\toffset_'+line.split(' ')[1] +' += 32; \n\t\t\t\t\t} \n\t\t\t\t} \n\n\t\t\t\tif ( pwrite ( fd_' + line.split(' ')[1] + ', data_'+ line.split(' ')[1] + ', ' + line.split(' ')[3] + ', ' + line.split(' ')[2] +') < 0){\n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] + '); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\t\t\t\tcm_->CmClose(fd_' + line.split(' ')[1] + ');\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 32) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 32) + + +# Insert a function in 'line' into 'file' at location specified by 'index_map' in the specified 'method' +# If the workload has functions with various possible paramter options, the 'permutation' defines the set of +# paramters to be set in this file. + +def insertFunctions(line, file, index_map, method): + with open(file, 'r+') as insert: + + contents = insert.readlines() + + + if line.split(' ')[0] == 'falloc': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + + insertFalloc(contents, line, index_map, method) + if line.split(' ')[-2] == 'addToSetup': + line = line.replace(line.split(' ')[1], line.split(' ')[-1], 1) + insertFalloc(contents, line, index_map, 'setup') + + elif line.split(' ')[0] == 'mkdir': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertMkdir(contents, line, index_map, method) + + elif line.split(' ')[0] == 'mknod': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertMknodFile(contents, line, index_map, method) + + + elif line.split(' ')[0] == 'open': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertOpenFile(contents, line, index_map, method) + + elif line.split(' ')[0] == 'opendir': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertOpenDir(contents, line, index_map, method) + + elif line.split(' ')[0] == 'remove' or line.split(' ')[0] == 'unlink': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + option = line.split(' ')[0] + insertRemoveFile(contents, option, line, index_map, method) + + elif line.split(' ')[0] == 'close': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertClose(contents, line, index_map, method) + + elif line.split(' ')[0] == 'rmdir': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertRmdir(contents, line, index_map, method) + + elif line.split(' ')[0] == 'truncate': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertTruncateFile(contents, line, index_map, method) + + elif line.split(' ')[0] == 'fsync' or line.split(' ')[0] == 'fdatasync': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + option = line.split(' ')[0] + insertFsync(contents, option, line, index_map, method) + + elif line.split(' ')[0] == 'sync': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertSync(contents, line, index_map, method) + + elif line.split(' ')[0] == 'checkpoint': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertCheckpoint(contents, line, index_map, method) + + elif line.split(' ')[0] == 'rename': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertRename(contents, line, index_map, method) + + elif line.split(' ')[0] == 'fsetxattr': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertFsetxattr(contents, line, index_map, method) + + elif line.split(' ')[0] == 'removexattr': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertRemovexattr(contents, line, index_map, method) + + elif line.split(' ')[0] == 'link' or line.split(' ')[0] == 'symlink': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + option = line.split(' ')[0] + insertLink(contents, option, line, index_map, method) + + elif line.split(' ')[0] == 'write' or line.split(' ')[0] == 'dwrite' or line.split(' ')[0] == 'mmapwrite': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + option = line.split(' ')[0] + insertWrite(contents, option, line, index_map, method) + + elif line.split(' ')[0] == 'none': + pass + + insert.seek(0) + insert.writelines(contents) + insert.close() + + + + +def main(): + + #open log file + #log_file = time.strftime('%Y%m%d_%H%M%S') + '-workloadGen.log' + #log_file_handle = open(log_file, 'w') + + #Parse input args + parsed_args = build_parser().parse_args() + + #Print the test setup - just for sanity + # base_test = '../src/tests/base_test.cpp' + # print_setup(parsed_args) + + + #check if test file exists + if not os.path.exists(parsed_args.test_file) or not os.path.isfile(parsed_args.test_file): + print parsed_args.test_file + ' : No such test file\n' + exit(1) + + #Create the target directory + create_dir(parsed_args.target_path) + + #Create a pre-populated dictionary of replacable operations + operation_map = create_dict() + + #Copy base file to target path + base_test = parsed_args.base_file + base_file = parsed_args.target_path + "/" + base_test.split('/')[-1] + # copyfile(base_test, base_file) + test_file = parsed_args.test_file + + index_map = {'define' : 0, 'setup' : 0, 'run' : 0, 'check' : 0} + + #iterate through the base file and populate these values + index = 0 + with open(base_file, 'r') as f: + contents = f.readlines() + for index, line in enumerate(contents): + index += 1 + line = line.strip() + if line.find('setup') != -1: + if line.split(' ')[2] == 'setup()': + index_map['setup'] = index + elif line.find('run') != -1: + if line.split(' ')[2] == 'run(': + index_map['run'] = index + elif line.find('check_test') != -1: + if line.split(' ')[2] == 'check_test(': + index_map['check'] = index + elif line.find('private') != -1: + if line.split(' ')[0] == 'private:': + index_map['define'] = index + f.close() + + + + + val = 0 + new_file = test_file + ".cpp" + new_file = parsed_args.target_path + new_file + copyfile(base_file, new_file) + + new_index_map = index_map.copy() +# log = ' ,'.join(permutation); +# log = `val` + ' : ' + log + '\n' +# log_file_handle.write(log) + #Iterate through test file and fill up method by method + with open(test_file, 'r') as f: + iter = 0 + for line in f: + + #ignore newlines + if line.split(' ')[0] == '\n': + continue + + #Remove leading, trailing spaces + line = line.strip() + + #if the line starts with #, it indicates which region of base file to populate and skip this line + if line.split(' ')[0] == '#' : + method = line.strip().split()[-1] + continue + + if method == 'define': + insertDefine(line, new_file, new_index_map) + + elif method == 'declare': + insertDeclare(line, new_file, new_index_map) + + elif (method == 'setup' or method == 'run'): + op_map={} + insertFunctions(line, new_file, new_index_map, method) + + f.close() + val += 1 + + +# log_file_handle.close() + + +if __name__ == '__main__': + main() diff --git a/ace/specific_generator_scripts/seq1generator.py b/ace/specific_generator_scripts/seq1generator.py new file mode 100755 index 0000000..d1de5ee --- /dev/null +++ b/ace/specific_generator_scripts/seq1generator.py @@ -0,0 +1,996 @@ +#!/usr/bin/env python + +#To run : python bugWorkloadGen.py -n 3 +import os +import re +import sys +import stat +import subprocess +import argparse +import time +import itertools +import json +import pprint +import collections +import threading + +from shutil import copyfile +from string import maketrans +from multiprocessing import Pool + + + +#All functions that has options go here +#FallocOptions = ['FALLOC_FL_ZERO_RANGE','FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE','FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE', '0', 'FALLOC_FL_KEEP_SIZE'] + +FallocOptions = ['FALLOC_FL_ZERO_RANGE', 'FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE','FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE','FALLOC_FL_KEEP_SIZE', 0] + +FsyncOptions = ['fsync','fdatasync'] + +#This should take care of file name/ dir name +FileOptions = ['foo', 'A/foo'] + +SecondFileOptions = ['bar', 'A/bar'] + +#A, B are subdir under test +DirOptions = ['A'] +TestDirOptions = ['test'] +SecondDirOptions = ['B'] + +#this will take care of offset + length combo +#Start = 4-16K , append = 16K-20K, overlap = 8000 - 12096, prepend = 0-4K + +#Append should append to file size, and overwrites should be possible +#WriteOptions = ['start', 'append', 'overlap', 'prepend'] +WriteOptions = ['append', 'overlap_aligned', 'overlap_unaligned'] + +# sync_file_range options: the sync range has to be aligned +SyncFileRangeOptions = ['1page', '2page'] + +# truncate options: the new truncated length can either be aligned to 4K or unaligned +TruncateOptions = ['aligned', 'unaligned'] + +#d_overlap = 8K-12K (has to be aligned) +dWriteOptions = ['append', 'overlap'] + +#removed setxattr +OperationSet = ['creat', 'mkdir', 'mknod', 'falloc', 'write', 'dwrite', 'link', 'unlink', 'remove', 'rename', 'symlink', 'removexattr', 'fdatasync', 'fsetxattr'] + +#OperationSet = ['truncate', 'syncrange', 'mmapwrite'] + +#We are skipping 041, 336, 342, 343 +#The sequences we want to reach to +expected_sequence = [] +expected_sync_sequence = [] + + + +def SiblingOf(file): + if file == 'foo': + return 'bar' + elif file == 'bar' : + return 'foo' + elif file == 'A/foo': + return 'A/bar' + elif file == 'A/bar': + return 'A/foo' + elif file == 'A' : + return 'B' + elif file == 'B': + return 'A' + elif file == 'test': + return 'test' + +def Parent(file): + if file == 'foo' or file == 'bar': + return 'test' + if file == 'A/foo' or file == 'A/bar': + return 'A' + if file == 'A' or file == 'B' or file == 'test': + return 'test' + +def file_range(file_list): + file_set = list(file_list) + for i in xrange(0, len(file_list)): + file_set.append(SiblingOf(file_list[i])) + file_set.append(Parent(file_list[i])) + return list(set(file_set)) + + +#----------------------Bug summary-----------------------# + +#Length 1 = 1 +#Length 2 = 7 +#length 3 = 5 + +# Total encoded = 13 + +#--------------------------------------------------------# + + +# 1. btrfs_link_unlink 3 +expected_sequence.append([('link', ('foo', 'bar')), ('unlink', ('bar')), ('creat', ('bar'))]) +expected_sync_sequence.append([('sync'), ('none'), ('fsync', 'bar')]) + +# 2. btrfs_rename_special_file 3 +expected_sequence.append([('mknod', ('foo')), ('rename', ('foo', 'bar')), ('link', ('bar', 'foo'))]) +expected_sync_sequence.append([('fsync', 'bar'), ('none'), ('fsync', 'bar')]) + +# 3. new_bug1_btrfs 2 +expected_sequence.append([('write', ('foo', 'append')), ('falloc', ('foo', 'FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE', 'append'))]) +expected_sync_sequence.append([('fsync', 'foo'), ('fsync', 'foo')]) + +# 4. new_bug2_f2fs 3 +expected_sequence.append([('write', ('foo', 'append')), ('falloc', ('foo', 'FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE', 'append')), ('fdatasync', ('foo'))]) +expected_sync_sequence.append([('sync'), ('none'), ('none')]) + +# 5. generic_034 2 +expected_sequence.append([('creat', ('A/foo')), ('creat', ('A/bar'))]) +expected_sync_sequence.append([('sync'), ('fsync', 'A')]) + +# 6. generic_039 2 +expected_sequence.append([('link', ('foo', 'bar')), ('remove', ('bar'))]) +expected_sync_sequence.append([('sync'), ('fsync', 'foo')]) + +# 7. generic_059 2 +expected_sequence.append([('write', ('foo', 'append')), ('falloc', ('foo', 'FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE', 'overlap_unaligned'))]) +expected_sync_sequence.append([('sync'), ('fsync', 'foo')]) + +# 8. generic_066 2 +expected_sequence.append([('fsetxattr', ('foo')), ('removexattr', ('foo'))]) +expected_sync_sequence.append([('sync'), ('fsync', 'foo')]) + +# 9. generic_341 3 +expected_sequence.append([('creat', ('A/foo')), ('rename', ('A', 'B')), ('mkdir', ('A'))]) +expected_sync_sequence.append([('sync'), ('none'), ('fsync', 'A')]) + +# 10. generic_348 1 +expected_sequence.append([('symlink', ('foo', 'A/bar'))]) +expected_sync_sequence.append([('fsync', 'A')]) + +# 11. generic_376 2 +expected_sequence.append([('rename', ('foo', 'bar')), ('creat', ('foo'))]) +expected_sync_sequence.append([('none'), ('fsync', 'bar')]) + +# 12. generic_468 3 +expected_sequence.append([('write', ('foo', 'append')), ('falloc', ('foo', 'FALLOC_FL_KEEP_SIZE', 'append')), ('fdatasync', ('foo'))]) +expected_sync_sequence.append([('sync'), ('none'), ('none')]) + +# 13. ext4_direct_write 2 +expected_sequence.append([('write', ('foo', 'append')), ('dwrite', ('foo', 'overlap'))]) +expected_sync_sequence.append([('none'), ('none')]) + + +def build_parser(): + parser = argparse.ArgumentParser(description='Bug Workload Generator for XFSMonkey v0.1') + + # global args + parser.add_argument('--sequence_len', '-l', default='3', help='Number of critical ops in the bugy workload') + + return parser + + +def print_setup(parsed_args): + print '\n{: ^50s}'.format('XFSMonkey Bug Workload generatorv0.1\n') + print '='*20, 'Setup' , '='*20, '\n' + print '{0:20} {1}'.format('Sequence length', parsed_args.sequence_len) + print '\n', '='*48, '\n' + +min = 0 + +def buildTuple(command): + if command == 'creat': + d = tuple(FileOptions) + elif command == 'mkdir': + d = tuple(DirOptions) + elif command == 'mknod': + d = tuple(FileOptions) + elif command == 'falloc': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(FallocOptions) + d_tmp.append(WriteOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'write': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(WriteOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'dwrite': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(dWriteOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'link' or command == 'symlink': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(SecondFileOptions) + d = list() + for i in itertools.product(*d_tmp): + if len(set(i)) == 2: + d.append(i) + elif command == 'rename': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(SecondFileOptions) + d = list() + for i in itertools.product(*d_tmp): + if len(set(i)) == 2: + d.append(i) + d_tmp = list() + d_tmp.append(DirOptions) + d_tmp.append(SecondDirOptions) + for i in itertools.product(*d_tmp): + if len(set(i)) == 2: + d.append(i) + elif command == 'remove' or command == 'unlink': + d = tuple(FileOptions +SecondFileOptions) + elif command == 'fdatasync' or command == 'fsetxattr' or command == 'removexattr': + d = tuple(FileOptions) + elif command == 'fsync': + d = tuple(FileOptions + DirOptions + TestDirOptions + SecondFileOptions + SecondDirOptions) + elif command == 'truncate': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(TruncateOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'syncrange': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(SyncFileRangeOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'mmapwrite': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(dWriteOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + else: + d=() + return d + + +def buildCustomTuple(file_list): + global num_ops + + d = list(file_list) + fsync = ('fsync',) + sync = ('sync') +# none = ('none') + SyncSetCustom = list() + for i in xrange(0, len(d)): + tup = list(fsync) + tup.append(d[i]) + SyncSetCustom.append(tuple(tup)) + + SyncSetCustom.append(sync) +# SyncSetCustom.append(none) + SyncSetCustom = tuple(SyncSetCustom) + syncPermutationsCustom = list() + for i in itertools.product(SyncSetCustom, repeat=int(num_ops)): + syncPermutationsCustom.append(i) + + return syncPermutationsCustom + + + +def isBugWorkload(opList, paramList, syncList): + for i in xrange(0,len(expected_sequence)): + if len(opList) != len(expected_sequence[i]): + continue + + flag = 1 + + for j in xrange(0, len(expected_sequence[i])): + if opList[j] == expected_sequence[i][j][0] and paramList[j] == expected_sequence[i][j][1] and tuple(syncList[j]) == tuple(expected_sync_sequence[i][j]): + continue + else: + flag = 0 + break + + if flag == 1: + print 'Found match to Bug # ', i+1, ' : in file # ' , global_count + print 'Length of seq : ', len(expected_sequence[i]) + print 'Expected sequence = ' , expected_sequence[i] + print 'Expected sync sequence = ', expected_sync_sequence[i] + print 'Auto generator found : ' + print opList + print paramList + print syncList + print '\n\n' + return True + + + +def insertUnlink(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + open_file_map.pop(file_name, None) + return ('unlink', file_name) + +def insertRmdir(file_name,open_dir_map, open_file_map, file_length_map, modified_pos): + open_dir_map.pop(file_name, None) + return ('rmdir', file_name) + +def insertXattr(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + return ('fsetxattr', file_name) + +def insertOpen(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + if file_name in FileOptions or file_name in SecondFileOptions: + open_file_map[file_name] = 1 + elif file_name in DirOptions or file_name in SecondDirOptions or file_name in TestDirOptions: + open_dir_map[file_name] = 1 + return ('open', file_name) + +def insertMkdir(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + if file_name in DirOptions or file_name in SecondDirOptions or file_name in TestDirOptions: + open_dir_map[file_name] = 0 + return ('mkdir', file_name) + +def insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + if file_name in FileOptions or file_name in SecondFileOptions: + open_file_map[file_name] = 0 + elif file_name in DirOptions or file_name in SecondDirOptions or file_name in TestDirOptions: + open_dir_map[file_name] = 0 + return ('close', file_name) + +def insertWrite(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + if file_name not in file_length_map: + file_length_map[file_name] = 0 + file_length_map[file_name] += 1 + return ('write', (file_name, 'append')) + +#Creat : file should not exist. If it does, remove it. +def checkCreatDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_name = current_sequence[pos][1] + if file_name not in FileOptions and file_name not in SecondFileOptions: + print file_name + print 'Invalid param list for Creat' + + + #Either open or closed doesn't matter. File should not exist at all + if file_name in open_file_map: + #Insert dependency before the creat command + modified_sequence.insert(modified_pos, insertUnlink(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + return modified_pos + +def checkDirDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_name = current_sequence[pos][1] + if file_name not in DirOptions and file_name not in SecondDirOptions: + print 'Invalid param list for mkdir' + + #Either open or closed doesn't matter. File should not exist at all + if file_name in open_dir_map and file_name != 'test': + #Insert dependency before the creat command + modified_sequence.insert(modified_pos, insertRmdir(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + return modified_pos + + +def checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_names = current_sequence[pos][1] + if isinstance(file_names, basestring): + file_name = file_names + #Parent dir doesn't exist + if Parent(file_name) == 'A' and Parent(file_name) not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir('A', open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + else: + file_name = file_names[0] + file_name2 = file_names[1] + + #Parent dir doesn't exist + if Parent(file_name) == 'A' and Parent(file_name) not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir('A', open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + #Parent dir doesn't exist + if Parent(file_name2) == 'A' and Parent(file_name2) not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir('A', open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + return modified_pos + + +# Check the dependency that file already exists and is open +def checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_names = current_sequence[pos][1] + if isinstance(file_names, basestring): + file_name = file_names + else: + file_name = file_names[0] + + # If we are trying to fsync a dir, ensure it exists + if file_name in DirOptions or file_name in SecondDirOptions or file_name in TestDirOptions: + if file_name not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + + + if file_name not in open_file_map or open_file_map[file_name] == 0: + #Insert dependency - open before the command + modified_sequence.insert(modified_pos, insertOpen(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + return modified_pos + + +def checkClosed(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_name = current_sequence[pos][1] + + if file_name in open_file_map and open_file_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + if file_name in open_dir_map and open_dir_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + return modified_pos + +def checkXattr(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_name = current_sequence[pos][1] + + if open_file_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertXattr(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + return modified_pos + +def checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + + file_names = current_sequence[pos][1] + if isinstance(file_names, basestring): + file_name = file_names + else: + file_name = file_names[0] + + # 0 length file + if file_name not in file_length_map: + modified_sequence.insert(modified_pos, insertWrite(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + return modified_pos + + +def satisfyDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + if isinstance(current_sequence[pos], basestring): + command = current_sequence[pos] + else: + command = current_sequence[pos][0] + + # print 'Command = ', command + + if command == 'creat' or command == 'mknod': + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkCreatDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + file = current_sequence[pos][1] + open_file_map[file] = 1 + + elif command == 'mkdir': + modified_pos = checkDirDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + dir = current_sequence[pos][1] + open_dir_map[dir] = 0 + + elif command == 'falloc': + file = current_sequence[pos][1][0] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #if file doesn't exist, has to be created and opened + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + #Whatever the op is, let's ensure file size is non zero + modified_pos = checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + + elif command == 'write' or command == 'dwrite' or command == 'mmapwrite': + file = current_sequence[pos][1][0] + option = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #if file doesn't exist, has to be created and opened + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #if we chose to do an append, let's not care about the file size + # however if its an overwrite or unaligned write, then ensure file is atleast one page long + if option == 'append': + if file not in file_length_map: + file_length_map[file] = 0 + file_length_map[file] += 1 + elif option == 'overlap' or 'overlap_aligned' or 'overlap_unaligned': + modified_pos = checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + elif command == 'link': + second_file = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + #We have created a new file, but it isn't open yet + open_file_map[second_file] = 0 + + elif command == 'rename': + #If the file was open during rename, does the handle now point to new file? + first_file = current_sequence[pos][1][0] + second_file = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #We have removed the first file, and created a second file + if first_file in FileOptions: + open_file_map.pop(first_file, None) + open_file_map[second_file] = 0 + elif first_file in DirOptions: + open_dir_map.pop(first_file, None) + open_dir_map[second_file] = 0 + + + elif command == 'symlink': + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #No dependency checks + pass + + elif command == 'remove' or command == 'unlink': + #Close any open file handle and then unlink + file = current_sequence[pos][1][0] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos,open_dir_map, open_file_map, file_length_map) + modified_pos = checkClosed(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #Remove file from map + open_file_map.pop(file, None) + + + elif command == 'removexattr': + #Check that file exists + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + #setxattr + modified_pos = checkXattr(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + elif command == 'fsync' or command == 'fdatasync' or command == 'fsetxattr': + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + elif command == 'none' or command == 'sync': + pass + + elif command == 'truncate': + file = current_sequence[pos][1][0] + option = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + # if file doesn't exist, has to be created and opened + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + # Put some data into the file + modified_pos = checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + elif command == 'syncrange': + file = current_sequence[pos][1][0] + option = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + # if file doesn't exist, has to be created and opened + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + # Put some data into the file + modified_pos = checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #Write another page worth conetnt into file + if option == '2page': + modified_sequence.insert(modified_pos, insertWrite(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + + else: + print command + print 'Invalid command' + + return modified_pos + + +def buildJlang(op_list, length_map): + flat_list = list() + if not isinstance(op_list, basestring): + for sublist in op_list: + if not isinstance(sublist, basestring): + for item in sublist: + flat_list.append(item) + else: + flat_list.append(sublist) + else: + flat_list.append(op_list) + + command_str = '' + command = flat_list[0] + if command == 'open': + file = flat_list[1] + if file in DirOptions or file in SecondDirOptions or file in TestDirOptions: + command_str = command_str + 'opendir ' + file.replace('/','') + ' 0777' + else: + command_str = command_str + 'open ' + file.replace('/','') + ' O_RDWR|O_CREAT 0777' + + if command == 'creat': + file = flat_list[1] + command_str = command_str + 'open ' + file.replace('/','') + ' O_RDWR|O_CREAT 0777' + + if command == 'mkdir': + file = flat_list[1] + command_str = command_str + 'mkdir ' + file.replace('/','') + ' 0777' + + if command == 'mknod': + file = flat_list[1] + command_str = command_str + 'mknod ' + file.replace('/','') + ' TEST_FILE_PERMS|S_IFCHR|S_IFBLK' + ' 0' + + if command == 'falloc': + file = flat_list[1] + option = flat_list[2] + write_op = flat_list[3] + command_str = command_str + 'falloc ' + file.replace('/','') + ' ' + str(option) + ' ' + if write_op == 'append': + off = str(length_map[file]) + len = '4096' + length_map[file] += 4096 + elif write_op == 'overlap_aligned': + off = '0' + len = '4096' + else: + off = '1000' + len = '3000' + + command_str = command_str + off + ' ' + len + + if command == 'write': + file = flat_list[1] + write_op = flat_list[2] + command_str = command_str + 'write ' + file.replace('/','') + ' ' + if write_op == 'append': + len = '4096' + if file not in length_map: + length_map[file] = 0 + off = '0' + else: + off = str(length_map[file]) + + length_map[file] += 4096 + + elif write_op == 'overlap_aligned': + off = '0' + len = '4096' + + else: + off = '1000' + len = '3000' + + command_str = command_str + off + ' ' + len + + if command == 'dwrite': + file = flat_list[1] + write_op = flat_list[2] + command_str = command_str + 'dwrite ' + file.replace('/','') + ' ' + + if write_op == 'append': + len = '4096' + if file not in length_map: + length_map[file] = 0 + off = '0' + else: + off = str(length_map[file]) + length_map[file] += 4096 + + elif write_op == 'overlap': + off = '0' + len = '4096' + + command_str = command_str + off + ' ' + len + + if command == 'mmapwrite': + file = flat_list[1] + write_op = flat_list[2] + command_str = command_str + 'mmapwrite ' + file.replace('/','') + ' ' + + if write_op == 'append': + len = '4096' + if file not in length_map: + length_map[file] = 0 + off = '0' + else: + off = str(length_map[file]) + length_map[file] += 4096 + + elif write_op == 'overlap': + off = '0' + len = '4096' + + command_str = command_str + off + ' ' + len + '\ncheckpoint' + + if command == 'link' or command =='rename' or command == 'symlink': + file1 = flat_list[1] + file2 = flat_list[2] + command_str = command_str + command + ' ' + file1.replace('/','') + ' ' + file2.replace('/','') + + if command == 'unlink'or command == 'remove' or command == 'rmdir' or command == 'close' or command == 'fsetxattr' or command == 'removexattr': + file = flat_list[1] + command_str = command_str + command + ' ' + file.replace('/','') + + if command == 'fsync': + file = flat_list[1] + command_str = command_str + command + ' ' + file.replace('/','') + '\ncheckpoint' + + if command =='fdatasync': + file = flat_list[1] + command_str = command_str + command + ' ' + file.replace('/','') + '\ncheckpoint' + + + if command == 'sync': + command_str = command_str + command + '\ncheckpoint' + + if command == 'none': + command_str = command_str + command + + if command == 'truncate': + file = flat_list[1] + trunc_op = flat_list[2] + command_str = command_str + command + ' ' + file.replace('/','') + ' ' + if trunc_op == 'aligned': + len = '0' + length_map[file] = 0 + elif trunc_op == 'unaligned': + len = '2500' + command_str = command_str + len + + if command == 'syncrange': + file = flat_list[1] + sync_op = flat_list[2] + command_str = command_str + command + ' ' + file.replace('/','') + ' ' + if sync_op == '1page': + off = '0' + len = '4096' + elif sync_op == '2page': + off = '0' + len = '8192' + command_str = command_str + off + ' ' + len + '\ncheckpoint' + + return command_str + + + +def doPermutation(perm): + + global global_count + global parameterList + global num_ops + global syncPermutations + global count + global permutations + global SyncSet + global log_file_handle + global count_param + + permutations.append(perm) + log = ', '.join(perm); + log = '\n' + `count` + ' : ' + log + '\n' + count +=1 +# global_count +=1 + log_file_handle.write(log) + + #Now for each of this permutation, find all possible permutation of paramters + combination = list() + for length in xrange(0,len(permutations[count-1])): + combination.append(parameterList[permutations[count-1][length]]) + count_param = 0 + for j in itertools.product(*combination): + log = '{0}'.format(j); + log = '\t' + `count_param` + ' : ' + log + '\n' + count_param += 1 +# global_count +=1 + log_file_handle.write(log) + + #Let's insert fsync combinations here. + count_sync = 0 + if isinstance(j[0], basestring): + orig_file = j[0] + usedFiles = list(set(j) & set(FileOptions + SecondFileOptions + DirOptions + SecondDirOptions + TestDirOptions)) + else: + usedFiles = [filter(lambda x: x in list(FileOptions + SecondFileOptions + DirOptions + SecondDirOptions + TestDirOptions), sublist) for sublist in j] + usedFiles = list(itertools.chain.from_iterable(usedFiles)) + + + syncPermutationsCustom = buildCustomTuple(file_range(usedFiles)) + + if perm[0] == 'fdatasync' or perm[0] == 'mmapwrite' or perm[0] == 'syncrange': + syncPermutationsCustom = [['none' ,]] + + + for insSync in range(0, len(syncPermutationsCustom)): + if int(num_ops) == 1 or int(num_ops) == 2: + log = '{0}'.format(syncPermutationsCustom[insSync]); + log = '\n\t\tFile # ' + `global_count` + ' : ' + `count_sync` + ' : ' + log + '\n' + log_file_handle.write(log) + global_count +=1 + count_sync+=1 + seq = [] + + #merge the lists here . Just check if perm has fdatasync. If so skip adding any sync: + seq.append(perm + j ) + seq.append(syncPermutationsCustom[insSync][0]) + + log = '\t\t\tCurrent Sequence = {0}'.format(seq); + log_file_handle.write(log) + + modified_pos = 0 + modified_sequence = list(seq) + open_file_map = {} + file_length_map = {} + open_dir_map = {} + #test dir exists + open_dir_map['test'] = 0 + + for i in xrange(0, len(seq)): + modified_pos = satisfyDep(seq, i, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + modified_pos += 1 + + #now close all open files + for file_name in open_file_map: + if open_file_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + for file_name in open_dir_map: + if open_dir_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + + + #Now build the j-lang file------------------------------------ + j_lang_file = 'j-lang' + str(global_count) + copyfile('code/tests/seq1/base-j-lang', j_lang_file) + length_map = {} + + with open(j_lang_file, 'a') as f: + run_line = '\n\n# run\n' + f.write(run_line) + + for insert in xrange(0, len(modified_sequence)): + cur_line = buildJlang(modified_sequence[insert], length_map) + cur_line_log = '{0}'.format(cur_line) + '\n' + f.write(cur_line_log) + + f.close() + + exec_command = 'python workload_seq1.py -b code/tests/seq1/base.cpp -t ' + j_lang_file + ' -p code/tests/seq1/ -o ' + str(global_count) + subprocess.call(exec_command, shell=True) + #Now build the j-lang file------------------------------------ + + + log = '\t\t\tModified sequence = {0}\n'.format(modified_sequence); + log_file_handle.write(log) + + isBugWorkload(permutations[count-1], j, syncPermutationsCustom[insSync]) + +global_count = 0 +parameterList = {} +SyncSet = list() +num_ops = 0 +syncPermutations = [] +count = 0 +permutations = [] +log_file_handle = 0 +count_param = 0 + +def main(): + + global global_count + global parameterList + global num_ops + global syncPermutations + global count + global permutations + global SyncSet + global log_file_handle + global count_param + + #open log file + log_file = time.strftime('%Y%m%d_%H%M%S') + '-bugWorkloadGen.log' + log_file_handle = open(log_file, 'w') + + #Parse input args + parsed_args = build_parser().parse_args() + + #Print the test setup - just for sanity + print_setup(parsed_args) + + num_ops = parsed_args.sequence_len + + for i in xrange(0,len(expected_sequence)): + print 'Bug #', i+1 + print expected_sequence[i] + print expected_sync_sequence[i] + print '\n' + + + for i in OperationSet: + parameterList[i] = buildTuple(i) + log = '{0}'.format(parameterList[i]); + log = `i` + ' : Options = ' + `len(parameterList[i])` + '\n' + log + '\n\n' + log_file_handle.write(log) + + d = buildTuple('fsync') + fsync = ('fsync',) + sync = ('sync') + none = ('none') + + for i in xrange(0, len(d)): + tup = list(fsync) + tup.append(d[i]) + SyncSet.append(tup) + + SyncSet.append(sync) + SyncSet.append(none) + SyncSet = tuple(SyncSet) +# print SyncSet + + + for i in itertools.product(SyncSet, repeat=int(num_ops)): + syncPermutations.append(i) +# print i + + + start_time = time.time() + + for i in itertools.product(OperationSet, repeat=int(num_ops)): + doPermutation(i) + +# pool = Pool(processes = 16) +# pool.map(doPermutation, itertools.product(OperationSet, repeat=int(num_ops))) +# pool.close() + + + + end_time = time.time() + + log = 'Total permutations of input op set = ' + `count` + '\n' + print log + log_file_handle.write(log) + + log = 'Total workloads inspected = ' + `global_count` + '\n' + print log + log_file_handle.write(log) + + log = 'Time taken to match workloads = ' + `end_time-start_time` + 'seconds\n\n' + print log + log_file_handle.write(log) + + log_file_handle.close() + + subprocess.call('mv j-lang* code/tests/seq1/j-lang-files/', shell = True) + + +if __name__ == '__main__': + main() diff --git a/ace/specific_generator_scripts/seq2generator.py b/ace/specific_generator_scripts/seq2generator.py new file mode 100755 index 0000000..abec13b --- /dev/null +++ b/ace/specific_generator_scripts/seq2generator.py @@ -0,0 +1,1152 @@ +#!/usr/bin/env python + +#To run : python bugWorkloadGen.py -n 3 +import os +import re +import sys +import stat +import subprocess +import argparse +import time +import itertools +import json +import pprint +import collections +import threading + +from shutil import copyfile +from string import maketrans +from multiprocessing import Pool + + + +#All functions that has options go here +#FallocOptions = ['FALLOC_FL_ZERO_RANGE','FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE','FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE', '0', 'FALLOC_FL_KEEP_SIZE'] + +FallocOptions = ['FALLOC_FL_ZERO_RANGE', 'FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE','FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE','FALLOC_FL_KEEP_SIZE', 0] + +FsyncOptions = ['fsync','fdatasync'] + +#This should take care of file name/ dir name +FileOptions = ['foo', 'A/foo'] + +SecondFileOptions = ['bar', 'A/bar'] + +#A, B are subdir under test +DirOptions = ['A'] +TestDirOptions = ['test'] +SecondDirOptions = ['B'] + +#this will take care of offset + length combo +#Start = 4-16K , append = 16K-20K, overlap = 8000 - 12096, prepend = 0-4K + +#Append should append to file size, and overwrites should be possible +#WriteOptions = ['start', 'append', 'overlap', 'prepend'] +WriteOptions = ['append', 'overlap_aligned', 'overlap_unaligned'] + + +#d_overlap = 8K-12K (has to be aligned) +dWriteOptions = ['append', 'overlap'] + +#Truncate file options +TruncateOptions = ['aligned', 'unaligned'] + +#removed symlink, mknod +OperationSet = ['creat', 'mkdir', 'falloc', 'write', 'dwrite', 'link', 'unlink', 'remove', 'rename', 'removexattr', 'fdatasync', 'fsetxattr', 'truncate', 'mmapwrite'] + +#We are skipping 041, 336, 342, 343 +#The sequences we want to reach to +expected_sequence = [] +expected_sync_sequence = [] + + + +def SiblingOf(file): + if file == 'foo': + return 'bar' + elif file == 'bar' : + return 'foo' + elif file == 'A/foo': + return 'A/bar' + elif file == 'A/bar': + return 'A/foo' + elif file == 'A' : + return 'B' + elif file == 'B': + return 'A' + elif file == 'test': + return 'test' + +def Parent(file): + if file == 'foo' or file == 'bar': + return 'test' + if file == 'A/foo' or file == 'A/bar': + return 'A' + if file == 'A' or file == 'B' or file == 'test': + return 'test' + +def file_range(file_list): + file_set = list(file_list) + for i in xrange(0, len(file_list)): + file_set.append(SiblingOf(file_list[i])) + file_set.append(Parent(file_list[i])) + return list(set(file_set)) + + +#----------------------Bug summary-----------------------# + +#Length 1 = 1 +#Length 2 = 7 +#length 3 = 5 + +# Total encoded = 13 + +#--------------------------------------------------------# + +#If we don't allow dependency ops on same file, we'll miss this in seq2 +#This is actually seq 2 = [link foo-bar, 'sync', unlink bar, 'fsync-bar'] +# 1. btrfs_link_unlink 3 (yes finds in 2) +expected_sequence.append([('link', ('foo', 'bar')), ('unlink', ('bar')), ('creat', ('bar'))]) +expected_sync_sequence.append([('sync'), ('none'), ('fsync', 'bar')]) + + +# 2. btrfs_rename_special_file 3 (yes in 3) +expected_sequence.append([('mknod', ('foo')), ('rename', ('foo', 'bar')), ('link', ('bar', 'foo'))]) +expected_sync_sequence.append([('fsync', 'bar'), ('none'), ('fsync', 'bar')]) + +# 3. new_bug1_btrfs 2 (Yes finds in 2) +expected_sequence.append([('write', ('foo', 'append')), ('falloc', ('foo', 'FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE', 'append'))]) +expected_sync_sequence.append([('fsync', 'foo'), ('fsync', 'foo')]) + +# 4. new_bug2_f2fs 3 (Yes finds in 2) +expected_sequence.append([('write', ('foo', 'append')), ('falloc', ('foo', 'FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE', 'append')), ('fdatasync', ('foo'))]) +expected_sync_sequence.append([('sync'), ('none'), ('none')]) + +#We miss this in seq-2, because we disallow workloads of sort creat, creat +# 5. generic_034 2 +expected_sequence.append([('creat', ('A/foo')), ('creat', ('A/bar'))]) +expected_sync_sequence.append([('sync'), ('fsync', 'A')]) + +# 6. generic_039 2 (Yes finds in 2) +expected_sequence.append([('link', ('foo', 'bar')), ('remove', ('bar'))]) +expected_sync_sequence.append([('sync'), ('fsync', 'foo')]) + +# 7. generic_059 2 (yes finds in 2) +expected_sequence.append([('write', ('foo', 'append')), ('falloc', ('foo', 'FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE', 'overlap_unaligned'))]) +expected_sync_sequence.append([('sync'), ('fsync', 'foo')]) + +# 8. generic_066 2 (Yes finds in 2) +expected_sequence.append([('fsetxattr', ('foo')), ('removexattr', ('foo'))]) +expected_sync_sequence.append([('sync'), ('fsync', 'foo')]) + +#Reachable from current seq 2 generator (#1360 : creat A/foo, rename A,B) (sync, fsync A) +#We will miss this, if we restrict that op2 reuses files from op1 +# 9. generic_341 3 (Yes finds in 2) +expected_sequence.append([('creat', ('A/foo')), ('rename', ('A', 'B')), ('mkdir', ('A'))]) +expected_sync_sequence.append([('sync'), ('none'), ('fsync', 'A')]) + +# 10. generic_348 1 (yes finds in 1) +expected_sequence.append([('symlink', ('foo', 'A/bar'))]) +expected_sync_sequence.append([('fsync', 'A')]) + +# 11. generic_376 2 (yes finds in 2) +expected_sequence.append([('rename', ('foo', 'bar')), ('creat', ('foo'))]) +expected_sync_sequence.append([('none'), ('fsync', 'bar')]) + +#Yes reachable from sseeq2 - (falloc (foo, append), fdatasync foo) +# 12. generic_468 3 (yes, finds in 2) +expected_sequence.append([('write', ('foo', 'append')), ('falloc', ('foo', 'FALLOC_FL_KEEP_SIZE', 'append')), ('fdatasync', ('foo'))]) +expected_sync_sequence.append([('sync'), ('none'), ('none')]) + +#We miss this if we sync only used file set - or we need an option 'none' to end the file with +# 13. ext4_direct_write 2 +expected_sequence.append([('write', ('foo', 'append')), ('dwrite', ('foo', 'overlap'))]) +expected_sync_sequence.append([('none'), ('fsync', 'bar')]) + +#14 btrfs_EEXIST (Seq 1) +#creat foo, fsync foo +#write foo 0-4K, fsync foo + +#btrfs use -O extref during mkfs +#15. generic 041 (If we consider the 3000 as setup, then seq length 3) +#create 3000 link(foo, foo_i), sync, unlink(foo_0), link(foo, foo_3001), link(foo, foo_0), fsync foo + +#16. generic 056 (seq2) +#write(foo, 0-4K), fsync foo, link(foo, bar), fsync some random file/dir + +#requires that we allow repeated operations (check if mmap write works here) +#17 generic 090 (seq3) +#write(foo 0-4K), sync, link(foo, bar), sync, append(foo, 4K-8K), fsync foo + +#18 generic_104 (seq2) larger file set +#link(foo, foo1), link(bar, bar1), fsync(bar) + +#19 generic 106 (seq 2) +#link(foo, bar), sync, unlink(bar) *drop cache* fsync foo + +#20 generic 107 (seq 3) +#link(foo, A/foo), link(foo, A/bar), sync, unlink(A/bar), fsync(foo) + +#21 generic 177 +#write(foo, 0-32K), sync, punch_hole(foo, 24K-32K), punch_hole(foo, 4K-64K) fsync foo + +#22 generic 321 2 fsyncs? +#rename(foo, A/foo), fsync A, fsync A/foo + +#23 generic 322 (yes, seq1) +#rename(A/foo, A/bar), fsync(A/bar) + +#24 generic 335 (seq 2) but larger file set +#rename(A/foo, foo), creat bar, fsync(test) + +#25 generic 336 (seq 4) +#link(A/foo, B/foo), creat B/bar, sync, unlink(B/foo), mv(B/bar, C/bar), fsync A/foo + + +#26 generic 342 (seq 3) +# write foo 0-4K, sync, rename(foo,bar), write(foo) fsync(foo) + +#27 generic 343 (seq 2) +#link(A/foo, A/bar) , rename(B/foo_new, A/foo_new), fsync(A/foo) + +#28 generic 325 (seq3) +#write,(foo, 0-256K), mmapwrite(0-4K), mmapwrite(252-256K), msync(0-64K), msync(192-256K) + +#29 new btrfs link (seq1) +#link(foo, bar), fsync(foo) + +def build_parser(): + parser = argparse.ArgumentParser(description='Bug Workload Generator for XFSMonkey v0.1') + + # global args + parser.add_argument('--sequence_len', '-l', default='3', help='Number of critical ops in the bugy workload') + + return parser + + +def print_setup(parsed_args): + print '\n{: ^50s}'.format('XFSMonkey Bug Workload generatorv0.1\n') + print '='*20, 'Setup' , '='*20, '\n' + print '{0:20} {1}'.format('Sequence length', parsed_args.sequence_len) + print '\n', '='*48, '\n' + +min = 0 + +def buildTuple(command): + if command == 'creat': + d = tuple(FileOptions) + elif command == 'mkdir': + d = tuple(DirOptions) + elif command == 'mknod': + d = tuple(FileOptions) + elif command == 'falloc': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(FallocOptions) + d_tmp.append(WriteOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'write': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(WriteOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'dwrite': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(dWriteOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'link' or command == 'symlink': + d_tmp = list() + d_tmp.append(FileOptions + SecondFileOptions) + d_tmp.append(SecondFileOptions) + d = list() + for i in itertools.product(*d_tmp): + if len(set(i)) == 2: + d.append(i) + elif command == 'rename': + d_tmp = list() + d_tmp.append(FileOptions + SecondFileOptions) + d_tmp.append(SecondFileOptions) + d = list() + for i in itertools.product(*d_tmp): + if len(set(i)) == 2: + d.append(i) + d_tmp = list() + d_tmp.append(DirOptions + SecondDirOptions) + d_tmp.append(SecondDirOptions) + for i in itertools.product(*d_tmp): + if len(set(i)) == 2: + d.append(i) + elif command == 'remove' or command == 'unlink': + d = tuple(FileOptions +SecondFileOptions) + elif command == 'fdatasync' or command == 'fsetxattr' or command == 'removexattr': + d = tuple(FileOptions) + elif command == 'fsync': + d = tuple(FileOptions + DirOptions + TestDirOptions + SecondFileOptions + SecondDirOptions) + elif command == 'truncate': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(TruncateOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'mmapwrite': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(dWriteOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + else: + d=() + return d + + +def buildCustomTuple(file_list): + global num_ops + + d = list(file_list) + fsync = ('fsync',) + sync = ('sync') + none = ('none') + SyncSetCustom = list() + SyncSetNoneCustom = list() + for i in xrange(0, len(d)): + tup = list(fsync) + tup.append(d[i]) + SyncSetCustom.append(tuple(tup)) + SyncSetNoneCustom.append(tuple(tup)) + + SyncSetCustom.append(sync) + SyncSetNoneCustom.append(sync) + SyncSetCustom.append(none) + SyncSetCustom = tuple(SyncSetCustom) + SyncSetNoneCustom = tuple(SyncSetNoneCustom) + syncPermutationsCustom = list() + + if int(num_ops) == 1: + for i in itertools.product(SyncSetNoneCustom): + syncPermutationsCustom.append(i) + + elif int(num_ops) == 2: + for i in itertools.product(SyncSetCustom, SyncSetNoneCustom): + syncPermutationsCustom.append(i) + + elif int(num_ops) == 3: + for i in itertools.product(SyncSetCustom, SyncSetCustom, SyncSetNoneCustom): + syncPermutationsCustom.append(i) + + return syncPermutationsCustom + + + +def isBugWorkload(opList, paramList, syncList): + for i in xrange(0,len(expected_sequence)): + if len(opList) != len(expected_sequence[i]): + continue + + flag = 1 + + for j in xrange(0, len(expected_sequence[i])): + if opList[j] == expected_sequence[i][j][0] and paramList[j] == expected_sequence[i][j][1] and tuple(syncList[j]) == tuple(expected_sync_sequence[i][j]): + continue + else: + flag = 0 + break + + if flag == 1: + print 'Found match to Bug # ', i+1, ' : in file # ' , global_count + print 'Length of seq : ', len(expected_sequence[i]) + print 'Expected sequence = ' , expected_sequence[i] + print 'Expected sync sequence = ', expected_sync_sequence[i] + print 'Auto generator found : ' + print opList + print paramList + print syncList + print '\n\n' + return True + + + +def insertUnlink(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + open_file_map.pop(file_name, None) + return ('unlink', file_name) + +def insertRmdir(file_name,open_dir_map, open_file_map, file_length_map, modified_pos): + open_dir_map.pop(file_name, None) + return ('rmdir', file_name) + +def insertXattr(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + return ('fsetxattr', file_name) + +def insertOpen(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + if file_name in FileOptions or file_name in SecondFileOptions: + open_file_map[file_name] = 1 + elif file_name in DirOptions or file_name in SecondDirOptions or file_name in TestDirOptions: + open_dir_map[file_name] = 1 + return ('open', file_name) + +def insertMkdir(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + if file_name in DirOptions or file_name in SecondDirOptions or file_name in TestDirOptions: + open_dir_map[file_name] = 0 + return ('mkdir', file_name) + +def insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + if file_name in FileOptions or file_name in SecondFileOptions: + open_file_map[file_name] = 0 + elif file_name in DirOptions or file_name in SecondDirOptions or file_name in TestDirOptions: + open_dir_map[file_name] = 0 + return ('close', file_name) + +def insertWrite(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + if file_name not in file_length_map: + file_length_map[file_name] = 0 + file_length_map[file_name] += 1 + return ('write', (file_name, 'append')) + +#Creat : file should not exist. If it does, remove it. +def checkCreatDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_name = current_sequence[pos][1] + + + #Either open or closed doesn't matter. File should not exist at all + if file_name in open_file_map: + #Insert dependency before the creat command + modified_sequence.insert(modified_pos, insertUnlink(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + return modified_pos + +def checkDirDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_name = current_sequence[pos][1] + if file_name not in DirOptions and file_name not in SecondDirOptions: + print 'Invalid param list for mkdir' + + #Either open or closed doesn't matter. File should not exist at all + if file_name in open_dir_map and file_name != 'test': + #if dir is A, remove contents within it too + if file_name == 'A': + if 'A/foo' in open_file_map and open_file_map['A/foo'] == 1: + file = 'A/foo' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'A/foo' in open_file_map and open_file_map['A/foo'] == 0: + file = 'A/foo' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + if 'A/bar' in open_file_map and open_file_map['A/bar'] == 1: + file = 'A/bar' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'A/bar' in open_file_map and open_file_map['A/bar'] == 0: + file = 'A/bar' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + + #Insert dependency before the creat command + modified_sequence.insert(modified_pos, insertRmdir(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + return modified_pos + + +def checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_names = current_sequence[pos][1] + if isinstance(file_names, basestring): + file_name = file_names + #Parent dir doesn't exist + if Parent(file_name) == 'A' and Parent(file_name) not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir('A', open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + else: + file_name = file_names[0] + file_name2 = file_names[1] + + #Parent dir doesn't exist + if Parent(file_name) == 'A' and Parent(file_name) not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir('A', open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + #Parent dir doesn't exist + if Parent(file_name2) == 'A' and Parent(file_name2) not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir('A', open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + return modified_pos + + +# Check the dependency that file already exists and is open +def checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_names = current_sequence[pos][1] + if isinstance(file_names, basestring): + file_name = file_names + else: + file_name = file_names[0] + + # If we are trying to fsync a dir, ensure it exists + if file_name in DirOptions or file_name in SecondDirOptions or file_name in TestDirOptions: + if file_name not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + if file_name in open_dir_map and open_dir_map[file_name] == 0: + modified_sequence.insert(modified_pos, insertOpen(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + + if file_name in FileOptions or file_name in SecondFileOptions: + if file_name not in open_file_map or open_file_map[file_name] == 0: + #Insert dependency - open before the command + modified_sequence.insert(modified_pos, insertOpen(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + return modified_pos + + +def checkClosed(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + + file_names = current_sequence[pos][1] + if isinstance(file_names, basestring): + file_name = file_names + else: + file_name = file_names[0] + + if file_name in open_file_map and open_file_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + if file_name in open_dir_map and open_dir_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + return modified_pos + +def checkXattr(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_name = current_sequence[pos][1] + if open_file_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertXattr(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + return modified_pos + +def checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + + file_names = current_sequence[pos][1] + if isinstance(file_names, basestring): + file_name = file_names + else: + file_name = file_names[0] + + # 0 length file + if file_name not in file_length_map: + modified_sequence.insert(modified_pos, insertWrite(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + return modified_pos + + +def satisfyDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + if isinstance(current_sequence[pos], basestring): + command = current_sequence[pos] + else: + command = current_sequence[pos][0] + + # print 'Command = ', command + + if command == 'creat' or command == 'mknod': + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkCreatDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + file = current_sequence[pos][1] + open_file_map[file] = 1 + + elif command == 'mkdir': + modified_pos = checkDirDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + dir = current_sequence[pos][1] + open_dir_map[dir] = 0 + + elif command == 'falloc': + file = current_sequence[pos][1][0] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #if file doesn't exist, has to be created and opened + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + #Whatever the op is, let's ensure file size is non zero + modified_pos = checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + + elif command == 'write' or command == 'dwrite' or command == 'mmapwrite': + file = current_sequence[pos][1][0] + option = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #if file doesn't exist, has to be created and opened + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + + #if we chose to do an append, let's not care about the file size + # however if its an overwrite or unaligned write, then ensure file is atleast one page long + if option == 'append': + if file not in file_length_map: + file_length_map[file] = 0 + file_length_map[file] += 1 + elif option == 'overlap' or 'overlap_aligned' or 'overlap_unaligned': + modified_pos = checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #If we do a dwrite, let's close the file after that + if command == 'dwrite': + if file in FileOptions or file in SecondFileOptions: + open_file_map[file] = 0 + + + elif command == 'link': + second_file = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + if second_file in open_file_map and open_file_map[second_file] == 1: + #Insert dependency - open before the command + modified_sequence.insert(modified_pos, insertClose(second_file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + #if we have a closed file, remove it + if second_file in open_file_map and open_file_map[second_file] == 0: + #Insert dependency - open before the command + modified_sequence.insert(modified_pos, insertUnlink(second_file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + + #We have created a new file, but it isn't open yet + open_file_map[second_file] = 0 + + elif command == 'rename': + #If the file was open during rename, does the handle now point to new file? + first_file = current_sequence[pos][1][0] + second_file = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #Checks if first file is closed + modified_pos = checkClosed(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + if second_file in open_file_map and open_file_map[second_file] == 1: + #Insert dependency - close the second file + modified_sequence.insert(modified_pos, insertClose(second_file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + #We have removed the first file, and created a second file + if first_file in FileOptions or first_file in SecondFileOptions: + open_file_map.pop(first_file, None) + open_file_map[second_file] = 0 + elif first_file in DirOptions: + open_dir_map.pop(first_file, None) + open_dir_map[second_file] = 0 + + + elif command == 'symlink': + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #No dependency checks + pass + + elif command == 'remove' or command == 'unlink': + #Close any open file handle and then unlink + file = current_sequence[pos][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos,open_dir_map, open_file_map, file_length_map) + modified_pos = checkClosed(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #Remove file from map + open_file_map.pop(file, None) + + + elif command == 'removexattr': + #Check that file exists + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + #setxattr + modified_pos = checkXattr(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + elif command == 'fsync' or command == 'fdatasync' or command == 'fsetxattr': + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + elif command == 'none' or command == 'sync': + pass + + elif command == 'truncate': + file = current_sequence[pos][1][0] + option = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + # if file doesn't exist, has to be created and opened + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + # Put some data into the file + modified_pos = checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + else: + print command + print 'Invalid command' + + return modified_pos + + +def flatList(op_list): + flat_list = list() + if not isinstance(op_list, basestring): + for sublist in op_list: + if not isinstance(sublist, basestring): + for item in sublist: + flat_list.append(item) + else: + flat_list.append(sublist) + else: + flat_list.append(op_list) + + return flat_list + + +def buildJlang(op_list, length_map): + flat_list = list() + if not isinstance(op_list, basestring): + for sublist in op_list: + if not isinstance(sublist, basestring): + for item in sublist: + flat_list.append(item) + else: + flat_list.append(sublist) + else: + flat_list.append(op_list) + + command_str = '' + command = flat_list[0] + if command == 'open': + file = flat_list[1] + if file in DirOptions or file in SecondDirOptions or file in TestDirOptions: + command_str = command_str + 'opendir ' + file.replace('/','') + ' 0777' + else: + command_str = command_str + 'open ' + file.replace('/','') + ' O_RDWR|O_CREAT 0777' + + if command == 'creat': + file = flat_list[1] + command_str = command_str + 'open ' + file.replace('/','') + ' O_RDWR|O_CREAT 0777' + + if command == 'mkdir': + file = flat_list[1] + command_str = command_str + 'mkdir ' + file.replace('/','') + ' 0777' + + if command == 'mknod': + file = flat_list[1] + command_str = command_str + 'mknod ' + file.replace('/','') + ' TEST_FILE_PERMS|S_IFCHR|S_IFBLK' + ' 0' + + if command == 'falloc': + file = flat_list[1] + option = flat_list[2] + write_op = flat_list[3] + command_str = command_str + 'falloc ' + file.replace('/','') + ' ' + str(option) + ' ' + if write_op == 'append': + off = str(length_map[file]) + len = '4096' + length_map[file] += 4096 + elif write_op == 'overlap_aligned': + off = '0' + len = '4096' + else: + off = '1000' + len = '3000' + + command_str = command_str + off + ' ' + len + + if command == 'write': + file = flat_list[1] + write_op = flat_list[2] + command_str = command_str + 'write ' + file.replace('/','') + ' ' + if write_op == 'append': + len = '4096' + if file not in length_map: + length_map[file] = 0 + off = '0' + else: + off = str(length_map[file]) + + length_map[file] += 4096 + + elif write_op == 'overlap_aligned': + off = '0' + len = '4096' + + else: + off = '1000' + len = '3000' + + command_str = command_str + off + ' ' + len + + if command == 'dwrite': + file = flat_list[1] + write_op = flat_list[2] + command_str = command_str + 'dwrite ' + file.replace('/','') + ' ' + + if write_op == 'append': + len = '4096' + if file not in length_map: + length_map[file] = 0 + off = '0' + else: + off = str(length_map[file]) + length_map[file] += 4096 + + elif write_op == 'overlap': + off = '0' + len = '4096' + + command_str = command_str + off + ' ' + len + + if command == 'mmapwrite': + file = flat_list[1] + write_op = flat_list[2] + ret = flat_list[3] + command_str = command_str + 'mmapwrite ' + file.replace('/','') + ' ' + + if write_op == 'append': + len = '4096' + if file not in length_map: + length_map[file] = 0 + off = '0' + else: + off = str(length_map[file]) + length_map[file] += 4096 + + elif write_op == 'overlap': + off = '0' + len = '4096' + + command_str = command_str + off + ' ' + len + '\ncheckpoint ' + ret + + if command == 'link' or command =='rename' or command == 'symlink': + file1 = flat_list[1] + file2 = flat_list[2] + command_str = command_str + command + ' ' + file1.replace('/','') + ' ' + file2.replace('/','') + + if command == 'unlink'or command == 'remove' or command == 'rmdir' or command == 'close' or command == 'fsetxattr' or command == 'removexattr': + file = flat_list[1] + command_str = command_str + command + ' ' + file.replace('/','') + + if command == 'fsync': + file = flat_list[1] + ret = flat_list[2] + command_str = command_str + command + ' ' + file.replace('/','') + '\ncheckpoint ' + ret + + if command =='fdatasync': + file = flat_list[1] + ret = flat_list[2] + command_str = command_str + command + ' ' + file.replace('/','') + '\ncheckpoint ' + ret + + + if command == 'sync': + ret = flat_list[1] + command_str = command_str + command + '\ncheckpoint ' + ret + + if command == 'none': + command_str = command_str + command + + + if command == 'truncate': + file = flat_list[1] + trunc_op = flat_list[2] + command_str = command_str + command + ' ' + file.replace('/','') + ' ' + if trunc_op == 'aligned': + len = '0' + length_map[file] = 0 + elif trunc_op == 'unaligned': + len = '2500' + command_str = command_str + len + + return command_str + + + +def doPermutation(perm): + + global global_count + global parameterList + global num_ops + global syncPermutations + global count + global permutations + global SyncSet + global log_file_handle + global count_param + + permutations.append(perm) + log = ', '.join(perm); + log = '\n' + `count` + ' : ' + log + '\n' + count +=1 +# global_count +=1 + log_file_handle.write(log) + + #Now for each of this permutation, find all possible permutation of paramters + combination = list() + for length in xrange(0,len(permutations[count-1])): + combination.append(parameterList[permutations[count-1][length]]) + count_param = 0 + for j in itertools.product(*combination): + log = '{0}'.format(j) + log = '\t' + `count_param` + ' : ' + log + '\n' + count_param += 1 + log_file_handle.write(log) + + #Let's insert fsync combinations here. + count_sync = 0 + usedFiles = list() + flat_used_list = flatList(j) + for file_len in xrange(0, len(flat_used_list)): + if isinstance(flat_used_list[file_len], basestring): + usedFilesList = list(set(flat_used_list) & set(FileOptions + SecondFileOptions + DirOptions + SecondDirOptions + TestDirOptions)) + usedFiles.append(tuple(usedFilesList)) + else: + usedFilesList = [filter(lambda x: x in list(FileOptions + SecondFileOptions + DirOptions + SecondDirOptions + TestDirOptions), sublist) for sublist in j] + usedFilesList = flatList(usedFilesList) +# usedFiles.append(list(itertools.chain.from_iterable(usedFiles))) + + usedFiles = flatList(set(usedFiles)) + + #TODO: to generate remaining files, use the custom set + syncPermutationsCustom = buildCustomTuple(file_range(usedFiles)) +# syncPermutationsCustom = buildCustomTuple(usedFiles) +# syncPermutationsCustom = [x for x in syncPermutationsCustomAll if x not in syncPermutationsCustomUsed] + + log = '\n\t\tUsed Files = {0}\n'.format(usedFiles) + log = log + '\t\tFile range = {0}\n'.format(file_range(usedFiles)) + log_file_handle.write(log) + +# if perm[0] == 'fdatasync': +# syncPermutationsCustom = [['none' ,]] + + isFadatasync = False + for insSync in range(0, len(syncPermutationsCustom)): + +# if isFadatasync: +# continue + + if int(num_ops) == 1 or int(num_ops) == 2 or int(num_ops) == 3: + log = '{0}'.format(syncPermutationsCustom[insSync]); + log = '\n\t\tFile # ' + `global_count` + ' : ' + `count_sync` + ' : ' + log + '\n' + log_file_handle.write(log) + global_count +=1 + count_sync+=1 + seq = [] + + #merge the lists here . Just check if perm has fdatasync. If so skip adding any sync: + for length in xrange(0, len(perm)): + skip_sync = False + op = list() + if perm[length] == 'fdatasync' or perm[length] == 'mmapwrite': + skip_sync = True + isFadatasync = True + else: + op.append(perm[length]) + + #Now merge parameters + if skip_sync: +# fdatasync_op = list() + op.append(perm[length]) + op.append(j[length]) + if length == len(perm)-1: + op.append('1') + else: + op.append('0') + op = tuple(flatList(op)) + + else: + op.append(j[length]) + + + seq.append(tuple(op)) + + if not skip_sync: + sync_op = list() + sync_op.append(syncPermutationsCustom[insSync][length]) + if length == len(perm)-1: + sync_op.append('1') + else: + sync_op.append('0') + seq.append(tuple(flatList(sync_op))) + +## log = '\t\t\tCurrent Sequence = {0}'.format(seq); +## log_file_handle.write(log) +# + modified_pos = 0 + modified_sequence = list(seq) + open_file_map = {} + file_length_map = {} + open_dir_map = {} + #test dir exists + open_dir_map['test'] = 0 + + for i in xrange(0, len(seq)): + modified_pos = satisfyDep(seq, i, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + modified_pos += 1 + + #now close all open files + for file_name in open_file_map: + if open_file_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + for file_name in open_dir_map: + if open_dir_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + +# +## #Now build the j-lang file------------------------------------ + j_lang_file = 'j-lang' + str(global_count) + copyfile('code/tests/seq2/base-j-lang', j_lang_file) + length_map = {} + + with open(j_lang_file, 'a') as f: + run_line = '\n\n# run\n' + f.write(run_line) + + for insert in xrange(0, len(modified_sequence)): + cur_line = buildJlang(modified_sequence[insert], length_map) + cur_line_log = '{0}'.format(cur_line) + '\n' + f.write(cur_line_log) + + f.close() + + exec_command = 'python workload_seq2.py -b code/tests/seq2/base.cpp -t ' + j_lang_file + ' -p code/tests/seq2/ -o ' + str(global_count) + subprocess.call(exec_command, shell=True) + #Now build the j-lang file------------------------------------ + + +# log = '\n\t\t\tModified sequence = {0}\n'.format(modified_sequence); +# log_file_handle.write(log) + + isBugWorkload(permutations[count-1], j, syncPermutationsCustom[insSync]) + +global_count = 0 +parameterList = {} +SyncSet = list() +num_ops = 0 +syncPermutations = [] +count = 0 +permutations = [] +log_file_handle = 0 +count_param = 0 + +def main(): + + global global_count + global parameterList + global num_ops + global syncPermutations + global count + global permutations + global SyncSet + global log_file_handle + global count_param + + #open log file + log_file = time.strftime('%Y%m%d_%H%M%S') + '-bugWorkloadGen.log' + log_file_handle = open(log_file, 'w') + + #Parse input args + parsed_args = build_parser().parse_args() + + #Print the test setup - just for sanity + print_setup(parsed_args) + + num_ops = parsed_args.sequence_len + + for i in xrange(0,len(expected_sequence)): + print 'Bug #', i+1 + print expected_sequence[i] + print expected_sync_sequence[i] + print '\n' + + + for i in OperationSet: + parameterList[i] = buildTuple(i) + log = '{0}'.format(parameterList[i]); + log = `i` + ' : Options = ' + `len(parameterList[i])` + '\n' + log + '\n\n' + log_file_handle.write(log) + + d = buildTuple('fsync') + fsync = ('fsync',) + sync = ('sync') + none = ('none') + + for i in xrange(0, len(d)): + tup = list(fsync) + tup.append(d[i]) + SyncSet.append(tup) + + SyncSet.append(sync) + SyncSet.append(none) + SyncSet = tuple(SyncSet) +# print SyncSet + + + for i in itertools.product(SyncSet, repeat=int(num_ops)): + syncPermutations.append(i) +# print i + + + start_time = time.time() + + for i in itertools.product(OperationSet, repeat=int(num_ops)): +# for i in itertools.permutations(OperationSet, int(num_ops)): + doPermutation(i) + +# pool = Pool(processes = 4) +# pool.map(doPermutation, itertools.permutations(OperationSet, int(num_ops))) +# pool.close() + + + + end_time = time.time() + + log = 'Total permutations of input op set = ' + `count` + '\n' + print log + log_file_handle.write(log) + + log = 'Total workloads inspected = ' + `global_count` + '\n' + print log + log_file_handle.write(log) + + log = 'Time taken to match workloads = ' + `end_time-start_time` + 'seconds\n\n' + print log + log_file_handle.write(log) + + log_file_handle.close() + + subprocess.call('mv j-lang* code/tests/seq2/j-lang-files/', shell = True) + + +if __name__ == '__main__': + main() diff --git a/ace/specific_generator_scripts/seq3generator.py b/ace/specific_generator_scripts/seq3generator.py new file mode 100755 index 0000000..8825725 --- /dev/null +++ b/ace/specific_generator_scripts/seq3generator.py @@ -0,0 +1,1192 @@ +#!/usr/bin/env python + +#To run : python bugWorkloadGen.py -n 3 +import os +import re +import sys +import stat +import subprocess +import argparse +import time +import itertools +import json +import pprint +import collections +import threading + +from shutil import copyfile +from string import maketrans +from multiprocessing import Pool + + + +#All functions that has options go here +#FallocOptions = ['FALLOC_FL_ZERO_RANGE','FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE','FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE', '0', 'FALLOC_FL_KEEP_SIZE'] + +FallocOptions = ['FALLOC_FL_ZERO_RANGE', 'FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE','FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE','FALLOC_FL_KEEP_SIZE', 0] + +FsyncOptions = ['fsync','fdatasync'] + +#This should take care of file name/ dir name +FileOptions = ['B/foo', 'A/foo'] + +SecondFileOptions = ['B/bar', 'A/bar'] + +#A, B are subdir under test +DirOptions = ['A'] +TestDirOptions = ['test'] +SecondDirOptions = ['B'] + +#this will take care of offset + length combo +#Start = 4-16K , append = 16K-20K, overlap = 8000 - 12096, prepend = 0-4K + +#Append should append to file size, and overwrites should be possible +#WriteOptions = ['start', 'append', 'overlap', 'prepend'] 'overlap_aligned' +WriteOptions = ['append', 'overlap_unaligned'] + + +#d_overlap = 8K-12K (has to be aligned) +dWriteOptions = ['append', 'overlap'] + +#Truncate file options 'aligned' +TruncateOptions = ['unaligned'] + +#removed symlink, mknod +#OperationSet = ['creat', 'mkdir', 'falloc', 'write', 'dwrite', 'link', 'unlink', 'remove', 'rename', 'removexattr', 'fdatasync', 'fsetxattr', 'truncate', 'mmapwrite'] + +OperationSet = ['write', 'link', 'unlink', 'rename', 'truncate'] +#OperationSet = ['link','rename'] + +#We are skipping 041, 336, 342, 343 +#The sequences we want to reach to +expected_sequence = [] +expected_sync_sequence = [] + + + +def SiblingOf(file): + if file == 'foo': + return 'bar' + elif file == 'bar' : + return 'foo' + elif file == 'A/foo': + return 'A/bar' + elif file == 'A/bar': + return 'A/foo' + elif file == 'B/foo': + return 'B/bar' + elif file == 'B/bar' : + return 'B/foo' + elif file == 'A' : + return 'B' + elif file == 'B': + return 'A' + elif file == 'test': + return 'test' + +def Parent(file): + if file == 'foo' or file == 'bar': + return 'test' + if file == 'A/foo' or file == 'A/bar': + return 'A' + if file == 'B/foo' or file == 'B/bar': + return 'B' + if file == 'A' or file == 'B' or file == 'test': + return 'test' + +def file_range(file_list): + file_set = list(file_list) + for i in xrange(0, len(file_list)): + file_set.append(SiblingOf(file_list[i])) + file_set.append(Parent(file_list[i])) + return list(set(file_set)) + + +#----------------------Bug summary-----------------------# + +#Length 1 = 1 +#Length 2 = 7 +#length 3 = 5 + +# Total encoded = 13 + +#--------------------------------------------------------# + +#If we don't allow dependency ops on same file, we'll miss this in seq2 +#This is actually seq 2 = [link foo-bar, 'sync', unlink bar, 'fsync-bar'] +# 1. btrfs_link_unlink 3 (yes finds in 2) +expected_sequence.append([('link', ('foo', 'bar')), ('unlink', ('bar')), ('creat', ('bar'))]) +expected_sync_sequence.append([('sync'), ('none'), ('fsync', 'bar')]) + + +# 2. btrfs_rename_special_file 3 (yes in 3) +expected_sequence.append([('mknod', ('foo')), ('rename', ('foo', 'bar')), ('link', ('bar', 'foo'))]) +expected_sync_sequence.append([('fsync', 'bar'), ('none'), ('fsync', 'bar')]) + +# 3. new_bug1_btrfs 2 (Yes finds in 2) +expected_sequence.append([('write', ('foo', 'append')), ('falloc', ('foo', 'FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE', 'append'))]) +expected_sync_sequence.append([('fsync', 'foo'), ('fsync', 'foo')]) + +# 4. new_bug2_f2fs 3 (Yes finds in 2) +expected_sequence.append([('write', ('foo', 'append')), ('falloc', ('foo', 'FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE', 'append')), ('fdatasync', ('foo'))]) +expected_sync_sequence.append([('sync'), ('none'), ('none')]) + +#We miss this in seq-2, because we disallow workloads of sort creat, creat +# 5. generic_034 2 +expected_sequence.append([('creat', ('A/foo')), ('creat', ('A/bar'))]) +expected_sync_sequence.append([('sync'), ('fsync', 'A')]) + +# 6. generic_039 2 (Yes finds in 2) +expected_sequence.append([('link', ('foo', 'bar')), ('remove', ('bar'))]) +expected_sync_sequence.append([('sync'), ('fsync', 'foo')]) + +# 7. generic_059 2 (yes finds in 2) +expected_sequence.append([('write', ('foo', 'append')), ('falloc', ('foo', 'FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE', 'overlap_unaligned'))]) +expected_sync_sequence.append([('sync'), ('fsync', 'foo')]) + +# 8. generic_066 2 (Yes finds in 2) +expected_sequence.append([('fsetxattr', ('foo')), ('removexattr', ('foo'))]) +expected_sync_sequence.append([('sync'), ('fsync', 'foo')]) + +#Reachable from current seq 2 generator (#1360 : creat A/foo, rename A,B) (sync, fsync A) +#We will miss this, if we restrict that op2 reuses files from op1 +# 9. generic_341 3 (Yes finds in 2) +expected_sequence.append([('creat', ('A/foo')), ('rename', ('A', 'B')), ('mkdir', ('A'))]) +expected_sync_sequence.append([('sync'), ('none'), ('fsync', 'A')]) + +# 10. generic_348 1 (yes finds in 1) +expected_sequence.append([('symlink', ('foo', 'A/bar'))]) +expected_sync_sequence.append([('fsync', 'A')]) + +# 11. generic_376 2 (yes finds in 2) +expected_sequence.append([('rename', ('foo', 'bar')), ('creat', ('foo'))]) +expected_sync_sequence.append([('none'), ('fsync', 'bar')]) + +#Yes reachable from sseeq2 - (falloc (foo, append), fdatasync foo) +# 12. generic_468 3 (yes, finds in 2) +expected_sequence.append([('write', ('foo', 'append')), ('falloc', ('foo', 'FALLOC_FL_KEEP_SIZE', 'append')), ('fdatasync', ('foo'))]) +expected_sync_sequence.append([('sync'), ('none'), ('none')]) + +#We miss this if we sync only used file set - or we need an option 'none' to end the file with +# 13. ext4_direct_write 2 +expected_sequence.append([('write', ('foo', 'append')), ('dwrite', ('foo', 'overlap'))]) +expected_sync_sequence.append([('none'), ('fsync', 'bar')]) + +#14 btrfs_EEXIST (Seq 1) +#creat foo, fsync foo +#write foo 0-4K, fsync foo + +#btrfs use -O extref during mkfs +#15. generic 041 (If we consider the 3000 as setup, then seq length 3) +#create 3000 link(foo, foo_i), sync, unlink(foo_0), link(foo, foo_3001), link(foo, foo_0), fsync foo + +#16. generic 056 (seq2) +#write(foo, 0-4K), fsync foo, link(foo, bar), fsync some random file/dir + +#requires that we allow repeated operations (check if mmap write works here) +#17 generic 090 (seq3) +#write(foo 0-4K), sync, link(foo, bar), sync, append(foo, 4K-8K), fsync foo + +#18 generic_104 (seq2) larger file set +#link(foo, foo1), link(bar, bar1), fsync(bar) + +#19 generic 106 (seq 2) +#link(foo, bar), sync, unlink(bar) *drop cache* fsync foo + +#20 generic 107 (seq 3) +#link(foo, A/foo), link(foo, A/bar), sync, unlink(A/bar), fsync(foo) + +#21 generic 177 +#write(foo, 0-32K), sync, punch_hole(foo, 24K-32K), punch_hole(foo, 4K-64K) fsync foo + +#22 generic 321 2 fsyncs? +#rename(foo, A/foo), fsync A, fsync A/foo + +#23 generic 322 (yes, seq1) +#rename(A/foo, A/bar), fsync(A/bar) + +#24 generic 335 (seq 2) but larger file set +#rename(A/foo, foo), creat bar, fsync(test) + +#25 generic 336 (seq 4) +#link(A/foo, B/foo), creat B/bar, sync, unlink(B/foo), mv(B/bar, C/bar), fsync A/foo + + +#26 generic 342 (seq 3) +# write foo 0-4K, sync, rename(foo,bar), write(foo) fsync(foo) + +#27 generic 343 (seq 2) +#link(A/foo, A/bar) , rename(B/foo_new, A/foo_new), fsync(A/foo) + +#28 generic 325 (seq3) +#write,(foo, 0-256K), mmapwrite(0-4K), mmapwrite(252-256K), msync(0-64K), msync(192-256K) + +#29 new btrfs link (seq1) +#link(foo, bar), fsync(foo) + +def build_parser(): + parser = argparse.ArgumentParser(description='Bug Workload Generator for XFSMonkey v0.1') + + # global args + parser.add_argument('--sequence_len', '-l', default='3', help='Number of critical ops in the bugy workload') + + return parser + + +def print_setup(parsed_args): + print '\n{: ^50s}'.format('XFSMonkey Bug Workload generatorv0.1\n') + print '='*20, 'Setup' , '='*20, '\n' + print '{0:20} {1}'.format('Sequence length', parsed_args.sequence_len) + print '\n', '='*48, '\n' + +min = 0 + +def buildTuple(command): + if command == 'creat': + d = tuple(FileOptions) + elif command == 'mkdir': + d = tuple(DirOptions) + elif command == 'mknod': + d = tuple(FileOptions) + elif command == 'falloc': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(FallocOptions) + d_tmp.append(WriteOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'write': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(WriteOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'dwrite': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(dWriteOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'link' or command == 'symlink': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(SecondFileOptions + FileOptions) + d = list() + for i in itertools.product(*d_tmp): + if len(set(i)) == 2: + d.append(i) + elif command == 'rename': + d_tmp = list() + d_tmp.append(FileOptions + SecondFileOptions) + d_tmp.append(SecondFileOptions) + d = list() + for i in itertools.product(*d_tmp): + if len(set(i)) == 2: + d.append(i) + d_tmp = list() + d_tmp.append(DirOptions + SecondDirOptions) + d_tmp.append(SecondDirOptions) + for i in itertools.product(*d_tmp): + if len(set(i)) == 2: + d.append(i) + elif command == 'remove' or command == 'unlink': + d = tuple(FileOptions +SecondFileOptions) + elif command == 'fdatasync' or command == 'fsetxattr' or command == 'removexattr': + d = tuple(FileOptions) + elif command == 'fsync': + d = tuple(FileOptions + DirOptions + TestDirOptions + SecondFileOptions + SecondDirOptions) + elif command == 'truncate': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(TruncateOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'mmapwrite': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(dWriteOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + else: + d=() + return d + + +def buildCustomTuple(file_list): + global num_ops + + d = list(file_list) + fsync = ('fsync',) + sync = ('sync') + none = ('none') + SyncSetCustom = list() + SyncSetNoneCustom = list() + for i in xrange(0, len(d)): + tup = list(fsync) + tup.append(d[i]) + SyncSetCustom.append(tuple(tup)) + SyncSetNoneCustom.append(tuple(tup)) + + SyncSetCustom.append(sync) + SyncSetNoneCustom.append(sync) + SyncSetCustom.append(none) + SyncSetCustom = tuple(SyncSetCustom) + SyncSetNoneCustom = tuple(SyncSetNoneCustom) + syncPermutationsCustom = list() + + if int(num_ops) == 1: + for i in itertools.product(SyncSetNoneCustom): + syncPermutationsCustom.append(i) + + elif int(num_ops) == 2: + for i in itertools.product(SyncSetCustom, SyncSetNoneCustom): + syncPermutationsCustom.append(i) + + elif int(num_ops) == 3: + for i in itertools.product(SyncSetCustom, SyncSetCustom, SyncSetNoneCustom): + syncPermutationsCustom.append(i) + + elif int(num_ops) == 4: + for i in itertools.product(SyncSetCustom, SyncSetCustom, SyncSetCustom, SyncSetNoneCustom): + syncPermutationsCustom.append(i) + + return syncPermutationsCustom + + + +def isBugWorkload(opList, paramList, syncList): + for i in xrange(0,len(expected_sequence)): + if len(opList) != len(expected_sequence[i]): + continue + + flag = 1 + + for j in xrange(0, len(expected_sequence[i])): + if opList[j] == expected_sequence[i][j][0] and paramList[j] == expected_sequence[i][j][1] and tuple(syncList[j]) == tuple(expected_sync_sequence[i][j]): + continue + else: + flag = 0 + break + + if flag == 1: + print 'Found match to Bug # ', i+1, ' : in file # ' , global_count + print 'Length of seq : ', len(expected_sequence[i]) + print 'Expected sequence = ' , expected_sequence[i] + print 'Expected sync sequence = ', expected_sync_sequence[i] + print 'Auto generator found : ' + print opList + print paramList + print syncList + print '\n\n' + return True + + + +def insertUnlink(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + open_file_map.pop(file_name, None) + return ('unlink', file_name) + +def insertRmdir(file_name,open_dir_map, open_file_map, file_length_map, modified_pos): + open_dir_map.pop(file_name, None) + return ('rmdir', file_name) + +def insertXattr(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + return ('fsetxattr', file_name) + +def insertOpen(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + if file_name in FileOptions or file_name in SecondFileOptions: + open_file_map[file_name] = 1 + elif file_name in DirOptions or file_name in SecondDirOptions or file_name in TestDirOptions: + open_dir_map[file_name] = 1 + return ('open', file_name) + +def insertMkdir(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + if file_name in DirOptions or file_name in SecondDirOptions or file_name in TestDirOptions: + open_dir_map[file_name] = 0 + return ('mkdir', file_name) + +def insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + if file_name in FileOptions or file_name in SecondFileOptions: + open_file_map[file_name] = 0 + elif file_name in DirOptions or file_name in SecondDirOptions or file_name in TestDirOptions: + open_dir_map[file_name] = 0 + return ('close', file_name) + +def insertWrite(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + if file_name not in file_length_map: + file_length_map[file_name] = 0 + file_length_map[file_name] += 1 + return ('write', (file_name, 'append')) + +#Creat : file should not exist. If it does, remove it. +def checkCreatDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_name = current_sequence[pos][1] + + + #Either open or closed doesn't matter. File should not exist at all + if file_name in open_file_map: + #Insert dependency before the creat command + modified_sequence.insert(modified_pos, insertUnlink(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + return modified_pos + +def checkDirDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_name = current_sequence[pos][1] + if file_name not in DirOptions and file_name not in SecondDirOptions: + print 'Invalid param list for mkdir' + + #Either open or closed doesn't matter. File should not exist at all + if file_name in open_dir_map and file_name != 'test': + #if dir is A, remove contents within it too + if file_name == 'A': + if 'A/foo' in open_file_map and open_file_map['A/foo'] == 1: + file = 'A/foo' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'A/foo' in open_file_map and open_file_map['A/foo'] == 0: + file = 'A/foo' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + if 'A/bar' in open_file_map and open_file_map['A/bar'] == 1: + file = 'A/bar' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'A/bar' in open_file_map and open_file_map['A/bar'] == 0: + file = 'A/bar' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + + if file_name == 'B': + if 'B/foo' in open_file_map and open_file_map['B/foo'] == 1: + file = 'B/foo' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'B/foo' in open_file_map and open_file_map['B/foo'] == 0: + file = 'B/foo' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + if 'B/bar' in open_file_map and open_file_map['B/bar'] == 1: + file = 'B/bar' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'B/bar' in open_file_map and open_file_map['B/bar'] == 0: + file = 'B/bar' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + + #Insert dependency before the creat command + modified_sequence.insert(modified_pos, insertRmdir(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + return modified_pos + + +def checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_names = current_sequence[pos][1] + if isinstance(file_names, basestring): + file_name = file_names + #Parent dir doesn't exist + if (Parent(file_name) == 'A' or Parent(file_name) == 'B') and Parent(file_name) not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir(Parent(file_name), open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + else: + file_name = file_names[0] + file_name2 = file_names[1] + + #Parent dir doesn't exist + if (Parent(file_name) == 'A' or Parent(file_name) == 'B') and Parent(file_name) not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir(Parent(file_name), open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + #Parent dir doesn't exist + if (Parent(file_name2) == 'A' or Parent(file_name2) == 'B') and Parent(file_name2) not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir(Parent(file_name2), open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + return modified_pos + + +# Check the dependency that file already exists and is open +def checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_names = current_sequence[pos][1] + if isinstance(file_names, basestring): + file_name = file_names + else: + file_name = file_names[0] + + # If we are trying to fsync a dir, ensure it exists + if file_name in DirOptions or file_name in SecondDirOptions or file_name in TestDirOptions: + if file_name not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + + + if file_name not in open_file_map or open_file_map[file_name] == 0: + #Insert dependency - open before the command + modified_sequence.insert(modified_pos, insertOpen(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + return modified_pos + + +def checkClosed(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + + file_names = current_sequence[pos][1] + if isinstance(file_names, basestring): + file_name = file_names + else: + file_name = file_names[0] + + if file_name in open_file_map and open_file_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + if file_name in open_dir_map and open_dir_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + return modified_pos + +def checkXattr(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_name = current_sequence[pos][1] + if open_file_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertXattr(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + return modified_pos + +def checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + + file_names = current_sequence[pos][1] + if isinstance(file_names, basestring): + file_name = file_names + else: + file_name = file_names[0] + + # 0 length file + if file_name not in file_length_map: + modified_sequence.insert(modified_pos, insertWrite(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + return modified_pos + + +def satisfyDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + if isinstance(current_sequence[pos], basestring): + command = current_sequence[pos] + else: + command = current_sequence[pos][0] + + # print 'Command = ', command + + if command == 'creat' or command == 'mknod': + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkCreatDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + file = current_sequence[pos][1] + open_file_map[file] = 1 + + elif command == 'mkdir': + modified_pos = checkDirDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + dir = current_sequence[pos][1] + open_dir_map[dir] = 0 + + elif command == 'falloc': + file = current_sequence[pos][1][0] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #if file doesn't exist, has to be created and opened + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + #Whatever the op is, let's ensure file size is non zero + modified_pos = checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + + elif command == 'write' or command == 'dwrite' or command == 'mmapwrite': + file = current_sequence[pos][1][0] + option = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #if file doesn't exist, has to be created and opened + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + + #if we chose to do an append, let's not care about the file size + # however if its an overwrite or unaligned write, then ensure file is atleast one page long + if option == 'append': + if file not in file_length_map: + file_length_map[file] = 0 + file_length_map[file] += 1 + elif option == 'overlap' or 'overlap_aligned' or 'overlap_unaligned': + modified_pos = checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #If we do a dwrite, let's close the file after that + if command == 'dwrite': + if file in FileOptions or file in SecondFileOptions: + open_file_map[file] = 0 + + + elif command == 'link': + second_file = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + if second_file in open_file_map and open_file_map[second_file] == 1: + #Insert dependency - open before the command + modified_sequence.insert(modified_pos, insertClose(second_file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + #if we have a closed file, remove it + if second_file in open_file_map and open_file_map[second_file] == 0: + #Insert dependency - open before the command + modified_sequence.insert(modified_pos, insertUnlink(second_file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + + #We have created a new file, but it isn't open yet + open_file_map[second_file] = 0 + + elif command == 'rename': + #If the file was open during rename, does the handle now point to new file? + first_file = current_sequence[pos][1][0] + second_file = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #Checks if first file is closed + modified_pos = checkClosed(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + if second_file in open_file_map and open_file_map[second_file] == 1: + #Insert dependency - close the second file + modified_sequence.insert(modified_pos, insertClose(second_file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + #We have removed the first file, and created a second file + if first_file in FileOptions or first_file in SecondFileOptions: + open_file_map.pop(first_file, None) + open_file_map[second_file] = 0 + elif first_file in DirOptions or first_file in SecondDirOptions: + open_dir_map.pop(first_file, None) + open_dir_map[second_file] = 0 + + + elif command == 'symlink': + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #No dependency checks + pass + + elif command == 'remove' or command == 'unlink': + #Close any open file handle and then unlink + file = current_sequence[pos][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos,open_dir_map, open_file_map, file_length_map) + modified_pos = checkClosed(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #Remove file from map + open_file_map.pop(file, None) + + + elif command == 'removexattr': + #Check that file exists + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + #setxattr + modified_pos = checkXattr(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + elif command == 'fsync' or command == 'fdatasync' or command == 'fsetxattr': + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + elif command == 'none' or command == 'sync': + pass + + elif command == 'truncate': + file = current_sequence[pos][1][0] + option = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + # if file doesn't exist, has to be created and opened + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + # Put some data into the file + modified_pos = checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + else: + print command + print 'Invalid command' + + return modified_pos + + +def flatList(op_list): + flat_list = list() + if not isinstance(op_list, basestring): + for sublist in op_list: + if not isinstance(sublist, basestring): + for item in sublist: + flat_list.append(item) + else: + flat_list.append(sublist) + else: + flat_list.append(op_list) + + return flat_list + + +def buildJlang(op_list, length_map): + flat_list = list() + if not isinstance(op_list, basestring): + for sublist in op_list: + if not isinstance(sublist, basestring): + for item in sublist: + flat_list.append(item) + else: + flat_list.append(sublist) + else: + flat_list.append(op_list) + + command_str = '' + command = flat_list[0] + if command == 'open': + file = flat_list[1] + if file in DirOptions or file in SecondDirOptions or file in TestDirOptions: + command_str = command_str + 'opendir ' + file.replace('/','') + ' 0777' + else: + command_str = command_str + 'open ' + file.replace('/','') + ' O_RDWR|O_CREAT 0777' + + if command == 'creat': + file = flat_list[1] + command_str = command_str + 'open ' + file.replace('/','') + ' O_RDWR|O_CREAT 0777' + + if command == 'mkdir': + file = flat_list[1] + command_str = command_str + 'mkdir ' + file.replace('/','') + ' 0777' + + if command == 'mknod': + file = flat_list[1] + command_str = command_str + 'mknod ' + file.replace('/','') + ' TEST_FILE_PERMS|S_IFCHR|S_IFBLK' + ' 0' + + if command == 'falloc': + file = flat_list[1] + option = flat_list[2] + write_op = flat_list[3] + command_str = command_str + 'falloc ' + file.replace('/','') + ' ' + str(option) + ' ' + if write_op == 'append': + off = str(length_map[file]) + len = '4096' + length_map[file] += 4096 + elif write_op == 'overlap_aligned': + off = '0' + len = '4096' + else: + off = '1000' + len = '3000' + + command_str = command_str + off + ' ' + len + + if command == 'write': + file = flat_list[1] + write_op = flat_list[2] + command_str = command_str + 'write ' + file.replace('/','') + ' ' + if write_op == 'append': + len = '4096' + if file not in length_map: + length_map[file] = 0 + off = '0' + else: + off = str(length_map[file]) + + length_map[file] += 4096 + + elif write_op == 'overlap_aligned': + off = '0' + len = '4096' + + else: + off = '1000' + len = '3000' + + command_str = command_str + off + ' ' + len + + if command == 'dwrite': + file = flat_list[1] + write_op = flat_list[2] + command_str = command_str + 'dwrite ' + file.replace('/','') + ' ' + + if write_op == 'append': + len = '4096' + if file not in length_map: + length_map[file] = 0 + off = '0' + else: + off = str(length_map[file]) + length_map[file] += 4096 + + elif write_op == 'overlap': + off = '0' + len = '4096' + + command_str = command_str + off + ' ' + len + + if command == 'mmapwrite': + file = flat_list[1] + write_op = flat_list[2] + ret = flat_list[3] + command_str = command_str + 'mmapwrite ' + file.replace('/','') + ' ' + + if write_op == 'append': + len = '4096' + if file not in length_map: + length_map[file] = 0 + off = '0' + else: + off = str(length_map[file]) + length_map[file] += 4096 + + elif write_op == 'overlap': + off = '0' + len = '4096' + + command_str = command_str + off + ' ' + len + '\ncheckpoint ' + ret + + if command == 'link' or command =='rename' or command == 'symlink': + file1 = flat_list[1] + file2 = flat_list[2] + command_str = command_str + command + ' ' + file1.replace('/','') + ' ' + file2.replace('/','') + + if command == 'unlink'or command == 'remove' or command == 'rmdir' or command == 'close' or command == 'fsetxattr' or command == 'removexattr': + file = flat_list[1] + command_str = command_str + command + ' ' + file.replace('/','') + + if command == 'fsync': + file = flat_list[1] + ret = flat_list[2] + command_str = command_str + command + ' ' + file.replace('/','') + '\ncheckpoint ' + ret + + if command =='fdatasync': + file = flat_list[1] + ret = flat_list[2] + command_str = command_str + command + ' ' + file.replace('/','') + '\ncheckpoint ' + ret + + + if command == 'sync': + ret = flat_list[1] + command_str = command_str + command + '\ncheckpoint ' + ret + + if command == 'none': + command_str = command_str + command + + + if command == 'truncate': + file = flat_list[1] + trunc_op = flat_list[2] + command_str = command_str + command + ' ' + file.replace('/','') + ' ' + if trunc_op == 'aligned': + len = '0' + length_map[file] = 0 + elif trunc_op == 'unaligned': + len = '2500' + command_str = command_str + len + + return command_str + + + +def doPermutation(perm): + + global global_count + global parameterList + global num_ops + global syncPermutations + global count + global permutations + global SyncSet + global log_file_handle + global count_param + + #if our permutation is of the type (write, write, write - lets skip it.) We'll handle it in write intensive workload set + if len(set(perm)) == 1 and list(set(perm))[0] == 'write': + return + + permutations.append(perm) + log = ', '.join(perm); + log = '\n' + `count` + ' : ' + log + '\n' + count +=1 +# global_count +=1 + log_file_handle.write(log) + + #Now for each of this permutation, find all possible permutation of paramters + combination = list() + for length in xrange(0,len(permutations[count-1])): + combination.append(parameterList[permutations[count-1][length]]) + count_param = 0 + for j in itertools.product(*combination): + log = '{0}'.format(j) + log = '\t' + `count_param` + ' : ' + log + '\n' + count_param += 1 + log_file_handle.write(log) + + #Let's insert fsync combinations here. + count_sync = 0 + usedFiles = list() + flat_used_list = flatList(j) + for file_len in xrange(0, len(flat_used_list)): + if isinstance(flat_used_list[file_len], basestring): + usedFilesList = list(set(flat_used_list) & set(FileOptions + SecondFileOptions + DirOptions + SecondDirOptions + TestDirOptions)) + usedFiles.append(tuple(usedFilesList)) + else: + usedFilesList = [filter(lambda x: x in list(FileOptions + SecondFileOptions + DirOptions + SecondDirOptions + TestDirOptions), sublist) for sublist in j] + usedFilesList = flatList(usedFilesList) +# usedFiles.append(list(itertools.chain.from_iterable(usedFiles))) + + usedFiles = flatList(set(usedFiles)) + + #TODO: to generate remaining files, use the custom set +# syncPermutationsCustom = buildCustomTuple(file_range(usedFiles)) + syncPermutationsCustom = buildCustomTuple(usedFiles) +# syncPermutationsCustom = [x for x in syncPermutationsCustomAll if x not in syncPermutationsCustomUsed] + + log = '\n\t\tUsed Files = {0}\n'.format(usedFiles) + log = log + '\t\tFile range = {0}\n'.format(file_range(usedFiles)) + log_file_handle.write(log) + + + + isFadatasync = False + for insSync in range(0, len(syncPermutationsCustom)): + + + if int(num_ops) == 1 or int(num_ops) == 2 or int(num_ops) == 3 or int(num_ops) == 4: + log = '{0}'.format(syncPermutationsCustom[insSync]); + log = '\n\t\tFile # ' + `global_count` + ' : ' + `count_sync` + ' : ' + log + '\n' + log_file_handle.write(log) + global_count +=1 + count_sync+=1 + seq = [] + + #merge the lists here . Just check if perm has fdatasync. If so skip adding any sync: + for length in xrange(0, len(perm)): + skip_sync = False + op = list() + if perm[length] == 'fdatasync' or perm[length] == 'mmapwrite': + skip_sync = True + isFadatasync = True + else: + op.append(perm[length]) + + #Now merge parameters + if skip_sync: +# fdatasync_op = list() + op.append(perm[length]) + op.append(j[length]) + if length == len(perm)-1: + op.append('1') + else: + op.append('0') + op = tuple(flatList(op)) + + else: + op.append(j[length]) + + + seq.append(tuple(op)) + + if not skip_sync: + sync_op = list() + sync_op.append(syncPermutationsCustom[insSync][length]) + if length == len(perm)-1: + sync_op.append('1') + else: + sync_op.append('0') + seq.append(tuple(flatList(sync_op))) + + log = '\t\t\tCurrent Sequence = {0}'.format(seq); + log_file_handle.write(log) + +# +## #------Satisy dependencies now---------- +# +# modified_pos = 0 +# modified_sequence = list(seq) +# open_file_map = {} +# file_length_map = {} +# open_dir_map = {} +# #test dir exists +# open_dir_map['test'] = 0 +# +# for i in xrange(0, len(seq)): +# modified_pos = satisfyDep(seq, i, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) +# modified_pos += 1 +# +# #now close all open files +# for file_name in open_file_map: +# if open_file_map[file_name] == 1: +# modified_sequence.insert(modified_pos, insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) +# modified_pos += 1 +# +# for file_name in open_dir_map: +# if open_dir_map[file_name] == 1: +# modified_sequence.insert(modified_pos, insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) +# modified_pos += 1 +# +## #------Satisy dependencies now---------- +# +# +# +### #Now build the j-lang file------------------------------------ +# j_lang_file = 'j-lang' + str(global_count) +# copyfile('code/tests/seq3/base-j-lang', j_lang_file) +# length_map = {} +# +# with open(j_lang_file, 'a') as f: +# run_line = '\n\n# run\n' +# f.write(run_line) +# +# for insert in xrange(0, len(modified_sequence)): +# cur_line = buildJlang(modified_sequence[insert], length_map) +# cur_line_log = '{0}'.format(cur_line) + '\n' +# f.write(cur_line_log) +# +# f.close() +# +# exec_command = 'python workload_seq2.py -b code/tests/seq3/base.cpp -t ' + j_lang_file + ' -p code/tests/seq3/ -o ' + str(global_count) +# subprocess.call(exec_command, shell=True) +# #Now build the j-lang file------------------------------------ +# +## +# log = '\n\t\t\tModified sequence = {0}\n'.format(modified_sequence); +# log_file_handle.write(log) +## +## isBugWorkload(permutations[count-1], j, syncPermutationsCustom[insSync]) + + + +global_count = 0 +parameterList = {} +SyncSet = list() +num_ops = 0 +syncPermutations = [] +count = 0 +permutations = [] +log_file_handle = 0 +count_param = 0 + +def main(): + + global global_count + global parameterList + global num_ops + global syncPermutations + global count + global permutations + global SyncSet + global log_file_handle + global count_param + + #open log file + log_file = time.strftime('%Y%m%d_%H%M%S') + '-bugWorkloadGen.log' + log_file_handle = open(log_file, 'w') + + #Parse input args + parsed_args = build_parser().parse_args() + + #Print the test setup - just for sanity + print_setup(parsed_args) + + num_ops = parsed_args.sequence_len + + for i in xrange(0,len(expected_sequence)): + print 'Bug #', i+1 + print expected_sequence[i] + print expected_sync_sequence[i] + print '\n' + + + for i in OperationSet: + parameterList[i] = buildTuple(i) + log = '{0}'.format(parameterList[i]); + log = `i` + ' : Options = ' + `len(parameterList[i])` + '\n' + log + '\n\n' + log_file_handle.write(log) + + d = buildTuple('fsync') + fsync = ('fsync',) + sync = ('sync') + none = ('none') + + for i in xrange(0, len(d)): + tup = list(fsync) + tup.append(d[i]) + SyncSet.append(tup) + + SyncSet.append(sync) + SyncSet.append(none) + SyncSet = tuple(SyncSet) +# print SyncSet + + + for i in itertools.product(SyncSet, repeat=int(num_ops)): + syncPermutations.append(i) +# print i + + + start_time = time.time() + + for i in itertools.product(OperationSet, repeat=int(num_ops)): +# for i in itertools.permutations(OperationSet, int(num_ops)): + doPermutation(i) + +# pool = Pool(processes = 4) +# pool.map(doPermutation, itertools.permutations(OperationSet, int(num_ops))) +# pool.close() + + + + end_time = time.time() + + log = 'Total permutations of input op set = ' + `count` + '\n' + print log + log_file_handle.write(log) + + log = 'Total workloads inspected = ' + `global_count` + '\n' + print log + log_file_handle.write(log) + + log = 'Time taken to match workloads = ' + `end_time-start_time` + 'seconds\n\n' + print log + log_file_handle.write(log) + + log_file_handle.close() + +# subprocess.call('mv j-lang* code/tests/seq2/j-lang-files/', shell = True) + + +if __name__ == '__main__': + main() diff --git a/ace/specific_generator_scripts/seq3nestedgenerator.py b/ace/specific_generator_scripts/seq3nestedgenerator.py new file mode 100755 index 0000000..a3466b4 --- /dev/null +++ b/ace/specific_generator_scripts/seq3nestedgenerator.py @@ -0,0 +1,1304 @@ +#!/usr/bin/env python + +#To run : python bugWorkloadGen.py -n 3 +import os +import re +import sys +import stat +import subprocess +import argparse +import time +import itertools +import json +import pprint +import collections +import threading + +from shutil import copyfile +from string import maketrans +from multiprocessing import Pool + + + +#All functions that has options go here +#FallocOptions = ['FALLOC_FL_ZERO_RANGE','FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE','FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE', '0', 'FALLOC_FL_KEEP_SIZE'] + +FallocOptions = ['FALLOC_FL_ZERO_RANGE', 'FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE','FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE','FALLOC_FL_KEEP_SIZE', 0] + +FsyncOptions = ['fsync','fdatasync'] + +#This should take care of file name/ dir name +FileOptions = ['B/foo', 'A/foo', 'AC/foo'] + +SecondFileOptions = ['B/bar', 'A/bar'] + +#A, B are subdir under test +DirOptions = ['A'] +TestDirOptions = ['test'] +SecondDirOptions = ['B', 'AC'] + +#this will take care of offset + length combo +#Start = 4-16K , append = 16K-20K, overlap = 8000 - 12096, prepend = 0-4K + +#Append should append to file size, and overwrites should be possible +#WriteOptions = ['start', 'append', 'overlap', 'prepend'] 'overlap_aligned' +WriteOptions = ['append', 'overlap_unaligned'] + + +#d_overlap = 8K-12K (has to be aligned) +dWriteOptions = ['append', 'overlap'] + +#Truncate file options 'aligned' +TruncateOptions = ['unaligned'] + +#removed symlink, mknod +#OperationSet = ['creat', 'mkdir', 'falloc', 'write', 'dwrite', 'link', 'unlink', 'remove', 'rename', 'removexattr', 'fdatasync', 'fsetxattr', 'truncate', 'mmapwrite'] + +#OperationSet = ['write', 'link', 'unlink', 'rename', 'truncate'] +OperationSet = ['link','rename'] + +#We are skipping 041, 336, 342, 343 +#The sequences we want to reach to +expected_sequence = [] +expected_sync_sequence = [] + + + +def SiblingOf(file): + if file == 'foo': + return 'bar' + elif file == 'bar' : + return 'foo' + elif file == 'A/foo': + return 'A/bar' + elif file == 'A/bar': + return 'A/foo' + elif file == 'B/foo': + return 'B/bar' + elif file == 'B/bar' : + return 'B/foo' + elif file == 'AC/foo': + return 'AC/bar' + elif file == 'AC/bar' : + return 'AC/foo' + elif file == 'A' : + return 'B' + elif file == 'B': + return 'A' + elif file == 'test': + return 'test' + +def Parent(file): + if file == 'foo' or file == 'bar': + return 'test' + if file == 'A/foo' or file == 'A/bar' or file == 'AC': + return 'A' + if file == 'B/foo' or file == 'B/bar': + return 'B' + if file == 'A' or file == 'B' or file == 'test': + return 'test' + if file == 'AC/foo' or file == 'AC/bar': + return 'AC' + +def file_range(file_list): + file_set = list(file_list) + for i in xrange(0, len(file_list)): + file_set.append(SiblingOf(file_list[i])) + file_set.append(Parent(file_list[i])) + return list(set(file_set)) + + +#----------------------Bug summary-----------------------# + +#Length 1 = 1 +#Length 2 = 7 +#length 3 = 5 + +# Total encoded = 13 + +#--------------------------------------------------------# + +#If we don't allow dependency ops on same file, we'll miss this in seq2 +#This is actually seq 2 = [link foo-bar, 'sync', unlink bar, 'fsync-bar'] +# 1. btrfs_link_unlink 3 (yes finds in 2) +expected_sequence.append([('link', ('foo', 'bar')), ('unlink', ('bar')), ('creat', ('bar'))]) +expected_sync_sequence.append([('sync'), ('none'), ('fsync', 'bar')]) + + +# 2. btrfs_rename_special_file 3 (yes in 3) +expected_sequence.append([('mknod', ('foo')), ('rename', ('foo', 'bar')), ('link', ('bar', 'foo'))]) +expected_sync_sequence.append([('fsync', 'bar'), ('none'), ('fsync', 'bar')]) + +# 3. new_bug1_btrfs 2 (Yes finds in 2) +expected_sequence.append([('write', ('foo', 'append')), ('falloc', ('foo', 'FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE', 'append'))]) +expected_sync_sequence.append([('fsync', 'foo'), ('fsync', 'foo')]) + +# 4. new_bug2_f2fs 3 (Yes finds in 2) +expected_sequence.append([('write', ('foo', 'append')), ('falloc', ('foo', 'FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE', 'append')), ('fdatasync', ('foo'))]) +expected_sync_sequence.append([('sync'), ('none'), ('none')]) + +#We miss this in seq-2, because we disallow workloads of sort creat, creat +# 5. generic_034 2 +expected_sequence.append([('creat', ('A/foo')), ('creat', ('A/bar'))]) +expected_sync_sequence.append([('sync'), ('fsync', 'A')]) + +# 6. generic_039 2 (Yes finds in 2) +expected_sequence.append([('link', ('foo', 'bar')), ('remove', ('bar'))]) +expected_sync_sequence.append([('sync'), ('fsync', 'foo')]) + +# 7. generic_059 2 (yes finds in 2) +expected_sequence.append([('write', ('foo', 'append')), ('falloc', ('foo', 'FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE', 'overlap_unaligned'))]) +expected_sync_sequence.append([('sync'), ('fsync', 'foo')]) + +# 8. generic_066 2 (Yes finds in 2) +expected_sequence.append([('fsetxattr', ('foo')), ('removexattr', ('foo'))]) +expected_sync_sequence.append([('sync'), ('fsync', 'foo')]) + +#Reachable from current seq 2 generator (#1360 : creat A/foo, rename A,B) (sync, fsync A) +#We will miss this, if we restrict that op2 reuses files from op1 +# 9. generic_341 3 (Yes finds in 2) +expected_sequence.append([('creat', ('A/foo')), ('rename', ('A', 'B')), ('mkdir', ('A'))]) +expected_sync_sequence.append([('sync'), ('none'), ('fsync', 'A')]) + +# 10. generic_348 1 (yes finds in 1) +expected_sequence.append([('symlink', ('foo', 'A/bar'))]) +expected_sync_sequence.append([('fsync', 'A')]) + +# 11. generic_376 2 (yes finds in 2) +expected_sequence.append([('rename', ('foo', 'bar')), ('creat', ('foo'))]) +expected_sync_sequence.append([('none'), ('fsync', 'bar')]) + +#Yes reachable from sseeq2 - (falloc (foo, append), fdatasync foo) +# 12. generic_468 3 (yes, finds in 2) +expected_sequence.append([('write', ('foo', 'append')), ('falloc', ('foo', 'FALLOC_FL_KEEP_SIZE', 'append')), ('fdatasync', ('foo'))]) +expected_sync_sequence.append([('sync'), ('none'), ('none')]) + +#We miss this if we sync only used file set - or we need an option 'none' to end the file with +# 13. ext4_direct_write 2 +expected_sequence.append([('write', ('foo', 'append')), ('dwrite', ('foo', 'overlap'))]) +expected_sync_sequence.append([('none'), ('fsync', 'bar')]) + +#14 btrfs_EEXIST (Seq 1) +#creat foo, fsync foo +#write foo 0-4K, fsync foo + +#btrfs use -O extref during mkfs +#15. generic 041 (If we consider the 3000 as setup, then seq length 3) +#create 3000 link(foo, foo_i), sync, unlink(foo_0), link(foo, foo_3001), link(foo, foo_0), fsync foo + +#16. generic 056 (seq2) +#write(foo, 0-4K), fsync foo, link(foo, bar), fsync some random file/dir + +#requires that we allow repeated operations (check if mmap write works here) +#17 generic 090 (seq3) +#write(foo 0-4K), sync, link(foo, bar), sync, append(foo, 4K-8K), fsync foo + +#18 generic_104 (seq2) larger file set +#link(foo, foo1), link(bar, bar1), fsync(bar) + +#19 generic 106 (seq 2) +#link(foo, bar), sync, unlink(bar) *drop cache* fsync foo + +#20 generic 107 (seq 3) +#link(foo, A/foo), link(foo, A/bar), sync, unlink(A/bar), fsync(foo) + +#21 generic 177 +#write(foo, 0-32K), sync, punch_hole(foo, 24K-32K), punch_hole(foo, 4K-64K) fsync foo + +#22 generic 321 2 fsyncs? +#rename(foo, A/foo), fsync A, fsync A/foo + +#23 generic 322 (yes, seq1) +#rename(A/foo, A/bar), fsync(A/bar) + +#24 generic 335 (seq 2) but larger file set +#rename(A/foo, foo), creat bar, fsync(test) + +#25 generic 336 (seq 4) +#link(A/foo, B/foo), creat B/bar, sync, unlink(B/foo), mv(B/bar, C/bar), fsync A/foo + + +#26 generic 342 (seq 3) +# write foo 0-4K, sync, rename(foo,bar), write(foo) fsync(foo) + +#27 generic 343 (seq 2) +#link(A/foo, A/bar) , rename(B/foo_new, A/foo_new), fsync(A/foo) + +#28 generic 325 (seq3) +#write,(foo, 0-256K), mmapwrite(0-4K), mmapwrite(252-256K), msync(0-64K), msync(192-256K) + +#29 new btrfs link (seq1) +#link(foo, bar), fsync(foo) + +def build_parser(): + parser = argparse.ArgumentParser(description='Bug Workload Generator for XFSMonkey v0.1') + + # global args + parser.add_argument('--sequence_len', '-l', default='3', help='Number of critical ops in the bugy workload') + + return parser + + +def print_setup(parsed_args): + print '\n{: ^50s}'.format('XFSMonkey Bug Workload generatorv0.1\n') + print '='*20, 'Setup' , '='*20, '\n' + print '{0:20} {1}'.format('Sequence length', parsed_args.sequence_len) + print '\n', '='*48, '\n' + +min = 0 + +def buildTuple(command): + if command == 'creat': + d = tuple(FileOptions) + elif command == 'mkdir': + d = tuple(DirOptions) + elif command == 'mknod': + d = tuple(FileOptions) + elif command == 'falloc': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(FallocOptions) + d_tmp.append(WriteOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'write': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(WriteOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'dwrite': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(dWriteOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'link' or command == 'symlink': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(SecondFileOptions + FileOptions) + d = list() + for i in itertools.product(*d_tmp): + if len(set(i)) == 2: + d.append(i) + elif command == 'rename': + d_tmp = list() + d_tmp.append(FileOptions + SecondFileOptions) + d_tmp.append(SecondFileOptions) + d = list() + for i in itertools.product(*d_tmp): + if len(set(i)) == 2: + d.append(i) + d_tmp = list() + d_tmp.append(DirOptions + SecondDirOptions) + d_tmp.append(SecondDirOptions) + for i in itertools.product(*d_tmp): + if len(set(i)) == 2: + d.append(i) + elif command == 'remove' or command == 'unlink': + d = tuple(FileOptions +SecondFileOptions) + elif command == 'fdatasync' or command == 'fsetxattr' or command == 'removexattr': + d = tuple(FileOptions) + elif command == 'fsync': + d = tuple(FileOptions + DirOptions + TestDirOptions + SecondFileOptions + SecondDirOptions) + elif command == 'truncate': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(TruncateOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'mmapwrite': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(dWriteOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + else: + d=() + return d + + +def buildCustomTuple(file_list): + global num_ops + + d = list(file_list) + fsync = ('fsync',) + sync = ('sync') + none = ('none') + SyncSetCustom = list() + SyncSetNoneCustom = list() + for i in xrange(0, len(d)): + tup = list(fsync) + tup.append(d[i]) + SyncSetCustom.append(tuple(tup)) + SyncSetNoneCustom.append(tuple(tup)) + + SyncSetCustom.append(sync) + SyncSetNoneCustom.append(sync) + SyncSetCustom.append(none) + SyncSetCustom = tuple(SyncSetCustom) + SyncSetNoneCustom = tuple(SyncSetNoneCustom) + syncPermutationsCustom = list() + +if int(num_ops) == 1: + for i in itertools.product(SyncSetNoneCustom): + syncPermutationsCustom.append(i) + + elif int(num_ops) == 2: + for i in itertools.product(SyncSetCustom, SyncSetNoneCustom): + syncPermutationsCustom.append(i) + +elif int(num_ops) == 3: + for i in itertools.product(SyncSetCustom, SyncSetCustom, SyncSetNoneCustom): + syncPermutationsCustom.append(i) + + elif int(num_ops) == 4: + for i in itertools.product(SyncSetCustom, SyncSetCustom, SyncSetCustom, SyncSetNoneCustom): + syncPermutationsCustom.append(i) + +return syncPermutationsCustom + + + +def isBugWorkload(opList, paramList, syncList): + for i in xrange(0,len(expected_sequence)): + if len(opList) != len(expected_sequence[i]): + continue + + flag = 1 + + for j in xrange(0, len(expected_sequence[i])): + if opList[j] == expected_sequence[i][j][0] and paramList[j] == expected_sequence[i][j][1] and tuple(syncList[j]) == tuple(expected_sync_sequence[i][j]): + continue + else: + flag = 0 + break + + if flag == 1: + print 'Found match to Bug # ', i+1, ' : in file # ' , global_count + print 'Length of seq : ', len(expected_sequence[i]) + print 'Expected sequence = ' , expected_sequence[i] + print 'Expected sync sequence = ', expected_sync_sequence[i] + print 'Auto generator found : ' + print opList + print paramList + print syncList + print '\n\n' + return True + + + +def insertUnlink(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + open_file_map.pop(file_name, None) + return ('unlink', file_name) + +def insertRmdir(file_name,open_dir_map, open_file_map, file_length_map, modified_pos): + open_dir_map.pop(file_name, None) + return ('rmdir', file_name) + +def insertXattr(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + return ('fsetxattr', file_name) + +def insertOpen(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + if file_name in FileOptions or file_name in SecondFileOptions: + open_file_map[file_name] = 1 + elif file_name in DirOptions or file_name in SecondDirOptions or file_name in TestDirOptions: + open_dir_map[file_name] = 1 + return ('open', file_name) + +def insertMkdir(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + if file_name in DirOptions or file_name in SecondDirOptions or file_name in TestDirOptions: + open_dir_map[file_name] = 0 + return ('mkdir', file_name) + +def insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + if file_name in FileOptions or file_name in SecondFileOptions: + open_file_map[file_name] = 0 + elif file_name in DirOptions or file_name in SecondDirOptions or file_name in TestDirOptions: + open_dir_map[file_name] = 0 + return ('close', file_name) + +def insertWrite(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + if file_name not in file_length_map: + file_length_map[file_name] = 0 + file_length_map[file_name] += 1 + return ('write', (file_name, 'append')) + +#Creat : file should not exist. If it does, remove it. +def checkCreatDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_name = current_sequence[pos][1] + + + #Either open or closed doesn't matter. File should not exist at all + if file_name in open_file_map: + #Insert dependency before the creat command + modified_sequence.insert(modified_pos, insertUnlink(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + return modified_pos + +def checkDirDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_name = current_sequence[pos][1] + if file_name not in DirOptions and file_name not in SecondDirOptions: + print 'Invalid param list for mkdir' + + #Either open or closed doesn't matter. File should not exist at all + if file_name in open_dir_map and file_name != 'test': + #if dir is A, remove contents within it too + if file_name == 'A': + if 'A/foo' in open_file_map and open_file_map['A/foo'] == 1: + file = 'A/foo' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'A/foo' in open_file_map and open_file_map['A/foo'] == 0: + file = 'A/foo' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + if 'A/bar' in open_file_map and open_file_map['A/bar'] == 1: + file = 'A/bar' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'A/bar' in open_file_map and open_file_map['A/bar'] == 0: + file = 'A/bar' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + if 'AC' in open_dir_map and open_dir_map['AC'] == 1: + file = 'AC' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + if 'AC' in open_dir_map: + if 'AC/foo' in open_file_map and open_file_map['AC/foo'] == 1: + file = 'AC/foo' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'AC/foo' in open_file_map and open_file_map['AC/foo'] == 0: + file = 'AC/foo' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + if 'AC/bar' in open_file_map and open_file_map['AC/bar'] == 1: + file = 'AC/bar' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'AC/bar' in open_file_map and open_file_map['AC/bar'] == 0: + file = 'AC/bar' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + file = 'AC' + modified_sequence.insert(modified_pos, insertRmdir(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + +if file_name == 'B': + if 'B/foo' in open_file_map and open_file_map['B/foo'] == 1: + file = 'B/foo' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'B/foo' in open_file_map and open_file_map['B/foo'] == 0: + file = 'B/foo' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + if 'B/bar' in open_file_map and open_file_map['B/bar'] == 1: + file = 'B/bar' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'B/bar' in open_file_map and open_file_map['B/bar'] == 0: + file = 'B/bar' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + +if file_name == 'AC': + if 'AC/foo' in open_file_map and open_file_map['AC/foo'] == 1: + file = 'AC/foo' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'AC/foo' in open_file_map and open_file_map['AC/foo'] == 0: + file = 'AC/foo' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + if 'AC/bar' in open_file_map and open_file_map['AC/bar'] == 1: + file = 'AC/bar' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'AC/bar' in open_file_map and open_file_map['AC/bar'] == 0: + file = 'AC/bar' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + +#Insert dependency before the creat command +modified_sequence.insert(modified_pos, insertRmdir(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + return modified_pos + + +def checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_names = current_sequence[pos][1] + if isinstance(file_names, basestring): + file_name = file_names + #Parent dir doesn't exist + if (Parent(file_name) == 'A' or Parent(file_name) == 'B') and Parent(file_name) not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir(Parent(file_name), open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + if Parent(file_name) == 'AC' and Parent(file_name) not in open_dir_map: + if Parent(Parent(file_name)) not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir(Parent(Parent(file_name)), open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + modified_sequence.insert(modified_pos, insertMkdir(Parent(file_name), open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + + +else: + file_name = file_names[0] + file_name2 = file_names[1] + + #Parent dir doesn't exist + if (Parent(file_name) == 'A' or Parent(file_name) == 'B') and Parent(file_name) not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir(Parent(file_name), open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + if Parent(file_name) == 'AC' and Parent(file_name) not in open_dir_map: + if Parent(Parent(file_name)) not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir(Parent(Parent(file_name)), open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + modified_sequence.insert(modified_pos, insertMkdir(Parent(file_name), open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + #Parent dir doesn't exist + if (Parent(file_name2) == 'A' or Parent(file_name2) == 'B') and Parent(file_name2) not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir(Parent(file_name2), open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + if Parent(file_name2) == 'AC' and Parent(file_name2) not in open_dir_map: + if Parent(Parent(file_name2)) not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir(Parent(Parent(file_name2)), open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + modified_sequence.insert(modified_pos, insertMkdir(Parent(file_name2), open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + +return modified_pos + + +# Check the dependency that file already exists and is open +def checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_names = current_sequence[pos][1] + if isinstance(file_names, basestring): + file_name = file_names + else: + file_name = file_names[0] + + # If we are trying to fsync a dir, ensure it exists + if file_name in DirOptions or file_name in SecondDirOptions or file_name in TestDirOptions: + if file_name not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + if file_name in open_dir_map and open_dir_map[file_name] == 0: + modified_sequence.insert(modified_pos, insertOpen(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + +if file_name in FileOptions or file_name in SecondFileOptions: + if file_name not in open_file_map or open_file_map[file_name] == 0: + #Insert dependency - open before the command + modified_sequence.insert(modified_pos, insertOpen(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + return modified_pos + + +def checkClosed(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + + file_names = current_sequence[pos][1] + if isinstance(file_names, basestring): + file_name = file_names + else: + file_name = file_names[0] + + if file_name in open_file_map and open_file_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + if file_name in open_dir_map and open_dir_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + return modified_pos + +def checkXattr(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_name = current_sequence[pos][1] + if open_file_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertXattr(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + return modified_pos + +def checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + + file_names = current_sequence[pos][1] + if isinstance(file_names, basestring): + file_name = file_names + else: + file_name = file_names[0] + + # 0 length file + if file_name not in file_length_map: + modified_sequence.insert(modified_pos, insertWrite(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + return modified_pos + + +def satisfyDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + if isinstance(current_sequence[pos], basestring): + command = current_sequence[pos] + else: + command = current_sequence[pos][0] + + # print 'Command = ', command + + if command == 'creat' or command == 'mknod': + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkCreatDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + file = current_sequence[pos][1] + open_file_map[file] = 1 + + elif command == 'mkdir': + modified_pos = checkDirDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + dir = current_sequence[pos][1] + open_dir_map[dir] = 0 + + elif command == 'falloc': + file = current_sequence[pos][1][0] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #if file doesn't exist, has to be created and opened + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + #Whatever the op is, let's ensure file size is non zero + modified_pos = checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + + elif command == 'write' or command == 'dwrite' or command == 'mmapwrite': + file = current_sequence[pos][1][0] + option = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #if file doesn't exist, has to be created and opened + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + + #if we chose to do an append, let's not care about the file size + # however if its an overwrite or unaligned write, then ensure file is atleast one page long + if option == 'append': + if file not in file_length_map: + file_length_map[file] = 0 + file_length_map[file] += 1 + elif option == 'overlap' or 'overlap_aligned' or 'overlap_unaligned': + modified_pos = checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #If we do a dwrite, let's close the file after that + if command == 'dwrite': + if file in FileOptions or file in SecondFileOptions: + open_file_map[file] = 0 + + +elif command == 'link': + second_file = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + if second_file in open_file_map and open_file_map[second_file] == 1: + #Insert dependency - open before the command + modified_sequence.insert(modified_pos, insertClose(second_file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + #if we have a closed file, remove it + if second_file in open_file_map and open_file_map[second_file] == 0: + #Insert dependency - open before the command + modified_sequence.insert(modified_pos, insertUnlink(second_file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + + #We have created a new file, but it isn't open yet + open_file_map[second_file] = 0 + + elif command == 'rename': + #If the file was open during rename, does the handle now point to new file? + first_file = current_sequence[pos][1][0] + second_file = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #Checks if first file is closed + modified_pos = checkClosed(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + if second_file in open_file_map and open_file_map[second_file] == 1: + #Insert dependency - close the second file + modified_sequence.insert(modified_pos, insertClose(second_file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + #We have removed the first file, and created a second file + if first_file in FileOptions or first_file in SecondFileOptions: + open_file_map.pop(first_file, None) + open_file_map[second_file] = 0 + elif first_file in DirOptions or first_file in SecondDirOptions: + open_dir_map.pop(first_file, None) + open_dir_map[second_file] = 0 + + +elif command == 'symlink': + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #No dependency checks + pass + + elif command == 'remove' or command == 'unlink': + #Close any open file handle and then unlink + file = current_sequence[pos][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos,open_dir_map, open_file_map, file_length_map) + modified_pos = checkClosed(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #Remove file from map + open_file_map.pop(file, None) + + +elif command == 'removexattr': + #Check that file exists + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + #setxattr + modified_pos = checkXattr(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + elif command == 'fsync' or command == 'fdatasync' or command == 'fsetxattr': + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + +elif command == 'none' or command == 'sync': + pass + + elif command == 'truncate': + file = current_sequence[pos][1][0] + option = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + # if file doesn't exist, has to be created and opened + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + # Put some data into the file + modified_pos = checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + +else: + print command + print 'Invalid command' + + return modified_pos + + +def flatList(op_list): + flat_list = list() + if not isinstance(op_list, basestring): + for sublist in op_list: + if not isinstance(sublist, basestring): + for item in sublist: + flat_list.append(item) + else: + flat_list.append(sublist) + else: + flat_list.append(op_list) + + return flat_list + + +def buildJlang(op_list, length_map): + flat_list = list() + if not isinstance(op_list, basestring): + for sublist in op_list: + if not isinstance(sublist, basestring): + for item in sublist: + flat_list.append(item) + else: + flat_list.append(sublist) + else: + flat_list.append(op_list) + + command_str = '' + command = flat_list[0] + if command == 'open': + file = flat_list[1] + if file in DirOptions or file in SecondDirOptions or file in TestDirOptions: + command_str = command_str + 'opendir ' + file.replace('/','') + ' 0777' + else: + command_str = command_str + 'open ' + file.replace('/','') + ' O_RDWR|O_CREAT 0777' + +if command == 'creat': + file = flat_list[1] + command_str = command_str + 'open ' + file.replace('/','') + ' O_RDWR|O_CREAT 0777' + + if command == 'mkdir': + file = flat_list[1] + command_str = command_str + 'mkdir ' + file.replace('/','') + ' 0777' + +if command == 'mknod': + file = flat_list[1] + command_str = command_str + 'mknod ' + file.replace('/','') + ' TEST_FILE_PERMS|S_IFCHR|S_IFBLK' + ' 0' + + if command == 'falloc': + file = flat_list[1] + option = flat_list[2] + write_op = flat_list[3] + command_str = command_str + 'falloc ' + file.replace('/','') + ' ' + str(option) + ' ' + if write_op == 'append': + off = str(length_map[file]) + len = '4096' + length_map[file] += 4096 + elif write_op == 'overlap_aligned': + off = '0' + len = '4096' + else: + off = '1000' + len = '3000' + + command_str = command_str + off + ' ' + len + +if command == 'write': + file = flat_list[1] + write_op = flat_list[2] + command_str = command_str + 'write ' + file.replace('/','') + ' ' + if write_op == 'append': + len = '4096' + if file not in length_map: + length_map[file] = 0 + off = '0' + else: + off = str(length_map[file]) + + length_map[file] += 4096 + + elif write_op == 'overlap_aligned': + off = '0' + len = '4096' + + else: + off = '1000' + len = '3000' + +command_str = command_str + off + ' ' + len + + if command == 'dwrite': + file = flat_list[1] + write_op = flat_list[2] + command_str = command_str + 'dwrite ' + file.replace('/','') + ' ' + + if write_op == 'append': + len = '4096' + if file not in length_map: + length_map[file] = 0 + off = '0' + else: + off = str(length_map[file]) + length_map[file] += 4096 + + elif write_op == 'overlap': + off = '0' + len = '4096' + + command_str = command_str + off + ' ' + len + + if command == 'mmapwrite': + file = flat_list[1] + write_op = flat_list[2] + ret = flat_list[3] + command_str = command_str + 'mmapwrite ' + file.replace('/','') + ' ' + + if write_op == 'append': + len = '4096' + if file not in length_map: + length_map[file] = 0 + off = '0' + else: + off = str(length_map[file]) + length_map[file] += 4096 + + elif write_op == 'overlap': + off = '0' + len = '4096' + + command_str = command_str + off + ' ' + len + '\ncheckpoint ' + ret + +if command == 'link' or command =='rename' or command == 'symlink': + file1 = flat_list[1] + file2 = flat_list[2] + command_str = command_str + command + ' ' + file1.replace('/','') + ' ' + file2.replace('/','') + + if command == 'unlink'or command == 'remove' or command == 'rmdir' or command == 'close' or command == 'fsetxattr' or command == 'removexattr': + file = flat_list[1] + command_str = command_str + command + ' ' + file.replace('/','') + +if command == 'fsync': + file = flat_list[1] + ret = flat_list[2] + command_str = command_str + command + ' ' + file.replace('/','') + '\ncheckpoint ' + ret + + if command =='fdatasync': + file = flat_list[1] + ret = flat_list[2] + command_str = command_str + command + ' ' + file.replace('/','') + '\ncheckpoint ' + ret + + +if command == 'sync': + ret = flat_list[1] + command_str = command_str + command + '\ncheckpoint ' + ret + + if command == 'none': + command_str = command_str + command + + +if command == 'truncate': + file = flat_list[1] + trunc_op = flat_list[2] + command_str = command_str + command + ' ' + file.replace('/','') + ' ' + if trunc_op == 'aligned': + len = '0' + length_map[file] = 0 + elif trunc_op == 'unaligned': + len = '2500' + command_str = command_str + len + +return command_str + + + +def doPermutation(perm): + + global global_count + global parameterList + global num_ops + global syncPermutations + global count + global permutations + global SyncSet + global log_file_handle + global count_param + + #if our permutation is of the type (write, write, write - lets skip it.) We'll handle it in write intensive workload set + if len(set(perm)) == 1 and list(set(perm))[0] == 'write': + return + + permutations.append(perm) + log = ', '.join(perm); + log = '\n' + `count` + ' : ' + log + '\n' + count +=1 + # global_count +=1 + log_file_handle.write(log) + + #Now for each of this permutation, find all possible permutation of paramters + combination = list() + for length in xrange(0,len(permutations[count-1])): + combination.append(parameterList[permutations[count-1][length]]) + count_param = 0 + for j in itertools.product(*combination): + + #files used so far + usedSofar = list() + intersect = list() + #allow this combination only if we have overlap of files: + # print j + toSkip = False + for paramLength in xrange(0, int(num_ops)): + # print 'Used files so far : ' + intersect = list(set(j[paramLength]) & set(usedSofar)) + if j[paramLength][0] == 'A' or j[paramLength][0] == 'B' or j[paramLength][0] == 'AC': + intersect.append('A') + elif len(usedSofar) == 2 and (usedSofar[0] == 'A' or usedSofar[0] == 'B' or usedSofar[0] == 'AC'): + intersect.append('A') + usedSofar = list(set(j[paramLength]) | set(usedSofar)) + # print usedSofar + # print intersect + if len(intersect) == 0 and paramLength > 0: + # print 'Skip this option' + toSkip = True + continue + + if toSkip: + continue + +log = '{0}'.format(j) + log = '\t' + `count_param` + ' : ' + log + '\n' + count_param += 1 + log_file_handle.write(log) + + #Let's insert fsync combinations here. + count_sync = 0 + usedFiles = list() + flat_used_list = flatList(j) + for file_len in xrange(0, len(flat_used_list)): + if isinstance(flat_used_list[file_len], basestring): + usedFilesList = list(set(flat_used_list) & set(FileOptions + SecondFileOptions + DirOptions + SecondDirOptions + TestDirOptions)) + usedFiles.append(tuple(usedFilesList)) + else: + usedFilesList = [filter(lambda x: x in list(FileOptions + SecondFileOptions + DirOptions + SecondDirOptions + TestDirOptions), sublist) for sublist in j] + usedFilesList = flatList(usedFilesList) + # usedFiles.append(list(itertools.chain.from_iterable(usedFiles))) + + usedFiles = flatList(set(usedFiles)) + + #TODO: to generate remaining files, use the custom set + # syncPermutationsCustom = buildCustomTuple(file_range(usedFiles)) + syncPermutationsCustom = buildCustomTuple(usedFiles) + # syncPermutationsCustom = [x for x in syncPermutationsCustomAll if x not in syncPermutationsCustomUsed] + + log = '\n\t\tUsed Files = {0}\n'.format(usedFiles) + log = log + '\t\tFile range = {0}\n'.format(file_range(usedFiles)) + log_file_handle.write(log) + + + + isFadatasync = False + for insSync in range(0, len(syncPermutationsCustom)): + + + if int(num_ops) == 1 or int(num_ops) == 2 or int(num_ops) == 3 or int(num_ops) == 4: + log = '{0}'.format(syncPermutationsCustom[insSync]); + log = '\n\t\tFile # ' + `global_count` + ' : ' + `count_sync` + ' : ' + log + '\n' + log_file_handle.write(log) + global_count +=1 + count_sync+=1 + seq = [] + + #merge the lists here . Just check if perm has fdatasync. If so skip adding any sync: + for length in xrange(0, len(perm)): + skip_sync = False + op = list() + if perm[length] == 'fdatasync' or perm[length] == 'mmapwrite': + skip_sync = True + isFadatasync = True + else: + op.append(perm[length]) + + #Now merge parameters + if skip_sync: + # fdatasync_op = list() + op.append(perm[length]) + op.append(j[length]) + if length == len(perm)-1: + op.append('1') + else: + op.append('0') + op = tuple(flatList(op)) + + else: + op.append(j[length]) + + + seq.append(tuple(op)) + + if not skip_sync: + sync_op = list() + sync_op.append(syncPermutationsCustom[insSync][length]) + if length == len(perm)-1: + sync_op.append('1') + else: + sync_op.append('0') +seq.append(tuple(flatList(sync_op))) + + log = '\t\t\tCurrent Sequence = {0}'.format(seq); + log_file_handle.write(log) + + # + # #------Satisy dependencies now---------- + + modified_pos = 0 + modified_sequence = list(seq) + open_file_map = {} + file_length_map = {} + open_dir_map = {} + #test dir exists + open_dir_map['test'] = 0 + + for i in xrange(0, len(seq)): + modified_pos = satisfyDep(seq, i, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + modified_pos += 1 + + #now close all open files + for file_name in open_file_map: + if open_file_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + for file_name in open_dir_map: + if open_dir_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + ## #------Satisy dependencies now---------- + # + # + # + ## #Now build the j-lang file------------------------------------ + j_lang_file = 'j-lang' + str(global_count) + copyfile('code/tests/seq3-nested/base-j-lang', j_lang_file) + length_map = {} + + with open(j_lang_file, 'a') as f: + run_line = '\n\n# run\n' + f.write(run_line) + + for insert in xrange(0, len(modified_sequence)): + cur_line = buildJlang(modified_sequence[insert], length_map) + cur_line_log = '{0}'.format(cur_line) + '\n' + f.write(cur_line_log) + + f.close() + + exec_command = 'python workload_seq2.py -b code/tests/seq3-nested/base.cpp -t ' + j_lang_file + ' -p code/tests/seq3-nested/ -o ' + str(global_count) + subprocess.call(exec_command, shell=True) + #Now build the j-lang file------------------------------------ + # + ## + log = '\n\t\t\tModified sequence = {0}\n'.format(modified_sequence); + log_file_handle.write(log) +## +## isBugWorkload(permutations[count-1], j, syncPermutationsCustom[insSync]) + + + +global_count = 0 +parameterList = {} +SyncSet = list() +num_ops = 0 +syncPermutations = [] +count = 0 +permutations = [] +log_file_handle = 0 +count_param = 0 + +def main(): + + global global_count + global parameterList + global num_ops + global syncPermutations + global count + global permutations + global SyncSet + global log_file_handle + global count_param + + #open log file + log_file = time.strftime('%Y%m%d_%H%M%S') + '-bugWorkloadGen.log' + log_file_handle = open(log_file, 'w') + + #Parse input args + parsed_args = build_parser().parse_args() + + #Print the test setup - just for sanity + print_setup(parsed_args) + + num_ops = parsed_args.sequence_len + + for i in xrange(0,len(expected_sequence)): + print 'Bug #', i+1 + print expected_sequence[i] + print expected_sync_sequence[i] + print '\n' + + + for i in OperationSet: + parameterList[i] = buildTuple(i) + log = '{0}'.format(parameterList[i]); + log = `i` + ' : Options = ' + `len(parameterList[i])` + '\n' + log + '\n\n' + log_file_handle.write(log) + + d = buildTuple('fsync') + fsync = ('fsync',) + sync = ('sync') + none = ('none') + +for i in xrange(0, len(d)): + tup = list(fsync) + tup.append(d[i]) + SyncSet.append(tup) + + SyncSet.append(sync) + SyncSet.append(none) + SyncSet = tuple(SyncSet) + # print SyncSet + + +for i in itertools.product(SyncSet, repeat=int(num_ops)): + syncPermutations.append(i) + # print i + + + start_time = time.time() + + for i in itertools.product(OperationSet, repeat=int(num_ops)): + # for i in itertools.permutations(OperationSet, int(num_ops)): + doPermutation(i) + + # pool = Pool(processes = 4) + # pool.map(doPermutation, itertools.permutations(OperationSet, int(num_ops))) + # pool.close() + + + + end_time = time.time() + +log = 'Total permutations of input op set = ' + `count` + '\n' + print log + log_file_handle.write(log) + + log = 'Total workloads inspected = ' + `global_count` + '\n' + print log + log_file_handle.write(log) + + log = 'Time taken to match workloads = ' + `end_time-start_time` + 'seconds\n\n' + print log + log_file_handle.write(log) + + log_file_handle.close() + + subprocess.call('mv j-lang* code/tests/seq3-nested/j-lang-files/', shell = True) + + +if __name__ == '__main__': + main() diff --git a/ace/specific_generator_scripts/seq3writegenerator.py b/ace/specific_generator_scripts/seq3writegenerator.py new file mode 100755 index 0000000..0b54f03 --- /dev/null +++ b/ace/specific_generator_scripts/seq3writegenerator.py @@ -0,0 +1,1262 @@ +#!/usr/bin/env python + +#To run : python bugWorkloadGen.py -n 3 +import os +import re +import sys +import stat +import subprocess +import argparse +import time +import itertools +import json +import pprint +import collections +import threading + +from shutil import copyfile +from string import maketrans +from multiprocessing import Pool + + + +#All functions that has options go here +#FallocOptions = ['FALLOC_FL_ZERO_RANGE','FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE','FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE', '0', 'FALLOC_FL_KEEP_SIZE'] + +FallocOptions = ['FALLOC_FL_ZERO_RANGE', 'FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE','FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE','FALLOC_FL_KEEP_SIZE', 0] + +FsyncOptions = ['fsync','fdatasync'] + +#This should take care of file name/ dir name +#FileOptions = ['B/foo', 'A/foo'] +FileOptions = ['A/foo'] +SecondFileOptions = ['B/bar', 'A/bar'] + +#A, B are subdir under test +DirOptions = ['A'] +TestDirOptions = ['test'] +SecondDirOptions = ['B'] + +#this will take care of offset + length combo +#Start = 4-16K , append = 16K-20K, overlap = 8000 - 12096, prepend = 0-4K + +#Append should append to file size, and overwrites should be possible +#WriteOptions = ['start', 'append', 'overlap', 'prepend'] 'overlap_aligned' +WriteOptions = ['append', 'overlap_unaligned_start', 'overlap_unaligned_end', 'overlap_extend'] + + +#d_overlap = 8K-12K (has to be aligned) +dWriteOptions = ['append', 'overlap_start', 'overlap_end'] + +#Truncate file options 'aligned' +TruncateOptions = ['unaligned'] + +#removed symlink, mknod +#OperationSet = ['creat', 'mkdir', 'falloc', 'write', 'dwrite', 'link', 'unlink', 'remove', 'rename', 'removexattr', 'fdatasync', 'fsetxattr', 'truncate', 'mmapwrite'] + +OperationSet = ['write', 'mmapwrite', 'falloc', 'dwrite'] + +#We are skipping 041, 336, 342, 343 +#The sequences we want to reach to +expected_sequence = [] +expected_sync_sequence = [] + + + +def SiblingOf(file): + if file == 'foo': + return 'bar' + elif file == 'bar' : + return 'foo' + elif file == 'A/foo': + return 'A/bar' + elif file == 'A/bar': + return 'A/foo' + elif file == 'B/foo': + return 'B/bar' + elif file == 'B/bar' : + return 'B/foo' + elif file == 'A' : + return 'B' + elif file == 'B': + return 'A' + elif file == 'test': + return 'test' + +def Parent(file): + if file == 'foo' or file == 'bar': + return 'test' + if file == 'A/foo' or file == 'A/bar': + return 'A' + if file == 'B/foo' or file == 'B/bar': + return 'B' + if file == 'A' or file == 'B' or file == 'test': + return 'test' + +def file_range(file_list): + file_set = list(file_list) + for i in xrange(0, len(file_list)): + file_set.append(SiblingOf(file_list[i])) + file_set.append(Parent(file_list[i])) + return list(set(file_set)) + + +#----------------------Bug summary-----------------------# + +#Length 1 = 1 +#Length 2 = 7 +#length 3 = 5 + +# Total encoded = 13 + +#--------------------------------------------------------# + +#If we don't allow dependency ops on same file, we'll miss this in seq2 +#This is actually seq 2 = [link foo-bar, 'sync', unlink bar, 'fsync-bar'] +# 1. btrfs_link_unlink 3 (yes finds in 2) +expected_sequence.append([('link', ('foo', 'bar')), ('unlink', ('bar')), ('creat', ('bar'))]) +expected_sync_sequence.append([('sync'), ('none'), ('fsync', 'bar')]) + + +# 2. btrfs_rename_special_file 3 (yes in 3) +expected_sequence.append([('mknod', ('foo')), ('rename', ('foo', 'bar')), ('link', ('bar', 'foo'))]) +expected_sync_sequence.append([('fsync', 'bar'), ('none'), ('fsync', 'bar')]) + +# 3. new_bug1_btrfs 2 (Yes finds in 2) +expected_sequence.append([('write', ('foo', 'append')), ('falloc', ('foo', 'FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE', 'append'))]) +expected_sync_sequence.append([('fsync', 'foo'), ('fsync', 'foo')]) + +# 4. new_bug2_f2fs 3 (Yes finds in 2) +expected_sequence.append([('write', ('foo', 'append')), ('falloc', ('foo', 'FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE', 'append')), ('fdatasync', ('foo'))]) +expected_sync_sequence.append([('sync'), ('none'), ('none')]) + +#We miss this in seq-2, because we disallow workloads of sort creat, creat +# 5. generic_034 2 +expected_sequence.append([('creat', ('A/foo')), ('creat', ('A/bar'))]) +expected_sync_sequence.append([('sync'), ('fsync', 'A')]) + +# 6. generic_039 2 (Yes finds in 2) +expected_sequence.append([('link', ('foo', 'bar')), ('remove', ('bar'))]) +expected_sync_sequence.append([('sync'), ('fsync', 'foo')]) + +# 7. generic_059 2 (yes finds in 2) +expected_sequence.append([('write', ('foo', 'append')), ('falloc', ('foo', 'FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE', 'overlap_unaligned'))]) +expected_sync_sequence.append([('sync'), ('fsync', 'foo')]) + +# 8. generic_066 2 (Yes finds in 2) +expected_sequence.append([('fsetxattr', ('foo')), ('removexattr', ('foo'))]) +expected_sync_sequence.append([('sync'), ('fsync', 'foo')]) + +#Reachable from current seq 2 generator (#1360 : creat A/foo, rename A,B) (sync, fsync A) +#We will miss this, if we restrict that op2 reuses files from op1 +# 9. generic_341 3 (Yes finds in 2) +expected_sequence.append([('creat', ('A/foo')), ('rename', ('A', 'B')), ('mkdir', ('A'))]) +expected_sync_sequence.append([('sync'), ('none'), ('fsync', 'A')]) + +# 10. generic_348 1 (yes finds in 1) +expected_sequence.append([('symlink', ('foo', 'A/bar'))]) +expected_sync_sequence.append([('fsync', 'A')]) + +# 11. generic_376 2 (yes finds in 2) +expected_sequence.append([('rename', ('foo', 'bar')), ('creat', ('foo'))]) +expected_sync_sequence.append([('none'), ('fsync', 'bar')]) + +#Yes reachable from sseeq2 - (falloc (foo, append), fdatasync foo) +# 12. generic_468 3 (yes, finds in 2) +expected_sequence.append([('write', ('foo', 'append')), ('falloc', ('foo', 'FALLOC_FL_KEEP_SIZE', 'append')), ('fdatasync', ('foo'))]) +expected_sync_sequence.append([('sync'), ('none'), ('none')]) + +#We miss this if we sync only used file set - or we need an option 'none' to end the file with +# 13. ext4_direct_write 2 +expected_sequence.append([('write', ('foo', 'append')), ('dwrite', ('foo', 'overlap'))]) +expected_sync_sequence.append([('none'), ('fsync', 'bar')]) + +#14 btrfs_EEXIST (Seq 1) +#creat foo, fsync foo +#write foo 0-4K, fsync foo + +#btrfs use -O extref during mkfs +#15. generic 041 (If we consider the 3000 as setup, then seq length 3) +#create 3000 link(foo, foo_i), sync, unlink(foo_0), link(foo, foo_3001), link(foo, foo_0), fsync foo + +#16. generic 056 (seq2) +#write(foo, 0-4K), fsync foo, link(foo, bar), fsync some random file/dir + +#requires that we allow repeated operations (check if mmap write works here) +#17 generic 090 (seq3) +#write(foo 0-4K), sync, link(foo, bar), sync, append(foo, 4K-8K), fsync foo + +#18 generic_104 (seq2) larger file set +#link(foo, foo1), link(bar, bar1), fsync(bar) + +#19 generic 106 (seq 2) +#link(foo, bar), sync, unlink(bar) *drop cache* fsync foo + +#20 generic 107 (seq 3) +#link(foo, A/foo), link(foo, A/bar), sync, unlink(A/bar), fsync(foo) + +#21 generic 177 +#write(foo, 0-32K), sync, punch_hole(foo, 24K-32K), punch_hole(foo, 4K-64K) fsync foo + +#22 generic 321 2 fsyncs? +#rename(foo, A/foo), fsync A, fsync A/foo + +#23 generic 322 (yes, seq1) +#rename(A/foo, A/bar), fsync(A/bar) + +#24 generic 335 (seq 2) but larger file set +#rename(A/foo, foo), creat bar, fsync(test) + +#25 generic 336 (seq 4) +#link(A/foo, B/foo), creat B/bar, sync, unlink(B/foo), mv(B/bar, C/bar), fsync A/foo + + +#26 generic 342 (seq 3) +# write foo 0-4K, sync, rename(foo,bar), write(foo) fsync(foo) + +#27 generic 343 (seq 2) +#link(A/foo, A/bar) , rename(B/foo_new, A/foo_new), fsync(A/foo) + +#28 generic 325 (seq3) +#write,(foo, 0-256K), mmapwrite(0-4K), mmapwrite(252-256K), msync(0-64K), msync(192-256K) + +#29 new btrfs link (seq1) +#link(foo, bar), fsync(foo) + +def build_parser(): + parser = argparse.ArgumentParser(description='Bug Workload Generator for XFSMonkey v0.1') + + # global args + parser.add_argument('--sequence_len', '-l', default='3', help='Number of critical ops in the bugy workload') + + return parser + + +def print_setup(parsed_args): + print '\n{: ^50s}'.format('XFSMonkey Bug Workload generatorv0.1\n') + print '='*20, 'Setup' , '='*20, '\n' + print '{0:20} {1}'.format('Sequence length', parsed_args.sequence_len) + print '\n', '='*48, '\n' + +min = 0 + +def buildTuple(command): + if command == 'creat': + d = tuple(FileOptions) + elif command == 'mkdir': + d = tuple(DirOptions) + elif command == 'mknod': + d = tuple(FileOptions) + elif command == 'falloc': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(FallocOptions) + d_tmp.append(WriteOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'write': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(WriteOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'dwrite': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(dWriteOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'link' or command == 'symlink': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(SecondFileOptions + FileOptions) + d = list() + for i in itertools.product(*d_tmp): + if len(set(i)) == 2: + d.append(i) + elif command == 'rename': + d_tmp = list() + d_tmp.append(FileOptions + SecondFileOptions) + d_tmp.append(SecondFileOptions) + d = list() + for i in itertools.product(*d_tmp): + if len(set(i)) == 2: + d.append(i) + d_tmp = list() + d_tmp.append(DirOptions + SecondDirOptions) + d_tmp.append(SecondDirOptions) + for i in itertools.product(*d_tmp): + if len(set(i)) == 2: + d.append(i) + elif command == 'remove' or command == 'unlink': + d = tuple(FileOptions +SecondFileOptions) + elif command == 'fdatasync' or command == 'fsetxattr' or command == 'removexattr': + d = tuple(FileOptions) + elif command == 'fsync': + d = tuple(FileOptions + DirOptions + TestDirOptions + SecondFileOptions + SecondDirOptions) + elif command == 'truncate': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(TruncateOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + elif command == 'mmapwrite': + d_tmp = list() + d_tmp.append(FileOptions) + d_tmp.append(dWriteOptions) + d = list() + for i in itertools.product(*d_tmp): + d.append(i) + else: + d=() + return d + + +def buildCustomTuple(file_list): + global num_ops + + d = list(file_list) + fsync = ('fsync',) + fdatasync = ('fdatasync',) + sync = ('sync') + none = ('none') + SyncSetCustom = list() + SyncSetNoneCustom = list() + for i in xrange(0, len(d)): + tup = list(fsync) + tup.append(d[i]) + SyncSetCustom.append(tuple(tup)) + SyncSetNoneCustom.append(tuple(tup)) + tup = list(fdatasync) + tup.append(d[i]) + SyncSetCustom.append(tuple(tup)) + SyncSetNoneCustom.append(tuple(tup)) + + +# SyncSetCustom.append(sync) +# SyncSetNoneCustom.append(sync) + SyncSetCustom.append(none) + SyncSetCustom = tuple(SyncSetCustom) + SyncSetNoneCustom = tuple(SyncSetNoneCustom) + syncPermutationsCustom = list() + + if int(num_ops) == 1: + for i in itertools.product(SyncSetNoneCustom): + syncPermutationsCustom.append(i) + + elif int(num_ops) == 2: + for i in itertools.product(SyncSetCustom, SyncSetNoneCustom): + syncPermutationsCustom.append(i) + + elif int(num_ops) == 3: + for i in itertools.product(SyncSetCustom, SyncSetCustom, SyncSetNoneCustom): + syncPermutationsCustom.append(i) + + elif int(num_ops) == 4: + for i in itertools.product(SyncSetCustom, SyncSetCustom, SyncSetCustom, SyncSetNoneCustom): + syncPermutationsCustom.append(i) + + return syncPermutationsCustom + + + +def isBugWorkload(opList, paramList, syncList): + for i in xrange(0,len(expected_sequence)): + if len(opList) != len(expected_sequence[i]): + continue + + flag = 1 + + for j in xrange(0, len(expected_sequence[i])): + if opList[j] == expected_sequence[i][j][0] and paramList[j] == expected_sequence[i][j][1] and tuple(syncList[j]) == tuple(expected_sync_sequence[i][j]): + continue + else: + flag = 0 + break + + if flag == 1: + print 'Found match to Bug # ', i+1, ' : in file # ' , global_count + print 'Length of seq : ', len(expected_sequence[i]) + print 'Expected sequence = ' , expected_sequence[i] + print 'Expected sync sequence = ', expected_sync_sequence[i] + print 'Auto generator found : ' + print opList + print paramList + print syncList + print '\n\n' + return True + + + +def insertUnlink(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + open_file_map.pop(file_name, None) + return ('unlink', file_name) + +def insertRmdir(file_name,open_dir_map, open_file_map, file_length_map, modified_pos): + open_dir_map.pop(file_name, None) + return ('rmdir', file_name) + +def insertXattr(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + return ('fsetxattr', file_name) + +def insertOpen(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + if file_name in FileOptions or file_name in SecondFileOptions: + open_file_map[file_name] = 1 + elif file_name in DirOptions or file_name in SecondDirOptions or file_name in TestDirOptions: + open_dir_map[file_name] = 1 + return ('open', file_name) + +def insertMkdir(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + if file_name in DirOptions or file_name in SecondDirOptions or file_name in TestDirOptions: + open_dir_map[file_name] = 0 + return ('mkdir', file_name) + +def insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + if file_name in FileOptions or file_name in SecondFileOptions: + open_file_map[file_name] = 0 + elif file_name in DirOptions or file_name in SecondDirOptions or file_name in TestDirOptions: + open_dir_map[file_name] = 0 + return ('close', file_name) + +def insertWrite(file_name, open_dir_map, open_file_map, file_length_map, modified_pos): + if file_name not in file_length_map: + file_length_map[file_name] = 0 + file_length_map[file_name] += 1 + return ('write', (file_name, 'append')) + +#Creat : file should not exist. If it does, remove it. +def checkCreatDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_name = current_sequence[pos][1] + + + #Either open or closed doesn't matter. File should not exist at all + if file_name in open_file_map: + #Insert dependency before the creat command + modified_sequence.insert(modified_pos, insertUnlink(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + return modified_pos + +def checkDirDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_name = current_sequence[pos][1] + if file_name not in DirOptions and file_name not in SecondDirOptions: + print 'Invalid param list for mkdir' + + #Either open or closed doesn't matter. File should not exist at all + if file_name in open_dir_map and file_name != 'test': + #if dir is A, remove contents within it too + if file_name == 'A': + if 'A/foo' in open_file_map and open_file_map['A/foo'] == 1: + file = 'A/foo' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'A/foo' in open_file_map and open_file_map['A/foo'] == 0: + file = 'A/foo' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + if 'A/bar' in open_file_map and open_file_map['A/bar'] == 1: + file = 'A/bar' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'A/bar' in open_file_map and open_file_map['A/bar'] == 0: + file = 'A/bar' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + + if file_name == 'B': + if 'B/foo' in open_file_map and open_file_map['B/foo'] == 1: + file = 'B/foo' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'B/foo' in open_file_map and open_file_map['A/foo'] == 0: + file = 'B/foo' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + if 'B/bar' in open_file_map and open_file_map['B/bar'] == 1: + file = 'B/bar' + modified_sequence.insert(modified_pos, insertClose(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + elif 'B/bar' in open_file_map and open_file_map['B/bar'] == 0: + file = 'B/bar' + modified_sequence.insert(modified_pos, insertUnlink(file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + + #Insert dependency before the creat command + modified_sequence.insert(modified_pos, insertRmdir(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + return modified_pos + + +def checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_names = current_sequence[pos][1] + if isinstance(file_names, basestring): + file_name = file_names + #Parent dir doesn't exist + if (Parent(file_name) == 'A' or Parent(file_name) == 'B') and Parent(file_name) not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir(Parent(file_name), open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + else: + file_name = file_names[0] + file_name2 = file_names[1] + + #Parent dir doesn't exist + if (Parent(file_name) == 'A' or Parent(file_name) == 'B') and Parent(file_name) not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir(Parent(file_name), open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + #Parent dir doesn't exist + if (Parent(file_name2) == 'A' or Parent(file_name2) == 'B') and Parent(file_name2) not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir(Parent(file_name2), open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + return modified_pos + + +# Check the dependency that file already exists and is open +def checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_names = current_sequence[pos][1] + if isinstance(file_names, basestring): + file_name = file_names + else: + file_name = file_names[0] + + # If we are trying to fsync a dir, ensure it exists + if file_name in DirOptions or file_name in SecondDirOptions or file_name in TestDirOptions: + if file_name not in open_dir_map: + modified_sequence.insert(modified_pos, insertMkdir(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + + + if file_name not in open_file_map or open_file_map[file_name] == 0: + #Insert dependency - open before the command + modified_sequence.insert(modified_pos, insertOpen(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + return modified_pos + + +def checkClosed(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + + file_names = current_sequence[pos][1] + if isinstance(file_names, basestring): + file_name = file_names + else: + file_name = file_names[0] + + if file_name in open_file_map and open_file_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + if file_name in open_dir_map and open_dir_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + return modified_pos + +def checkXattr(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + file_name = current_sequence[pos][1] + if open_file_map[file_name] == 1: + modified_sequence.insert(modified_pos, insertXattr(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + return modified_pos + +def checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + + file_names = current_sequence[pos][1] + if isinstance(file_names, basestring): + file_name = file_names + else: + file_name = file_names[0] + + # 0 length file + if file_name not in file_length_map: + modified_sequence.insert(modified_pos, insertWrite(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + return modified_pos + + +def satisfyDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map): + if isinstance(current_sequence[pos], basestring): + command = current_sequence[pos] + else: + command = current_sequence[pos][0] + + # print 'Command = ', command + + if command == 'creat' or command == 'mknod': + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkCreatDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + file = current_sequence[pos][1] + open_file_map[file] = 1 + + elif command == 'mkdir': + modified_pos = checkDirDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + dir = current_sequence[pos][1] + open_dir_map[dir] = 0 + + elif command == 'falloc': + file = current_sequence[pos][1][0] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #if file doesn't exist, has to be created and opened + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + #Whatever the op is, let's ensure file size is non zero + modified_pos = checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + + elif command == 'write' or command == 'dwrite' or command == 'mmapwrite': + file = current_sequence[pos][1][0] + option = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #if file doesn't exist, has to be created and opened + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + + #if we chose to do an append, let's not care about the file size + # however if its an overwrite or unaligned write, then ensure file is atleast one page long + if option == 'append': + if file not in file_length_map: + file_length_map[file] = 0 + file_length_map[file] += 1 + elif option == 'overlap_unaligned_start' or 'overlap_unaligned_end' or 'overlap_start' or 'overlap_end' or 'overlap_extend': + modified_pos = checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #If we do a dwrite, let's close the file after that + if command == 'dwrite': + if file in FileOptions or file in SecondFileOptions: + open_file_map[file] = 0 + + + + + elif command == 'link': + second_file = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + if second_file in open_file_map and open_file_map[second_file] == 1: + #Insert dependency - open before the command + modified_sequence.insert(modified_pos, insertClose(second_file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + #if we have a closed file, remove it + if second_file in open_file_map and open_file_map[second_file] == 0: + #Insert dependency - open before the command + modified_sequence.insert(modified_pos, insertUnlink(second_file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + + #We have created a new file, but it isn't open yet + open_file_map[second_file] = 0 + + elif command == 'rename': + #If the file was open during rename, does the handle now point to new file? + first_file = current_sequence[pos][1][0] + second_file = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #Checks if first file is closed + modified_pos = checkClosed(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + if second_file in open_file_map and open_file_map[second_file] == 1: + #Insert dependency - close the second file + modified_sequence.insert(modified_pos, insertClose(second_file, open_dir_map, open_file_map, file_length_map, modified_pos)) + modified_pos += 1 + + #We have removed the first file, and created a second file + if first_file in FileOptions or first_file in SecondFileOptions: + open_file_map.pop(first_file, None) + open_file_map[second_file] = 0 + elif first_file in DirOptions: + open_dir_map.pop(first_file, None) + open_dir_map[second_file] = 0 + + + elif command == 'symlink': + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #No dependency checks + pass + + elif command == 'remove' or command == 'unlink': + #Close any open file handle and then unlink + file = current_sequence[pos][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos,open_dir_map, open_file_map, file_length_map) + modified_pos = checkClosed(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + #Remove file from map + open_file_map.pop(file, None) + + + elif command == 'removexattr': + #Check that file exists + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + #setxattr + modified_pos = checkXattr(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + elif command == 'fsync' or command == 'fdatasync' or command == 'fsetxattr': + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + elif command == 'none' or command == 'sync': + pass + + elif command == 'truncate': + file = current_sequence[pos][1][0] + option = current_sequence[pos][1][1] + + modified_pos = checkParentExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + # if file doesn't exist, has to be created and opened + modified_pos = checkExistsDep(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + # Put some data into the file + modified_pos = checkFileLength(current_sequence, pos, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) + + else: + print command + print 'Invalid command' + + return modified_pos + + +def flatList(op_list): + flat_list = list() + if not isinstance(op_list, basestring): + for sublist in op_list: + if not isinstance(sublist, basestring): + for item in sublist: + flat_list.append(item) + else: + flat_list.append(sublist) + else: + flat_list.append(op_list) + + return flat_list + + +def buildJlang(op_list, length_map, mmaplist): + flat_list = list() + if not isinstance(op_list, basestring): + for sublist in op_list: + if not isinstance(sublist, basestring): + for item in sublist: + flat_list.append(item) + else: + flat_list.append(sublist) + else: + flat_list.append(op_list) + + + command_str = '' + command = flat_list[0] + if command == 'open': + file = flat_list[1] + if file in DirOptions or file in SecondDirOptions or file in TestDirOptions: + command_str = command_str + 'opendir ' + file.replace('/','') + ' 0777' + else: + command_str = command_str + 'open ' + file.replace('/','') + ' O_RDWR|O_CREAT 0777' + + if command == 'creat': + file = flat_list[1] + command_str = command_str + 'open ' + file.replace('/','') + ' O_RDWR|O_CREAT 0777' + + if command == 'mkdir': + file = flat_list[1] + command_str = command_str + 'mkdir ' + file.replace('/','') + ' 0777' + + if command == 'mknod': + file = flat_list[1] + command_str = command_str + 'mknod ' + file.replace('/','') + ' TEST_FILE_PERMS|S_IFCHR|S_IFBLK' + ' 0' + +#WriteOptions = ['append', 'overlap_unaligned_start', 'overlap_unaligned_end', 'overlap_extend'] + + +#d_overlap = 8K-12K (has to be aligned) +#dWriteOptions = ['append', 'overlap_start', 'overlap_end'] + + if command == 'falloc': + file = flat_list[1] + option = flat_list[2] + write_op = flat_list[3] + command_str = command_str + 'falloc ' + file.replace('/','') + ' ' + str(option) + ' ' + if write_op == 'append': + off = str(length_map[file]) + lenn = '32768' + length_map[file] += 32768 + elif write_op == 'overlap_unaligned_start': + off = '0' + lenn = '5000' + elif write_op == 'overlap_unaligned_end': + size = length_map[file] + off = str(size-5000) + lenn = '5000' + elif write_op == 'overlap_extend': + size = length_map[file] + off = str(size-2000) + lenn = '5000' + length_map[file] += 3000 + + + + command_str = command_str + off + ' ' + lenn + + if command == 'write': + file = flat_list[1] + write_op = flat_list[2] + command_str = command_str + 'write ' + file.replace('/','') + ' ' + if write_op == 'append': + lenn = '32768' + if file not in length_map: + length_map[file] = 0 + off = '0' + else: + off = str(length_map[file]) + + length_map[file] += 32768 + + elif write_op == 'overlap_unaligned_start': + off = '0' + lenn = '5000' + elif write_op == 'overlap_unaligned_end': + size = length_map[file] + off = str(size-5000) + lenn = '5000' + elif write_op == 'overlap_extend': + size = length_map[file] + off = str(size-2000) + lenn = '5000' + + command_str = command_str + off + ' ' + lenn + + if command == 'dwrite': + file = flat_list[1] + write_op = flat_list[2] + command_str = command_str + 'dwrite ' + file.replace('/','') + ' ' + + if write_op == 'append': + lenn = '32768' + if file not in length_map: + length_map[file] = 0 + off = '0' + else: + off = str(length_map[file]) + length_map[file] += 32768 + + elif write_op == 'overlap_start': + off = '0' + lenn = '8192' + elif write_op == 'overlap_end': + size = length_map[file] + off = str(size-8192) + lenn = '8192' + + command_str = command_str + off + ' ' + lenn + + if command == 'mmapwrite': + file = flat_list[1] + write_op = flat_list[2] + ret = flat_list[3] + command_str = command_str + 'mmapwrite ' + file.replace('/','') + ' ' + + if write_op == 'append': + lenn = '32768' + if file not in length_map: + length_map[file] = 0 + off = '0' + else: + off = str(length_map[file]) + length_map[file] += 32768 + + elif write_op == 'overlap_start': + off = '0' + lenn = '8192' + elif write_op == 'overlap_end': + size = length_map[file] + off = str(size-8192) + lenn = '8192' + + command_str = command_str + off + ' ' + lenn + msync_op = '' + msync_op = msync_op + 'msync ' + file.replace('/','') + ' ' + off + ' ' + lenn + '\ncheckpoint ' + ret + mmaplist.append(msync_op) + + if command == 'msync': + num_ops = len(mmaplist) + for i in xrange(0, num_ops): + command_str = command_str + mmaplist[i] + '\n' +# command_str = command_str + mmaplist[num_ops - 1] + + if command == 'munmap': + command_str = 'munmap' + + if command == 'link' or command =='rename' or command == 'symlink': + file1 = flat_list[1] + file2 = flat_list[2] + command_str = command_str + command + ' ' + file1.replace('/','') + ' ' + file2.replace('/','') + + if command == 'unlink'or command == 'remove' or command == 'rmdir' or command == 'close' or command == 'fsetxattr' or command == 'removexattr': + file = flat_list[1] + command_str = command_str + command + ' ' + file.replace('/','') + + if command == 'fsync': + file = flat_list[1] + ret = flat_list[2] + command_str = command_str + command + ' ' + file.replace('/','') + '\ncheckpoint ' + ret + + if command =='fdatasync': + file = flat_list[1] + ret = flat_list[2] + command_str = command_str + command + ' ' + file.replace('/','') + '\ncheckpoint ' + ret + + + if command == 'sync': + ret = flat_list[1] + command_str = command_str + command + '\ncheckpoint ' + ret + + if command == 'none': + command_str = command_str + command + + + if command == 'truncate': + file = flat_list[1] + trunc_op = flat_list[2] + command_str = command_str + command + ' ' + file.replace('/','') + ' ' + if trunc_op == 'aligned': + lenn = '0' + length_map[file] = 0 + elif trunc_op == 'unaligned': + lenn = '2500' + command_str = command_str + lenn + + return command_str + + + +def doPermutation(perm): + + global global_count + global parameterList + global num_ops + global syncPermutations + global count + global permutations + global SyncSet + global log_file_handle + global count_param + + #if our permutation is of the type (write, write, write - lets skip it.) We'll handle it in write intensive workload set + if len(set(perm)) == 1 and list(set(perm))[0] == 'write': + return + + permutations.append(perm) + log = ', '.join(perm); + log = '\n' + `count` + ' : ' + log + '\n' + count +=1 +# global_count +=1 + log_file_handle.write(log) + + #Now for each of this permutation, find all possible permutation of paramters + combination = list() + for length in xrange(0,len(permutations[count-1])): + combination.append(parameterList[permutations[count-1][length]]) + count_param = 0 + for j in itertools.product(*combination): + if 'append' not in j[0]: + log = '\nDoesnt start with append' + log_file_handle.write(log) + continue + append = 0 + for k in xrange(0,len(j)): + if 'append' in j[k]: + append+=1 + if append == len(j): + continue + + log = '{0}'.format(j) + log = '\t' + `count_param` + ' : ' + log + '\n' + count_param += 1 + log_file_handle.write(log) + + #Let's insert fsync combinations here. + count_sync = 0 + usedFiles = list() + flat_used_list = flatList(j) + for file_len in xrange(0, len(flat_used_list)): + if isinstance(flat_used_list[file_len], basestring): + usedFilesList = list(set(flat_used_list) & set(FileOptions + SecondFileOptions + DirOptions + SecondDirOptions + TestDirOptions)) + usedFiles.append(tuple(usedFilesList)) + else: + usedFilesList = [filter(lambda x: x in list(FileOptions + SecondFileOptions + DirOptions + SecondDirOptions + TestDirOptions), sublist) for sublist in j] + usedFilesList = flatList(usedFilesList) +# usedFiles.append(list(itertools.chain.from_iterable(usedFiles))) + + usedFiles = flatList(set(usedFiles)) + + #TODO: to generate remaining files, use the custom set +# syncPermutationsCustom = buildCustomTuple(file_range(usedFiles)) + syncPermutationsCustom = buildCustomTuple(usedFiles) +# syncPermutationsCustom = [x for x in syncPermutationsCustomAll if x not in syncPermutationsCustomUsed] + + log = '\n\t\tUsed Files = {0}\n'.format(usedFiles) + log = log + '\t\tFile range = {0}\n'.format(file_range(usedFiles)) + log_file_handle.write(log) + + + + isFadatasync = False + for insSync in range(0, len(syncPermutationsCustom)): + + + if int(num_ops) == 1 or int(num_ops) == 2 or int(num_ops) == 3: + log = '{0}'.format(syncPermutationsCustom[insSync]); + log = '\n\t\tFile # ' + `global_count` + ' : ' + `count_sync` + ' : ' + log + '\n' + log_file_handle.write(log) + global_count +=1 + count_sync+=1 + seq = [] + + #merge the lists here . Just check if perm has fdatasync. If so skip adding any sync: + for length in xrange(0, len(perm)): + skip_sync = False + op = list() + if perm[length] == 'fdatasync' or perm[length] == 'mmapwrite': + skip_sync = True + isFadatasync = True + else: + op.append(perm[length]) + + #Now merge parameters + if skip_sync: +# fdatasync_op = list() + op.append(perm[length]) + op.append(j[length]) + if length == len(perm)-1: + op.append('1') + else: + op.append('0') + op = tuple(flatList(op)) + + else: + op.append(j[length]) + + + seq.append(tuple(op)) + + if not skip_sync: + sync_op = list() + sync_op.append(syncPermutationsCustom[insSync][length]) + if length == len(perm)-1: + sync_op.append('1') + else: + sync_op.append('0') + seq.append(tuple(flatList(sync_op))) + +# log = '\t\t\tCurrent Sequence = {0}'.format(seq); +# log_file_handle.write(log) + + +# #------Satisy dependencies now---------- +# +# modified_pos = 0 +# modified_sequence = list(seq) +# open_file_map = {} +# file_length_map = {} +# open_dir_map = {} +# #test dir exists +# open_dir_map['test'] = 0 +# +# for i in xrange(0, len(seq)): +# modified_pos = satisfyDep(seq, i, modified_sequence, modified_pos, open_dir_map, open_file_map, file_length_map) +# modified_pos += 1 +# +# #now close all open files +# for file_name in open_file_map: +# if open_file_map[file_name] == 1: +# modified_sequence.insert(modified_pos, insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) +# modified_pos += 1 +# +# for file_name in open_dir_map: +# if open_dir_map[file_name] == 1: +# modified_sequence.insert(modified_pos, insertClose(file_name, open_dir_map, open_file_map, file_length_map, modified_pos)) +# modified_pos += 1 +# +# #------Satisy dependencies now---------- + + +# +## #Now build the j-lang file------------------------------------ +# j_lang_file = 'j-lang' + str(global_count) +# copyfile('code/tests/seq3write/base-j-lang', j_lang_file) +# length_map = {} +# +# with open(j_lang_file, 'a') as f: +# run_line = '\n\n# run\n' +# f.write(run_line) +# mmaplist = list() +# for insert in xrange(0, len(modified_sequence)): +# cur_line = buildJlang(modified_sequence[insert], length_map, mmaplist) +# +# #In this workload, after we open the file, the close is the last operation +# # so let's insert msync before close of the file. +# if cur_line == 'close Afoo' and len(mmaplist) > 0: +# last_line = cur_line +# cur_line = buildJlang('msync', length_map, mmaplist) +# cur_line_log = '{0}'.format(cur_line) + '\n' +# f.write(cur_line_log) +# cur_line = 'munmap Afoo' +# cur_line_log = '{0}'.format(cur_line) + '\n' +# f.write(cur_line_log) +# cur_line = last_line +# +# cur_line_log = '{0}'.format(cur_line) + '\n' +# f.write(cur_line_log) +# +# f.close() +# +## exec_command = 'python workload_seq3.py -b code/tests/seq3write/base.cpp -t ' + j_lang_file + ' -p code/tests/seq3write/ -o ' + str(global_count) +## subprocess.call(exec_command, shell=True) +## #Now build the j-lang file------------------------------------ +# +# +## log = '\n\t\t\tModified sequence = {0}\n'.format(modified_sequence); +## log_file_handle.write(log) +# +# isBugWorkload(permutations[count-1], j, syncPermutationsCustom[insSync]) + + + +global_count = 0 +parameterList = {} +SyncSet = list() +num_ops = 0 +syncPermutations = [] +count = 0 +permutations = [] +log_file_handle = 0 +count_param = 0 + +def main(): + + global global_count + global parameterList + global num_ops + global syncPermutations + global count + global permutations + global SyncSet + global log_file_handle + global count_param + + #open log file + log_file = time.strftime('%Y%m%d_%H%M%S') + '-bugWorkloadGen.log' + log_file_handle = open(log_file, 'w') + + #Parse input args + parsed_args = build_parser().parse_args() + + #Print the test setup - just for sanity + print_setup(parsed_args) + + num_ops = parsed_args.sequence_len + + for i in xrange(0,len(expected_sequence)): + print 'Bug #', i+1 + print expected_sequence[i] + print expected_sync_sequence[i] + print '\n' + + + for i in OperationSet: + parameterList[i] = buildTuple(i) + log = '{0}'.format(parameterList[i]); + log = `i` + ' : Options = ' + `len(parameterList[i])` + '\n' + log + '\n\n' + log_file_handle.write(log) + + d = buildTuple('fsync') + fsync = ('fsync',) + sync = ('sync') + none = ('none') + + for i in xrange(0, len(d)): + tup = list(fsync) + tup.append(d[i]) + SyncSet.append(tup) + + SyncSet.append(sync) + SyncSet.append(none) + SyncSet = tuple(SyncSet) +# print SyncSet + + + for i in itertools.product(SyncSet, repeat=int(num_ops)): + syncPermutations.append(i) +# print i + + + start_time = time.time() + + for i in itertools.product(OperationSet, repeat=int(num_ops)): +# for i in itertools.permutations(OperationSet, int(num_ops)): + doPermutation(i) + +# pool = Pool(processes = 4) +# pool.map(doPermutation, itertools.permutations(OperationSet, int(num_ops))) +# pool.close() + + + + end_time = time.time() + + log = 'Total permutations of input op set = ' + `count` + '\n' + print log + log_file_handle.write(log) + + log = 'Total workloads inspected = ' + `global_count` + '\n' + print log + log_file_handle.write(log) + + log = 'Time taken to match workloads = ' + `end_time-start_time` + 'seconds\n\n' + print log + log_file_handle.write(log) + + log_file_handle.close() + + subprocess.call('mv j-lang* code/tests/seq3write/j-lang-files/', shell = True) + + +if __name__ == '__main__': + main() diff --git a/ace/specific_generator_scripts/workload_seq1.py b/ace/specific_generator_scripts/workload_seq1.py new file mode 100755 index 0000000..0b3fea7 --- /dev/null +++ b/ace/specific_generator_scripts/workload_seq1.py @@ -0,0 +1,761 @@ +#!/usr/bin/env python + +#To run : python workload.py -b code/tests/generic_039/base_test.cpp -t code/tests/generic_039/generic_039 -p code/tests/generic_039 +import os +import re +import sys +import stat +import subprocess +import argparse +import time +import itertools +from shutil import copyfile +from string import maketrans + + +#All functions that has options go here +FallocOptions = ['FALLOC_FL_ZERO_RANGE','FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE','FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE', '0', 'FALLOC_FL_KEEP_SIZE'] + +FsyncOptions = ['fsync','fdatasync'] + +RemoveOptions = ['remove','unlink'] + +LinkOptions = ['link','symlink'] + +WriteOptions = ['WriteData','WriteDataMmap', 'pwrite'] + +redeclare_map = {} + +def build_parser(): + parser = argparse.ArgumentParser(description='Workload Generator for XFSMonkey v1.0') + + # global args + parser.add_argument('--base_file', '-b', default='', help='Base test file to generate workload') + parser.add_argument('--test_file', '-t', default='', help='J lang test skeleton to generate workload') + + # crash monkey args + parser.add_argument('--target_path', '-p', default='code/tests/', help='Directory to save the generated test files') + + parser.add_argument('--output_name', '-o', default='file', help='Name of the generated file') + return parser + + +def print_setup(parsed_args): + print '\n{: ^50s}'.format('XFSMonkey Workload generatorv0.1\n') + print '='*20, 'Setup' , '='*20, '\n' + print '{0:20} {1}'.format('Base test file', parsed_args.base_file) + print '{0:20} {1}'.format('Test skeleton', parsed_args.test_file) + print '{0:20} {1}'.format('Target directory', parsed_args.target_path) + print '{0:20} {1}'.format('Output file', parsed_args.output_name) + print '\n', '='*48, '\n' + + +def create_dir(dir_path): + try: + os.makedirs(dir_path) + except OSError: + if not os.path.isdir(dir_path): + raise + +def create_dict(): + operation_map = {'fsync': 0, 'fallocate': 0, 'open': 0, 'remove': 0} + return operation_map + + +#These maps keep track of the line number in each method, to add the next function to in the C++ file +def updateSetupMap(index_map, num): + index_map['setup'] += num + index_map['run'] += num + index_map['check'] += num + index_map['define'] += num + +def updateRunMap(index_map, num): + index_map['run'] += num + index_map['check'] += num + index_map['define'] += num + +def updateCheckMap(index_map, num): + index_map['check'] += num + index_map['define'] += num + +def updateDefineMap(index_map, num): + index_map['define'] += num + + + +def insertDeclare(line, file, index_map): + + with open(file, 'r+') as declare: + contents = declare.readlines() + + updateRunMap(index_map, 1) + + to_insert = '\t\t\t\tint ' + line + ' = 0 ;\n' + contents.insert(index_map['run'], to_insert) + + declare.seek(0) + declare.writelines(contents) + declare.close() + + +# Add the 'line' which declares a file/dir used in the workload into the 'file' +# at position specified in the 'index_map' +def insertDefine(line, file, index_map): + with open(file, 'r+') as define: + + contents = define.readlines() + + #Initialize paths in setup phase + updateSetupMap(index_map, 1) + file_str = '' + if len(line.split('/')) != 1 : + for i in xrange(0, len(line.split('/'))): + file_str += line.split('/')[i] + else: + file_str = line.split('/')[-1] + + if file_str == 'test': + to_insert = '\t\t\t\t' + file_str + '_path = mnt_dir_ ;\n' + else: + to_insert = '\t\t\t\t' + file_str + '_path = mnt_dir_' + ' + "/' + line + '";\n' + + contents.insert(index_map['setup'], to_insert) + + #Initialize paths in run phase + updateRunMap(index_map, 1) + file_str = '' + if len(line.split('/')) != 1 : + for i in xrange(0, len(line.split('/'))): + file_str += line.split('/')[i] + else: + file_str = line.split('/')[-1] + + if file_str == 'test': + to_insert = '\t\t\t\t' + file_str + '_path = mnt_dir_ ;\n' + else: + to_insert = '\t\t\t\t' + file_str + '_path = mnt_dir_' + ' + "/' + line + '";\n' + contents.insert(index_map['run'], to_insert) + + #Initialize paths in check phase + updateCheckMap(index_map, 1) + file_str = '' + if len(line.split('/')) != 1 : + for i in xrange(0, len(line.split('/'))): + file_str += line.split('/')[i] + else: + file_str = line.split('/')[-1] + + if file_str == 'test': + to_insert = '\t\t\t\t' + file_str + '_path = mnt_dir_ ;\n' + else: + to_insert = '\t\t\t\t' + file_str + '_path = mnt_dir_' + ' + "/' + line + '";\n' + contents.insert(index_map['check'], to_insert) + + #Update defines portion + #Get only the file name. We don't want the path here + updateDefineMap(index_map, 1) + file_str = '' + if len(line.split('/')) != 1 : + for i in xrange(0, len(line.split('/'))): + file_str += line.split('/')[i] + else: + file_str = line.split('/')[-1] + to_insert = '\t\t\t string ' + file_str + '_path; \n' + + contents.insert(index_map['define'], to_insert) + + define.seek(0) + define.writelines(contents) + define.close() + + +def insertFalloc(contents, line, index_map, method): + + to_insert = '\n\t\t\t\tif ( fallocate( fd_' + line.split(' ')[1] + ' , ' + line.split(' ')[2] + ' , ' + line.split(' ')[3] + ' , ' + line.split(' ')[4] + ') < 0){ \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] +');\n\t\t\t\t\t return errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 5) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 5) + +def insertSyncRange(contents, line, index_map, method): + + to_insert = '\n\t\t\t\tif ( cm_->CmSyncFileRange( fd_' + line.split(' ')[1] + ' , ' + line.split(' ')[2] + ' , ' + line.split(' ')[3] + ' , SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE|SYNC_FILE_RANGE_WAIT_AFTER) < 0){ \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] +');\n\t\t\t\t\t return errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 5) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 5) + + +def insertMkdir(contents, line, index_map, method): + + to_insert = '\n\t\t\t\tif ( mkdir(' + line.split(' ')[1] + '_path.c_str() , ' + line.split(' ')[2] + ') < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + + +def insertOpenFile(contents, line, index_map, method): + + name = 'fd_' + line.split(' ')[1] + decl = ' ' + if name not in redeclare_map: + decl = 'int ' + redeclare_map[name] = 1 + + # TODO: prevent redeclations here + to_insert = '\n\t\t\t\t' + decl + 'fd_' + line.split(' ')[1] + ' = cm_->CmOpen(' + line.split(' ')[1] + '_path.c_str() , ' + line.split(' ')[2] + ' , ' + line.split(' ')[3] + '); \n\t\t\t\tif ( fd_' + line.split(' ')[1] + ' < 0 ) { \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] + '); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 6) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 6) + +def insertMknodFile(contents, line, index_map, method): + + name = 'fd_' + line.split(' ')[1] + decl = ' ' + if name not in redeclare_map: + decl = 'int ' + redeclare_map[name] = 1 + + # TODO: prevent redeclations here + to_insert = '\n\t\t\t\t' + decl + 'fd_' + line.split(' ')[1] + ' = mknod(' + line.split(' ')[1] + '_path.c_str() , ' + line.split(' ')[2] + ' , ' + line.split(' ')[3] + '); \n\t\t\t\tif ( fd_' + line.split(' ')[1] + ' < 0 ) { \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] + '); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 6) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 6) + +def insertOpenDir(contents, line, index_map, method): + + name = 'fd_' + line.split(' ')[1] + decl = ' ' + if name not in redeclare_map: + decl = 'int ' + redeclare_map[name] = 1 + + # TODO: prevent redeclations here + to_insert = '\n\t\t\t\t' + decl + 'fd_' + line.split(' ')[1] + ' = cm_->CmOpen(' + line.split(' ')[1] + '_path.c_str() , O_DIRECTORY , ' + line.split(' ')[2] + '); \n\t\t\t\tif ( fd_' + line.split(' ')[1] + ' < 0 ) { \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] + '); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 6) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 6) + + +def insertRemoveFile(contents,option, line, index_map, method): + + to_insert = '\n\t\t\t\tif ( '+ option +'(' + line.split(' ')[1] + '_path.c_str() ) < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + +def insertTruncateFile(contents, line, index_map, method): + + to_insert = '\n\t\t\t\tif ( truncate (' + line.split(' ')[1] + '_path.c_str(), ' + line.split(' ')[2] + ') < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + +def insertClose(contents, line, index_map, method): + to_insert = '\n\t\t\t\tif ( cm_->CmClose ( fd_' + line.split(' ')[1] + ') < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + +def insertFsync(contents, option, line, index_map, method): + if option == 'fsync': + ins = 'cm_->CmFsync' + elif option == 'fdatasync': + ins = 'cm_->CmFdatasync' + + to_insert = '\n\t\t\t\tif ( ' + ins + '( fd_' + line.split(' ')[1] + ') < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + +def insertSync(contents, line, index_map, method): + to_insert = '\n\t\t\t\tcm_->CmSync(); \n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 2) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 2) + + +def insertLink(contents, option, line, index_map, method): + to_insert = '\n\t\t\t\tif ( ' + option + '(' + line.split(' ')[1] + '_path.c_str() , '+ line.split(' ')[2] + '_path.c_str() '+ ') < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + +#def insertCheckpoint(contents, line, index_map, method): +# +# to_insert = '\n\t\t\t\tif ( Checkpoint() < 0){ \n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\tlocal_checkpoint += 1; \n\t\t\t\tif (local_checkpoint == checkpoint) { \n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\n' +# +# if method == 'setup': +# contents.insert(index_map['setup'], to_insert) +# updateSetupMap(index_map, 8) +# else: +# contents.insert(index_map['run'], to_insert) +# updateRunMap(index_map, 8) + +def insertCheckpoint(contents, line, index_map, method): + + to_insert = '\n\t\t\t\tif ( cm_->CmCheckpoint() < 0){ \n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\tlocal_checkpoint += 1; \n\t\t\t\tif (local_checkpoint == checkpoint) { \n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + +def insertRename(contents, line, index_map, method): + to_insert = '\n\t\t\t\tif ( ' + line.split(' ')[0] + '(' + line.split(' ')[1] + '_path.c_str() , '+ line.split(' ')[2] + '_path.c_str() '+ ') < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + +def insertFsetxattr(contents, line, index_map, method): + to_insert = '\n\t\t\t\tif ( ' + line.split(' ')[0] + '( fd_' + line.split(' ')[1] + ', \"user.xattr1\", \"val1 \", 4, 0 ) < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + +def insertRemovexattr(contents, line, index_map, method): + to_insert = '\n\t\t\t\tif ( ' + line.split(' ')[0] + '(' + line.split(' ')[1] + '_path.c_str() , \"user.xattr1\") < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + +def insertWrite(contents, option, line, index_map, method): + if option == 'mmapwrite': + # insertFalloc(contents, '0', line, index_map, method) + name = 'filep_' + line.split(' ')[1] + decl = ' ' + data_decl = ' ' + text_decl = ' ' + + + if name not in redeclare_map: + decl = 'int ' + filep_decl = 'char *' + data_decl = 'void* data_' +line.split(' ')[1] + ';' + text_decl = 'const char *text_' + line.split(' ')[1] +' = \"abcdefghijklmnopqrstuvwxyz123456\";' + redeclare_map[name] = 1 + +# to_insert = '\n\t\t\t\tif ( fallocate( fd_' + line.split(' ')[1] + ' , 0 , ' + line.split(' ')[2] + ' , ' + line.split(' ')[3] + ') < 0){ \n\t\t\t\t\t close( fd_' + line.split(' ')[1] +');\n\t\t\t\t\t return errno;\n\t\t\t\t}\n\t\t\t\tif ( WriteDataMmap( fd_' + line.split(' ')[1] + ', ' + line.split(' ')[2] + ', ' + line.split(' ')[3] + ') < 0){ \n\t\t\t\t\tclose( fd_' + line.split(' ')[1] + '); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + to_insert = '\n\t\t\t\tif ( fallocate( fd_' + line.split(' ')[1] + ' , 0 , ' + line.split(' ')[2] + ' , ' + line.split(' ')[3] + ') < 0){ \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] +');\n\t\t\t\t\t return errno;\n\t\t\t\t}\n\t\t\t\t' + filep_decl + 'filep_' + line.split(' ')[1] + ' = (char *) cm_->CmMmap(NULL, ' + line.split(' ')[3] +', PROT_WRITE|PROT_READ, MAP_SHARED, fd_' + line.split(' ')[1] + ', ' + line.split(' ')[2] + ');\n\t\t\t\tif (filep_' + line.split(' ')[1] + ' == MAP_FAILED) {\n\t\t\t\t\t return -1;\n\t\t\t\t}\n\n\t\t\t\t' +decl+ 'offset_'+ line.split(' ')[1] +' = 0;\n\t\t\t\t' + decl +'to_write_'+line.split(' ')[1] +' = ' + line.split(' ')[3] + ' ;\n\t\t\t\t'+ text_decl+ '\n\n\t\t\t\twhile (offset_'+line.split(' ')[1]+' < '+ line.split(' ')[3] +'){\n\t\t\t\t\tif (to_write_'+ line.split(' ')[1] +' < 32){\n\t\t\t\t\t\tmemcpy(filep_'+ line.split(' ')[1]+ '+ offset_'+ line.split(' ')[1] +', text_'+ line.split(' ')[1] +', to_write_' +line.split(' ')[1]+');\n\t\t\t\t\t\toffset_'+ line.split(' ')[1]+' += to_write_'+ line.split(' ')[1] +';\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tmemcpy(filep_'+ line.split(' ')[1] +'+ offset_'+line.split(' ')[1] +',text_'+line.split(' ')[1] +', 32);\n\t\t\t\t\t\toffset_'+line.split(' ')[1] +' += 32; \n\t\t\t\t\t} \n\t\t\t\t}\n\n\t\t\t\tif ( cm_->CmMsync ( filep_' + line.split(' ')[1] + ', 4096 , MS_SYNC) < 0){\n\t\t\t\t\tcm_->CmMunmap( filep_' + line.split(' ')[1] + ', 4096); \n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\tcm_->CmMunmap( filep_' + line.split(' ')[1] + ', 4096);\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 30) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 30) + + elif option == 'write': + to_insert = '\n\t\t\t\tif ( WriteData ( fd_' + line.split(' ')[1] + ', ' + line.split(' ')[2] + ', ' + line.split(' ')[3] + ') < 0){ \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] + '); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 5) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 5) + else: + + name = 'offset_' + line.split(' ')[1] + decl = ' ' + data_decl = ' ' + text_decl = ' ' + + if name not in redeclare_map: + decl = 'int ' + data_decl = 'void* data_' +line.split(' ')[1] + ';' + text_decl = 'const char *text_' + line.split(' ')[1] +' = \"abcdefghijklmnopqrstuvwxyz123456\";' + redeclare_map[name] = 1 + + # TODO: prevent redeclations here + to_insert ='\n\t\t\t\tcm_->CmClose(fd_' + line.split(' ')[1] + '); \n\t\t\t\tfd_' + line.split(' ')[1] + ' = open(' + line.split(' ')[1] +'_path.c_str() , O_RDWR|O_DIRECT|O_SYNC , 0777); \n\t\t\t\tif ( fd_' + line.split(' ')[1] +' < 0 ) { \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] +'); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n\t\t\t\t' + data_decl+'\n\t\t\t\tif (posix_memalign(&data_' + line.split(' ')[1] +' , 4096, ' + line.split(' ')[3] +' ) < 0) {\n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n\t\t\t\t \n\t\t\t\t' +decl+ 'offset_'+ line.split(' ')[1] +' = 0;\n\t\t\t\t' + decl +'to_write_'+line.split(' ')[1] +' = ' + line.split(' ')[3] + ' ;\n\t\t\t\t'+ text_decl+ '\n\t\t\t\twhile (offset_'+line.split(' ')[1]+' < '+ line.split(' ')[3] +'){\n\t\t\t\t\tif (to_write_'+ line.split(' ')[1] +' < 32){\n\t\t\t\t\t\tmemcpy((char *)data_'+ line.split(' ')[1]+ '+ offset_'+ line.split(' ')[1] +', text_'+ line.split(' ')[1] +', to_write_' +line.split(' ')[1]+');\n\t\t\t\t\t\toffset_'+ line.split(' ')[1]+' += to_write_'+ line.split(' ')[1] +';\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tmemcpy((char *)data_'+ line.split(' ')[1] +'+ offset_'+line.split(' ')[1] +',text_'+line.split(' ')[1] +', 32);\n\t\t\t\t\t\toffset_'+line.split(' ')[1] +' += 32; \n\t\t\t\t\t} \n\t\t\t\t} \n\n\t\t\t\tif ( pwrite ( fd_' + line.split(' ')[1] + ', data_'+ line.split(' ')[1] + ', ' + line.split(' ')[3] + ', ' + line.split(' ')[2] +') < 0){\n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] + '); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 31) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 31) + + +# Insert a function in 'line' into 'file' at location specified by 'index_map' in the specified 'method' +# If the workload has functions with various possible paramter options, the 'permutation' defines the set of +# paramters to be set in this file. + +def insertFunctions(line, file, index_map, method): + with open(file, 'r+') as insert: + + contents = insert.readlines() + + + if line.split(' ')[0] == 'falloc': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + + insertFalloc(contents, line, index_map, method) + if line.split(' ')[-2] == 'addToSetup': + line = line.replace(line.split(' ')[1], line.split(' ')[-1], 1) + insertFalloc(contents, line, index_map, 'setup') + + elif line.split(' ')[0] == 'mkdir': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertMkdir(contents, line, index_map, method) + + elif line.split(' ')[0] == 'mknod': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertMknodFile(contents, line, index_map, method) + + + elif line.split(' ')[0] == 'open': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertOpenFile(contents, line, index_map, method) + + elif line.split(' ')[0] == 'opendir': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertOpenDir(contents, line, index_map, method) + + elif line.split(' ')[0] == 'remove' or line.split(' ')[0] == 'unlink': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + option = line.split(' ')[0] + insertRemoveFile(contents, option, line, index_map, method) + + elif line.split(' ')[0] == 'close': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertClose(contents, line, index_map, method) + + elif line.split(' ')[0] == 'truncate': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertTruncateFile(contents, line, index_map, method) + + elif line.split(' ')[0] == 'syncrange': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertSyncRange(contents, line, index_map, method) + + + elif line.split(' ')[0] == 'fsync' or line.split(' ')[0] == 'fdatasync': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + option = line.split(' ')[0] + insertFsync(contents, option, line, index_map, method) + + elif line.split(' ')[0] == 'sync': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertSync(contents, line, index_map, method) + + elif line.split(' ')[0] == 'checkpoint': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertCheckpoint(contents, line, index_map, method) + + elif line.split(' ')[0] == 'rename': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertRename(contents, line, index_map, method) + + elif line.split(' ')[0] == 'fsetxattr': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertFsetxattr(contents, line, index_map, method) + + elif line.split(' ')[0] == 'removexattr': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertRemovexattr(contents, line, index_map, method) + + elif line.split(' ')[0] == 'link' or line.split(' ')[0] == 'symlink': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + option = line.split(' ')[0] + insertLink(contents, option, line, index_map, method) + + elif line.split(' ')[0] == 'write' or line.split(' ')[0] == 'dwrite' or line.split(' ')[0] == 'mmapwrite': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + option = line.split(' ')[0] + insertWrite(contents, option, line, index_map, method) + + elif line.split(' ')[0] == 'none': + pass +# if method == 'setup': +# updateSetupMap(index_map, 1) +# else: +# updateRunMap(index_map, 1) +# #we know this can be only in run +# contents.insert(index_map['run'], '\t\t\t\t return 1;\n') +# updateRunMap(index_map, -1) + + insert.seek(0) + insert.writelines(contents) + insert.close() + + + + +#def hasVariation(keyword): +# if keyword in ['fsync', 'fdatasync', 'falloc', 'remove', 'unlink', 'link', 'symlink', 'write']: +# return True +# +#def buildTuple(command): +# if command == 'fsync' or command == 'fdatasync' : +# d = tuple(FsyncOptions) +# elif command == 'falloc': +# d = tuple(FallocOptions) +# elif command == 'remove' or command == 'unlink': +# d = tuple(RemoveOptions) +# elif command == 'link' or command == 'symlink': +# d = tuple(LinkOptions) +# elif command == 'write': +# d = tuple(WriteOptions) +# else: +# d=() +# return d + + + +def main(): + + #open log file +# log_file = time.strftime('%Y%m%d_%H%M%S') + '-workloadGen.log' +# log_file_handle = open(log_file, 'w') + + #Parse input args + parsed_args = build_parser().parse_args() + + #Print the test setup - just for sanity + # base_test = 'code/tests/base_test.cpp' +# print_setup(parsed_args) + + + #check if test file exists + if not os.path.exists(parsed_args.test_file) or not os.path.isfile(parsed_args.test_file): + print parsed_args.test_file + ' : No such test file\n' + exit(1) + + #Create the target directory + create_dir(parsed_args.target_path) + + #Create a pre-populated dictionary of replacable operations + operation_map = create_dict() + + #Copy base file to target path + base_test = parsed_args.base_file + base_file = parsed_args.target_path + "/" + base_test.split('/')[-1] + # copyfile(base_test, base_file) + test_file = parsed_args.test_file + + index_map = {'define' : 0, 'setup' : 0, 'run' : 0, 'check' : 0} + + #iterate through the base file and populate these values + index = 0 + with open(base_file, 'r') as f: + contents = f.readlines() + for index, line in enumerate(contents): + index += 1 + line = line.strip() + if line.find('setup') != -1: + if line.split(' ')[2] == 'setup()': + index_map['setup'] = index + elif line.find('run') != -1: + if line.split(' ')[2] == 'run(': + index_map['run'] = index + elif line.find('check_test') != -1: + if line.split(' ')[2] == 'check_test(': + index_map['check'] = index + elif line.find('private') != -1: + if line.split(' ')[0] == 'private:': + index_map['define'] = index + f.close() + + +# #Iterate through the lang spec and identify all possible lines that have alternative parameter options +# done_list = [] +# with open(test_file, 'r') as f: +# for line in f: +# +# #ignore newlines +# if line.split(' ')[0] == '\n': +# continue +# +# #Remove leading, trailing spaces +# line = line.strip() +# +# #if the line starts with #, it indicates which region of base file to populate and skip this line +# if line.split(' ')[0] == '#' : +# method = line.strip().split()[-1] +# continue +# +# if hasVariation(line.split(' ')[0] ) is True: +# d = buildTuple(line.split(' ')[0]) +# done_list.append(d) +# +# +# f.close() +# +# count = 0 +# permutations = [] +# for i in itertools.product(*done_list): +# permutations.append(i) +# count +=1 +# +# print 'Total files being created = ', count + + +# #Now populate count num of files +# val = 0 +# for permutation in permutations: + + val = 0 + new_file = test_file + "_" + parsed_args.output_name + ".cpp" + new_file = parsed_args.target_path + new_file + copyfile(base_file, new_file) + + new_index_map = index_map.copy() +# log = ' ,'.join(permutation); +# log = `val` + ' : ' + log + '\n' +# log_file_handle.write(log) + #Iterate through test file and fill up method by method + with open(test_file, 'r') as f: + iter = 0 + for line in f: + + #ignore newlines + if line.split(' ')[0] == '\n': + continue + + #Remove leading, trailing spaces + line = line.strip() + + #if the line starts with #, it indicates which region of base file to populate and skip this line + if line.split(' ')[0] == '#' : + method = line.strip().split()[-1] + continue + + if method == 'define': + insertDefine(line, new_file, new_index_map) + + elif method == 'declare': + insertDeclare(line, new_file, new_index_map) + + elif (method == 'setup' or method == 'run'): + op_map={} + insertFunctions(line, new_file, new_index_map, method) + + f.close() + val += 1 + + +# log_file_handle.close() + + +if __name__ == '__main__': + main() diff --git a/ace/specific_generator_scripts/workload_seq2.py b/ace/specific_generator_scripts/workload_seq2.py new file mode 100755 index 0000000..5963863 --- /dev/null +++ b/ace/specific_generator_scripts/workload_seq2.py @@ -0,0 +1,760 @@ +#!/usr/bin/env python + +#To run : python workload.py -b code/tests/generic_039/base_test.cpp -t code/tests/generic_039/generic_039 -p code/tests/generic_039 +import os +import re +import sys +import stat +import subprocess +import argparse +import time +import itertools +from shutil import copyfile +from string import maketrans + + +#All functions that has options go here +FallocOptions = ['FALLOC_FL_ZERO_RANGE','FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE','FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE', '0', 'FALLOC_FL_KEEP_SIZE'] + +FsyncOptions = ['fsync','fdatasync'] + +RemoveOptions = ['remove','unlink'] + +LinkOptions = ['link','symlink'] + +WriteOptions = ['WriteData','WriteDataMmap', 'pwrite'] + +redeclare_map = {} + +def build_parser(): + parser = argparse.ArgumentParser(description='Workload Generator for XFSMonkey v1.0') + + # global args + parser.add_argument('--base_file', '-b', default='', help='Base test file to generate workload') + parser.add_argument('--test_file', '-t', default='', help='J lang test skeleton to generate workload') + + # crash monkey args + parser.add_argument('--target_path', '-p', default='code/tests/', help='Directory to save the generated test files') + + parser.add_argument('--output_name', '-o', default='file', help='Name of the generated file') + return parser + + +def print_setup(parsed_args): + print '\n{: ^50s}'.format('XFSMonkey Workload generatorv0.1\n') + print '='*20, 'Setup' , '='*20, '\n' + print '{0:20} {1}'.format('Base test file', parsed_args.base_file) + print '{0:20} {1}'.format('Test skeleton', parsed_args.test_file) + print '{0:20} {1}'.format('Target directory', parsed_args.target_path) + print '{0:20} {1}'.format('Output file', parsed_args.output_name) + print '\n', '='*48, '\n' + + +def create_dir(dir_path): + try: + os.makedirs(dir_path) + except OSError: + if not os.path.isdir(dir_path): + raise + +def create_dict(): + operation_map = {'fsync': 0, 'fallocate': 0, 'open': 0, 'remove': 0} + return operation_map + + +#These maps keep track of the line number in each method, to add the next function to in the C++ file +def updateSetupMap(index_map, num): + index_map['setup'] += num + index_map['run'] += num + index_map['check'] += num + index_map['define'] += num + +def updateRunMap(index_map, num): + index_map['run'] += num + index_map['check'] += num + index_map['define'] += num + +def updateCheckMap(index_map, num): + index_map['check'] += num + index_map['define'] += num + +def updateDefineMap(index_map, num): + index_map['define'] += num + + + +def insertDeclare(line, file, index_map): + + with open(file, 'r+') as declare: + contents = declare.readlines() + + updateRunMap(index_map, 1) + + to_insert = '\t\t\t\tint ' + line + ' = 0 ;\n' + contents.insert(index_map['run'], to_insert) + + declare.seek(0) + declare.writelines(contents) + declare.close() + + +# Add the 'line' which declares a file/dir used in the workload into the 'file' +# at position specified in the 'index_map' +def insertDefine(line, file, index_map): + with open(file, 'r+') as define: + + contents = define.readlines() + + #Initialize paths in setup phase + updateSetupMap(index_map, 1) + file_str = '' + if len(line.split('/')) != 1 : + for i in xrange(0, len(line.split('/'))): + file_str += line.split('/')[i] + else: + file_str = line.split('/')[-1] + + if file_str == 'test': + to_insert = '\t\t\t\t' + file_str + '_path = mnt_dir_ ;\n' + else: + to_insert = '\t\t\t\t' + file_str + '_path = mnt_dir_' + ' + "/' + line + '";\n' + + contents.insert(index_map['setup'], to_insert) + + #Initialize paths in run phase + updateRunMap(index_map, 1) + file_str = '' + if len(line.split('/')) != 1 : + for i in xrange(0, len(line.split('/'))): + file_str += line.split('/')[i] + else: + file_str = line.split('/')[-1] + + if file_str == 'test': + to_insert = '\t\t\t\t' + file_str + '_path = mnt_dir_ ;\n' + else: + to_insert = '\t\t\t\t' + file_str + '_path = mnt_dir_' + ' + "/' + line + '";\n' + contents.insert(index_map['run'], to_insert) + + #Initialize paths in check phase + updateCheckMap(index_map, 1) + file_str = '' + if len(line.split('/')) != 1 : + for i in xrange(0, len(line.split('/'))): + file_str += line.split('/')[i] + else: + file_str = line.split('/')[-1] + + if file_str == 'test': + to_insert = '\t\t\t\t' + file_str + '_path = mnt_dir_ ;\n' + else: + to_insert = '\t\t\t\t' + file_str + '_path = mnt_dir_' + ' + "/' + line + '";\n' + contents.insert(index_map['check'], to_insert) + + #Update defines portion + #Get only the file name. We don't want the path here + updateDefineMap(index_map, 1) + file_str = '' + if len(line.split('/')) != 1 : + for i in xrange(0, len(line.split('/'))): + file_str += line.split('/')[i] + else: + file_str = line.split('/')[-1] + to_insert = '\t\t\t string ' + file_str + '_path; \n' + + contents.insert(index_map['define'], to_insert) + + define.seek(0) + define.writelines(contents) + define.close() + + +def insertFalloc(contents, line, index_map, method): + + to_insert = '\n\t\t\t\tif ( fallocate( fd_' + line.split(' ')[1] + ' , ' + line.split(' ')[2] + ' , ' + line.split(' ')[3] + ' , ' + line.split(' ')[4] + ') < 0){ \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] +');\n\t\t\t\t\t return errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 5) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 5) + +def insertMkdir(contents, line, index_map, method): + + to_insert = '\n\t\t\t\tif ( mkdir(' + line.split(' ')[1] + '_path.c_str() , ' + line.split(' ')[2] + ') < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + + +def insertOpenFile(contents, line, index_map, method): + + name = 'fd_' + line.split(' ')[1] + decl = ' ' + if name not in redeclare_map: + decl = 'int ' + redeclare_map[name] = 1 + + # TODO: prevent redeclations here + to_insert = '\n\t\t\t\t' + decl + 'fd_' + line.split(' ')[1] + ' = cm_->CmOpen(' + line.split(' ')[1] + '_path.c_str() , ' + line.split(' ')[2] + ' , ' + line.split(' ')[3] + '); \n\t\t\t\tif ( fd_' + line.split(' ')[1] + ' < 0 ) { \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] + '); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 6) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 6) + +def insertMknodFile(contents, line, index_map, method): + + name = 'fd_' + line.split(' ')[1] + decl = ' ' + if name not in redeclare_map: + decl = 'int ' + redeclare_map[name] = 1 + + # TODO: prevent redeclations here + to_insert = '\n\t\t\t\t' + decl + 'fd_' + line.split(' ')[1] + ' = mknod(' + line.split(' ')[1] + '_path.c_str() , ' + line.split(' ')[2] + ' , ' + line.split(' ')[3] + '); \n\t\t\t\tif ( fd_' + line.split(' ')[1] + ' < 0 ) { \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] + '); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 6) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 6) + +def insertOpenDir(contents, line, index_map, method): + + name = 'fd_' + line.split(' ')[1] + decl = ' ' + if name not in redeclare_map: + decl = 'int ' + redeclare_map[name] = 1 + + # TODO: prevent redeclations here + to_insert = '\n\t\t\t\t' + decl + 'fd_' + line.split(' ')[1] + ' = cm_->CmOpen(' + line.split(' ')[1] + '_path.c_str() , O_DIRECTORY , ' + line.split(' ')[2] + '); \n\t\t\t\tif ( fd_' + line.split(' ')[1] + ' < 0 ) { \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] + '); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 6) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 6) + + +def insertRemoveFile(contents,option, line, index_map, method): + + to_insert = '\n\t\t\t\tif ( '+ option +'(' + line.split(' ')[1] + '_path.c_str() ) < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + +def insertTruncateFile(contents, line, index_map, method): + + to_insert = '\n\t\t\t\tif ( truncate (' + line.split(' ')[1] + '_path.c_str(), ' + line.split(' ')[2] + ') < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + +def insertClose(contents, line, index_map, method): + to_insert = '\n\t\t\t\tif ( cm_->CmClose ( fd_' + line.split(' ')[1] + ') < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + +def insertRmdir(contents, line, index_map, method): + to_insert = '\n\t\t\t\tif ( ' + line.split(' ')[0] + '(' + line.split(' ')[1] + '_path.c_str()) < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + +def insertFsync(contents, option, line, index_map, method): + if option == 'fsync': + ins = 'cm_->CmFsync' + elif option == 'fdatasync': + ins = 'cm_->CmFdatasync' + + to_insert = '\n\t\t\t\tif ( ' + ins + '( fd_' + line.split(' ')[1] + ') < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + +def insertSync(contents, line, index_map, method): + to_insert = '\n\t\t\t\tcm_->CmSync(); \n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 2) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 2) + + +def insertLink(contents, option, line, index_map, method): + to_insert = '\n\t\t\t\tif ( ' + option + '(' + line.split(' ')[1] + '_path.c_str() , '+ line.split(' ')[2] + '_path.c_str() '+ ') < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + +#def insertCheckpoint(contents, line, index_map, method): +# +# to_insert = '\n\t\t\t\tif ( Checkpoint() < 0){ \n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\tlocal_checkpoint += 1; \n\t\t\t\tif (local_checkpoint == checkpoint) { \n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\n' +# +# if method == 'setup': +# contents.insert(index_map['setup'], to_insert) +# updateSetupMap(index_map, 8) +# else: +# contents.insert(index_map['run'], to_insert) +# updateRunMap(index_map, 8) + +def insertCheckpoint(contents, line, index_map, method): + + to_insert = '\n\t\t\t\tif ( cm_->CmCheckpoint() < 0){ \n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\tlocal_checkpoint += 1; \n\t\t\t\tif (local_checkpoint == checkpoint) { \n\t\t\t\t\treturn '+ line.split(' ')[1] + ';\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 8) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 8) + + +def insertRename(contents, line, index_map, method): + to_insert = '\n\t\t\t\tif ( cm_->CmRename (' + line.split(' ')[1] + '_path.c_str() , '+ line.split(' ')[2] + '_path.c_str() '+ ') < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + +def insertFsetxattr(contents, line, index_map, method): + to_insert = '\n\t\t\t\tif ( ' + line.split(' ')[0] + '( fd_' + line.split(' ')[1] + ', \"user.xattr1\", \"val1 \", 4, 0 ) < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + +def insertRemovexattr(contents, line, index_map, method): + to_insert = '\n\t\t\t\tif ( ' + line.split(' ')[0] + '(' + line.split(' ')[1] + '_path.c_str() , \"user.xattr1\") < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + +def insertWrite(contents, option, line, index_map, method): + if option == 'mmapwrite': + name = 'filep_' + line.split(' ')[1] + decl = ' ' + data_decl = ' ' + text_decl = ' ' + filep_decl = ' ' + + + if name not in redeclare_map: + decl = 'int ' + filep_decl = 'char *' + data_decl = 'void* mdata_' +line.split(' ')[1] + ';' + text_decl = 'const char *mtext_' + line.split(' ')[1] +' = \"mmmmmmmmmmklmnopqrstuvwxyz123456\";' + redeclare_map[name] = 1 + + + to_insert = '\n\t\t\t\tif ( fallocate( fd_' + line.split(' ')[1] + ' , 0 , ' + line.split(' ')[2] + ' , ' + line.split(' ')[3] + ') < 0){ \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] +');\n\t\t\t\t\t return errno;\n\t\t\t\t}\n\t\t\t\t' + filep_decl + 'filep_' + line.split(' ')[1] + ' = (char *) cm_->CmMmap(NULL, ' + line.split(' ')[3] + ' + ' + line.split(' ')[2] +', PROT_WRITE|PROT_READ, MAP_SHARED, fd_' + line.split(' ')[1] + ', 0);\n\t\t\t\tif (filep_' + line.split(' ')[1] + ' == MAP_FAILED) {\n\t\t\t\t\t return -1;\n\t\t\t\t}\n\n\t\t\t\t' +decl+ 'moffset_'+ line.split(' ')[1] +' = 0;\n\t\t\t\t' + decl +'to_write_'+line.split(' ')[1] +' = ' + line.split(' ')[3] + ' ;\n\t\t\t\t'+ text_decl+ '\n\n\t\t\t\twhile (moffset_'+line.split(' ')[1]+' < '+ line.split(' ')[3] +'){\n\t\t\t\t\tif (to_write_'+ line.split(' ')[1] +' < 32){\n\t\t\t\t\t\tmemcpy(filep_'+ line.split(' ')[1]+ ' + ' + line.split(' ')[2] + ' + moffset_'+ line.split(' ')[1] +', mtext_'+ line.split(' ')[1] +', to_write_' +line.split(' ')[1]+');\n\t\t\t\t\t\tmoffset_'+ line.split(' ')[1]+' += to_write_'+ line.split(' ')[1] +';\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tmemcpy(filep_'+ line.split(' ')[1] + ' + ' + line.split(' ')[2] + ' + moffset_' +line.split(' ')[1] + ',mtext_'+line.split(' ')[1] + ', 32);\n\t\t\t\t\t\tmoffset_'+line.split(' ')[1] +' += 32; \n\t\t\t\t\t} \n\t\t\t\t}\n\n\t\t\t\tif ( cm_->CmMsync ( filep_' + line.split(' ')[1] + ' + ' + line.split(' ')[2] + ', 8192 , MS_SYNC) < 0){\n\t\t\t\t\tcm_->CmMunmap( filep_' + line.split(' ')[1] + ',' + line.split(' ')[2] + ' + ' + line.split(' ')[3] +'); \n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\tcm_->CmMunmap( filep_' + line.split(' ')[1] + ' , ' + line.split(' ')[2] + ' + ' + line.split(' ')[3] +');\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 30) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 30) + + + + elif option == 'write': + to_insert = '\n\t\t\t\tif ( WriteData ( fd_' + line.split(' ')[1] + ', ' + line.split(' ')[2] + ', ' + line.split(' ')[3] + ') < 0){ \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] + '); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 5) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 5) + else: + + name = 'offset_' + line.split(' ')[1] + decl = ' ' + data_decl = ' ' + text_decl = ' ' + + if name not in redeclare_map: + decl = 'int ' + data_decl = 'void* data_' +line.split(' ')[1] + ';' + text_decl = 'const char *text_' + line.split(' ')[1] +' = \"ddddddddddklmnopqrstuvwxyz123456\";' + redeclare_map[name] = 1 + + # TODO: prevent redeclations here + to_insert ='\n\t\t\t\tcm_->CmClose(fd_' + line.split(' ')[1] + '); \n\t\t\t\tfd_' + line.split(' ')[1] + ' = cm_->CmOpen(' + line.split(' ')[1] +'_path.c_str() , O_RDWR|O_DIRECT|O_SYNC , 0777); \n\t\t\t\tif ( fd_' + line.split(' ')[1] +' < 0 ) { \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] +'); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n\t\t\t\t' + data_decl+'\n\t\t\t\tif (posix_memalign(&data_' + line.split(' ')[1] +' , 4096, ' + line.split(' ')[3] +' ) < 0) {\n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n\t\t\t\t \n\t\t\t\t' +decl+ 'offset_'+ line.split(' ')[1] +' = 0;\n\t\t\t\t' + decl +'to_write_'+line.split(' ')[1] +' = ' + line.split(' ')[3] + ' ;\n\t\t\t\t'+ text_decl+ '\n\t\t\t\twhile (offset_'+line.split(' ')[1]+' < '+ line.split(' ')[3] +'){\n\t\t\t\t\tif (to_write_'+ line.split(' ')[1] +' < 32){\n\t\t\t\t\t\tmemcpy((char *)data_'+ line.split(' ')[1]+ '+ offset_'+ line.split(' ')[1] +', text_'+ line.split(' ')[1] +', to_write_' +line.split(' ')[1]+');\n\t\t\t\t\t\toffset_'+ line.split(' ')[1]+' += to_write_'+ line.split(' ')[1] +';\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tmemcpy((char *)data_'+ line.split(' ')[1] +'+ offset_'+line.split(' ')[1] +',text_'+line.split(' ')[1] +', 32);\n\t\t\t\t\t\toffset_'+line.split(' ')[1] +' += 32; \n\t\t\t\t\t} \n\t\t\t\t} \n\n\t\t\t\tif ( pwrite ( fd_' + line.split(' ')[1] + ', data_'+ line.split(' ')[1] + ', ' + line.split(' ')[3] + ', ' + line.split(' ')[2] +') < 0){\n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] + '); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\t\t\t\tcm_->CmClose(fd_' + line.split(' ')[1] + ');\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 32) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 32) + + +# Insert a function in 'line' into 'file' at location specified by 'index_map' in the specified 'method' +# If the workload has functions with various possible paramter options, the 'permutation' defines the set of +# paramters to be set in this file. + +def insertFunctions(line, file, index_map, method): + with open(file, 'r+') as insert: + + contents = insert.readlines() + + + if line.split(' ')[0] == 'falloc': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + + insertFalloc(contents, line, index_map, method) + if line.split(' ')[-2] == 'addToSetup': + line = line.replace(line.split(' ')[1], line.split(' ')[-1], 1) + insertFalloc(contents, line, index_map, 'setup') + + elif line.split(' ')[0] == 'mkdir': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertMkdir(contents, line, index_map, method) + + elif line.split(' ')[0] == 'mknod': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertMknodFile(contents, line, index_map, method) + + + elif line.split(' ')[0] == 'open': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertOpenFile(contents, line, index_map, method) + + elif line.split(' ')[0] == 'opendir': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertOpenDir(contents, line, index_map, method) + + elif line.split(' ')[0] == 'remove' or line.split(' ')[0] == 'unlink': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + option = line.split(' ')[0] + insertRemoveFile(contents, option, line, index_map, method) + + elif line.split(' ')[0] == 'close': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertClose(contents, line, index_map, method) + + elif line.split(' ')[0] == 'rmdir': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertRmdir(contents, line, index_map, method) + + elif line.split(' ')[0] == 'truncate': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertTruncateFile(contents, line, index_map, method) + + elif line.split(' ')[0] == 'fsync' or line.split(' ')[0] == 'fdatasync': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + option = line.split(' ')[0] + insertFsync(contents, option, line, index_map, method) + + elif line.split(' ')[0] == 'sync': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertSync(contents, line, index_map, method) + + elif line.split(' ')[0] == 'checkpoint': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertCheckpoint(contents, line, index_map, method) + + elif line.split(' ')[0] == 'rename': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertRename(contents, line, index_map, method) + + elif line.split(' ')[0] == 'fsetxattr': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertFsetxattr(contents, line, index_map, method) + + elif line.split(' ')[0] == 'removexattr': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertRemovexattr(contents, line, index_map, method) + + elif line.split(' ')[0] == 'link' or line.split(' ')[0] == 'symlink': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + option = line.split(' ')[0] + insertLink(contents, option, line, index_map, method) + + elif line.split(' ')[0] == 'write' or line.split(' ')[0] == 'dwrite' or line.split(' ')[0] == 'mmapwrite': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + option = line.split(' ')[0] + insertWrite(contents, option, line, index_map, method) + + elif line.split(' ')[0] == 'none': + pass +# if method == 'setup': +# updateSetupMap(index_map, 1) +# else: +# updateRunMap(index_map, 1) +# #we know this can be only in run +# contents.insert(index_map['run'], '\t\t\t\t return 1;\n') +# updateRunMap(index_map, -1) + + insert.seek(0) + insert.writelines(contents) + insert.close() + + + + +#def hasVariation(keyword): +# if keyword in ['fsync', 'fdatasync', 'falloc', 'remove', 'unlink', 'link', 'symlink', 'write']: +# return True +# +#def buildTuple(command): +# if command == 'fsync' or command == 'fdatasync' : +# d = tuple(FsyncOptions) +# elif command == 'falloc': +# d = tuple(FallocOptions) +# elif command == 'remove' or command == 'unlink': +# d = tuple(RemoveOptions) +# elif command == 'link' or command == 'symlink': +# d = tuple(LinkOptions) +# elif command == 'write': +# d = tuple(WriteOptions) +# else: +# d=() +# return d + + + +def main(): + + #open log file +# log_file = time.strftime('%Y%m%d_%H%M%S') + '-workloadGen.log' +# log_file_handle = open(log_file, 'w') + + #Parse input args + parsed_args = build_parser().parse_args() + + #Print the test setup - just for sanity + # base_test = 'code/tests/base_test.cpp' +# print_setup(parsed_args) + + + #check if test file exists + if not os.path.exists(parsed_args.test_file) or not os.path.isfile(parsed_args.test_file): + print parsed_args.test_file + ' : No such test file\n' + exit(1) + + #Create the target directory + create_dir(parsed_args.target_path) + + #Create a pre-populated dictionary of replacable operations + operation_map = create_dict() + + #Copy base file to target path + base_test = parsed_args.base_file + base_file = parsed_args.target_path + "/" + base_test.split('/')[-1] + # copyfile(base_test, base_file) + test_file = parsed_args.test_file + + index_map = {'define' : 0, 'setup' : 0, 'run' : 0, 'check' : 0} + + #iterate through the base file and populate these values + index = 0 + with open(base_file, 'r') as f: + contents = f.readlines() + for index, line in enumerate(contents): + index += 1 + line = line.strip() + if line.find('setup') != -1: + if line.split(' ')[2] == 'setup()': + index_map['setup'] = index + elif line.find('run') != -1: + if line.split(' ')[2] == 'run(': + index_map['run'] = index + elif line.find('check_test') != -1: + if line.split(' ')[2] == 'check_test(': + index_map['check'] = index + elif line.find('private') != -1: + if line.split(' ')[0] == 'private:': + index_map['define'] = index + f.close() + + +# #Iterate through the lang spec and identify all possible lines that have alternative parameter options +# done_list = [] +# with open(test_file, 'r') as f: +# for line in f: +# +# #ignore newlines +# if line.split(' ')[0] == '\n': +# continue +# +# #Remove leading, trailing spaces +# line = line.strip() +# +# #if the line starts with #, it indicates which region of base file to populate and skip this line +# if line.split(' ')[0] == '#' : +# method = line.strip().split()[-1] +# continue +# +# if hasVariation(line.split(' ')[0] ) is True: +# d = buildTuple(line.split(' ')[0]) +# done_list.append(d) +# +# +# f.close() +# +# count = 0 +# permutations = [] +# for i in itertools.product(*done_list): +# permutations.append(i) +# count +=1 +# +# print 'Total files being created = ', count + + +# #Now populate count num of files +# val = 0 +# for permutation in permutations: + + val = 0 + new_file = test_file + ".cpp" + new_file = parsed_args.target_path + new_file + copyfile(base_file, new_file) + + new_index_map = index_map.copy() +# log = ' ,'.join(permutation); +# log = `val` + ' : ' + log + '\n' +# log_file_handle.write(log) + #Iterate through test file and fill up method by method + with open(test_file, 'r') as f: + iter = 0 + for line in f: + + #ignore newlines + if line.split(' ')[0] == '\n': + continue + + #Remove leading, trailing spaces + line = line.strip() + + #if the line starts with #, it indicates which region of base file to populate and skip this line + if line.split(' ')[0] == '#' : + method = line.strip().split()[-1] + continue + + if method == 'define': + insertDefine(line, new_file, new_index_map) + + elif method == 'declare': + insertDeclare(line, new_file, new_index_map) + + elif (method == 'setup' or method == 'run'): + op_map={} + insertFunctions(line, new_file, new_index_map, method) + + f.close() + val += 1 + + +# log_file_handle.close() + + +if __name__ == '__main__': + main() diff --git a/ace/specific_generator_scripts/workload_seq3.py b/ace/specific_generator_scripts/workload_seq3.py new file mode 100755 index 0000000..42cb793 --- /dev/null +++ b/ace/specific_generator_scripts/workload_seq3.py @@ -0,0 +1,802 @@ +#!/usr/bin/env python + +#To run : python workload.py -b code/tests/generic_039/base_test.cpp -t code/tests/generic_039/generic_039 -p code/tests/generic_039 +import os +import re +import sys +import stat +import subprocess +import argparse +import time +import itertools +from shutil import copyfile +from string import maketrans + + +#All functions that has options go here +FallocOptions = ['FALLOC_FL_ZERO_RANGE','FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE','FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE', '0', 'FALLOC_FL_KEEP_SIZE'] + +FsyncOptions = ['fsync','fdatasync'] + +RemoveOptions = ['remove','unlink'] + +LinkOptions = ['link','symlink'] + +WriteOptions = ['WriteData','WriteDataMmap', 'pwrite'] + +redeclare_map = {} + +def build_parser(): + parser = argparse.ArgumentParser(description='Workload Generator for XFSMonkey v1.0') + + # global args + parser.add_argument('--base_file', '-b', default='', help='Base test file to generate workload') + parser.add_argument('--test_file', '-t', default='', help='J lang test skeleton to generate workload') + + # crash monkey args + parser.add_argument('--target_path', '-p', default='code/tests/', help='Directory to save the generated test files') + + parser.add_argument('--output_name', '-o', default='file', help='Name of the generated file') + return parser + + +def print_setup(parsed_args): + print '\n{: ^50s}'.format('XFSMonkey Workload generatorv0.1\n') + print '='*20, 'Setup' , '='*20, '\n' + print '{0:20} {1}'.format('Base test file', parsed_args.base_file) + print '{0:20} {1}'.format('Test skeleton', parsed_args.test_file) + print '{0:20} {1}'.format('Target directory', parsed_args.target_path) + print '{0:20} {1}'.format('Output file', parsed_args.output_name) + print '\n', '='*48, '\n' + + +def create_dir(dir_path): + try: + os.makedirs(dir_path) + except OSError: + if not os.path.isdir(dir_path): + raise + +def create_dict(): + operation_map = {'fsync': 0, 'fallocate': 0, 'open': 0, 'remove': 0} + return operation_map + + +#These maps keep track of the line number in each method, to add the next function to in the C++ file +def updateSetupMap(index_map, num): + index_map['setup'] += num + index_map['run'] += num + index_map['check'] += num + index_map['define'] += num + +def updateRunMap(index_map, num): + index_map['run'] += num + index_map['check'] += num + index_map['define'] += num + +def updateCheckMap(index_map, num): + index_map['check'] += num + index_map['define'] += num + +def updateDefineMap(index_map, num): + index_map['define'] += num + + + +def insertDeclare(line, file, index_map): + + with open(file, 'r+') as declare: + contents = declare.readlines() + + updateRunMap(index_map, 1) + + to_insert = '\t\t\t\tint ' + line + ' = 0 ;\n' + contents.insert(index_map['run'], to_insert) + + declare.seek(0) + declare.writelines(contents) + declare.close() + + +# Add the 'line' which declares a file/dir used in the workload into the 'file' +# at position specified in the 'index_map' +def insertDefine(line, file, index_map): + with open(file, 'r+') as define: + + contents = define.readlines() + + #Initialize paths in setup phase + updateSetupMap(index_map, 1) + file_str = '' + if len(line.split('/')) != 1 : + for i in xrange(0, len(line.split('/'))): + file_str += line.split('/')[i] + else: + file_str = line.split('/')[-1] + + if file_str == 'test': + to_insert = '\t\t\t\t' + file_str + '_path = mnt_dir_ ;\n' + else: + to_insert = '\t\t\t\t' + file_str + '_path = mnt_dir_' + ' + "/' + line + '";\n' + + contents.insert(index_map['setup'], to_insert) + + #Initialize paths in run phase + updateRunMap(index_map, 1) + file_str = '' + if len(line.split('/')) != 1 : + for i in xrange(0, len(line.split('/'))): + file_str += line.split('/')[i] + else: + file_str = line.split('/')[-1] + + if file_str == 'test': + to_insert = '\t\t\t\t' + file_str + '_path = mnt_dir_ ;\n' + else: + to_insert = '\t\t\t\t' + file_str + '_path = mnt_dir_' + ' + "/' + line + '";\n' + contents.insert(index_map['run'], to_insert) + + #Initialize paths in check phase + updateCheckMap(index_map, 1) + file_str = '' + if len(line.split('/')) != 1 : + for i in xrange(0, len(line.split('/'))): + file_str += line.split('/')[i] + else: + file_str = line.split('/')[-1] + + if file_str == 'test': + to_insert = '\t\t\t\t' + file_str + '_path = mnt_dir_ ;\n' + else: + to_insert = '\t\t\t\t' + file_str + '_path = mnt_dir_' + ' + "/' + line + '";\n' + contents.insert(index_map['check'], to_insert) + + #Update defines portion + #Get only the file name. We don't want the path here + updateDefineMap(index_map, 1) + file_str = '' + if len(line.split('/')) != 1 : + for i in xrange(0, len(line.split('/'))): + file_str += line.split('/')[i] + else: + file_str = line.split('/')[-1] + to_insert = '\t\t\t string ' + file_str + '_path; \n' + + contents.insert(index_map['define'], to_insert) + + define.seek(0) + define.writelines(contents) + define.close() + + +def insertFalloc(contents, line, index_map, method): + + to_insert = '\n\t\t\t\tif ( fallocate( fd_' + line.split(' ')[1] + ' , ' + line.split(' ')[2] + ' , ' + line.split(' ')[3] + ' , ' + line.split(' ')[4] + ') < 0){ \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] +');\n\t\t\t\t\t return errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 5) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 5) + +def insertMkdir(contents, line, index_map, method): + + to_insert = '\n\t\t\t\tif ( mkdir(' + line.split(' ')[1] + '_path.c_str() , ' + line.split(' ')[2] + ') < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + + +def insertOpenFile(contents, line, index_map, method): + + name = 'fd_' + line.split(' ')[1] + decl = ' ' + if name not in redeclare_map: + decl = 'int ' + redeclare_map[name] = 1 + + # TODO: prevent redeclations here + to_insert = '\n\t\t\t\t' + decl + 'fd_' + line.split(' ')[1] + ' = cm_->CmOpen(' + line.split(' ')[1] + '_path.c_str() , ' + line.split(' ')[2] + ' , ' + line.split(' ')[3] + '); \n\t\t\t\tif ( fd_' + line.split(' ')[1] + ' < 0 ) { \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] + '); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 6) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 6) + +def insertMknodFile(contents, line, index_map, method): + + name = 'fd_' + line.split(' ')[1] + decl = ' ' + if name not in redeclare_map: + decl = 'int ' + redeclare_map[name] = 1 + + # TODO: prevent redeclations here + to_insert = '\n\t\t\t\t' + decl + 'fd_' + line.split(' ')[1] + ' = mknod(' + line.split(' ')[1] + '_path.c_str() , ' + line.split(' ')[2] + ' , ' + line.split(' ')[3] + '); \n\t\t\t\tif ( fd_' + line.split(' ')[1] + ' < 0 ) { \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] + '); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 6) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 6) + +def insertOpenDir(contents, line, index_map, method): + + name = 'fd_' + line.split(' ')[1] + decl = ' ' + if name not in redeclare_map: + decl = 'int ' + redeclare_map[name] = 1 + + # TODO: prevent redeclations here + to_insert = '\n\t\t\t\t' + decl + 'fd_' + line.split(' ')[1] + ' = cm_->CmOpen(' + line.split(' ')[1] + '_path.c_str() , O_DIRECTORY , ' + line.split(' ')[2] + '); \n\t\t\t\tif ( fd_' + line.split(' ')[1] + ' < 0 ) { \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] + '); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 6) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 6) + + +def insertRemoveFile(contents,option, line, index_map, method): + + to_insert = '\n\t\t\t\tif ( '+ option +'(' + line.split(' ')[1] + '_path.c_str() ) < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + +def insertTruncateFile(contents, line, index_map, method): + + to_insert = '\n\t\t\t\tif ( truncate (' + line.split(' ')[1] + '_path.c_str(), ' + line.split(' ')[2] + ') < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + +def insertClose(contents, line, index_map, method): + to_insert = '\n\t\t\t\tif ( cm_->CmClose ( fd_' + line.split(' ')[1] + ') < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + +def insertRmdir(contents, line, index_map, method): + to_insert = '\n\t\t\t\tif ( ' + line.split(' ')[0] + '(' + line.split(' ')[1] + '_path.c_str()) < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + +def insertFsync(contents, option, line, index_map, method): + if option == 'fsync': + ins = 'cm_->CmFsync' + elif option == 'fdatasync': + ins = 'cm_->CmFdatasync' + + to_insert = '\n\t\t\t\tif ( ' + ins + '( fd_' + line.split(' ')[1] + ') < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + +def insertSync(contents, line, index_map, method): + to_insert = '\n\t\t\t\tcm_->CmSync(); \n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 2) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 2) + + +def insertLink(contents, option, line, index_map, method): + to_insert = '\n\t\t\t\tif ( ' + option + '(' + line.split(' ')[1] + '_path.c_str() , '+ line.split(' ')[2] + '_path.c_str() '+ ') < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + +#def insertCheckpoint(contents, line, index_map, method): +# +# to_insert = '\n\t\t\t\tif ( Checkpoint() < 0){ \n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\tlocal_checkpoint += 1; \n\t\t\t\tif (local_checkpoint == checkpoint) { \n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\n' +# +# if method == 'setup': +# contents.insert(index_map['setup'], to_insert) +# updateSetupMap(index_map, 8) +# else: +# contents.insert(index_map['run'], to_insert) +# updateRunMap(index_map, 8) + +def insertCheckpoint(contents, line, index_map, method): + + to_insert = '\n\t\t\t\tif ( cm_->CmCheckpoint() < 0){ \n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\tlocal_checkpoint += 1; \n\t\t\t\tif (local_checkpoint == checkpoint) { \n\t\t\t\t\treturn '+ line.split(' ')[1] + ';\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 8) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 8) + + +def insertRename(contents, line, index_map, method): + to_insert = '\n\t\t\t\tif ( cm_->CmRename (' + line.split(' ')[1] + '_path.c_str() , '+ line.split(' ')[2] + '_path.c_str() '+ ') < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + + +def insertFsetxattr(contents, line, index_map, method): + to_insert = '\n\t\t\t\tif ( ' + line.split(' ')[0] + '( fd_' + line.split(' ')[1] + ', \"user.xattr1\", \"val1 \", 4, 0 ) < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + +def insertRemovexattr(contents, line, index_map, method): + to_insert = '\n\t\t\t\tif ( ' + line.split(' ')[0] + '(' + line.split(' ')[1] + '_path.c_str() , \"user.xattr1\") < 0){ \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 4) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 4) + +#filename, offset, length +def insertMsync(contents, option, line, index_map, method): + to_insert = '\n\t\t\t\tif ( cm_->CmMsync ( filep_' + line.split(' ')[1] + ' + ' + line.split(' ')[2] + ', ' + line.split(' ')[3] + ', MS_SYNC) < 0){\n\t\t\t\t\tcm_->CmMunmap( filep_' + line.split(' ')[1] + ',' + line.split(' ')[2] + ' + ' + line.split(' ')[3] +'); \n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 5) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 5) + +def insertMunmap(contents, option, line, index_map, method): + to_insert = '\n\t\t\t\tcm_->CmMunmap( filep_' + line.split(' ')[1] + ' , 262144);\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 2) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 2) + + + +def insertWrite(contents, option, line, index_map, method): + if option == 'mmapwrite': + name = 'moffset_' + line.split(' ')[1] + decl = ' ' + data_decl = ' ' + text_decl = ' ' + filep_decl = ' ' + mmap_decl = ' ' + + + if name not in redeclare_map: + decl = 'int ' + filep_decl = 'char *' + data_decl = 'void* mdata_' +line.split(' ')[1] + ';' + text_decl = 'const char *mtext_' + line.split(' ')[1] +' = \"mmmmmmmmmmklmnopqrstuvwxyz123456\";' + mmap_decl = filep_decl + 'filep_' + line.split(' ')[1] + ' = (char *) cm_->CmMmap(NULL, 262144, PROT_WRITE|PROT_READ, MAP_SHARED, fd_' + line.split(' ')[1] + ', 0); \t\t\t\tif (filep_' + line.split(' ')[1] + ' == MAP_FAILED) {\t\t\t\t\t return -1;\t\t\t\t}' + + redeclare_map[name] = 1 + + + to_insert = '\n\t\t\t\tif ( fallocate( fd_' + line.split(' ')[1] + ' , 0 , ' + line.split(' ')[2] + ' , ' + line.split(' ')[3] + ') < 0){ \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] +');\n\t\t\t\t\t return errno;\n\t\t\t\t}\n\t\t\t\t' + mmap_decl + '\n\n\t\t\t\t' +decl+ 'moffset_'+ line.split(' ')[1] +' = 0;\n\t\t\t\t' + decl +'m_to_write_'+line.split(' ')[1] +' = ' + line.split(' ')[3] + ' ;\n\t\t\t\t'+ text_decl+ '\n\n\t\t\t\twhile (moffset_'+line.split(' ')[1]+' < '+ line.split(' ')[3] +'){\n\t\t\t\t\tif (m_to_write_'+ line.split(' ')[1] +' < 32){\n\t\t\t\t\t\tmemcpy(filep_'+ line.split(' ')[1]+ ' + ' + line.split(' ')[2] + ' + moffset_'+ line.split(' ')[1] +', mtext_'+ line.split(' ')[1] +', m_to_write_' +line.split(' ')[1]+');\n\t\t\t\t\t\tmoffset_'+ line.split(' ')[1]+' += m_to_write_'+ line.split(' ')[1] +';\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tmemcpy(filep_'+ line.split(' ')[1] + ' + ' + line.split(' ')[2] + ' + moffset_' +line.split(' ')[1] + ',mtext_'+line.split(' ')[1] + ', 32);\n\t\t\t\t\t\tmoffset_'+line.split(' ')[1] +' += 32; \n\t\t\t\t\t} \n\t\t\t\t}\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 21) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 21) + + + + elif option == 'write': + to_insert = '\n\t\t\t\tif ( WriteData ( fd_' + line.split(' ')[1] + ', ' + line.split(' ')[2] + ', ' + line.split(' ')[3] + ') < 0){ \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] + '); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n' + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 5) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 5) + else: + + name = 'doffset_' + line.split(' ')[1] + decl = ' ' + data_decl = ' ' + text_decl = ' ' + + if name not in redeclare_map: + decl = 'int ' + data_decl = 'void* ddata_' +line.split(' ')[1] + ';' + text_decl = 'const char *dtext_' + line.split(' ')[1] +' = \"ddddddddddklmnopqrstuvwxyz123456\";' + redeclare_map[name] = 1 + + # TODO: prevent redeclations here + to_insert ='\n\t\t\t\tcm_->CmClose(fd_' + line.split(' ')[1] + '); \n\t\t\t\tfd_' + line.split(' ')[1] + ' = cm_->CmOpen(' + line.split(' ')[1] +'_path.c_str() , O_RDWR|O_DIRECT|O_SYNC , 0777); \n\t\t\t\tif ( fd_' + line.split(' ')[1] +' < 0 ) { \n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] +'); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n\t\t\t\t' + data_decl+'\n\t\t\t\tif (posix_memalign(&ddata_' + line.split(' ')[1] +' , 4096, ' + line.split(' ')[3] +' ) < 0) {\n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\n\t\t\t\t \n\t\t\t\t' +decl+ 'doffset_'+ line.split(' ')[1] +' = 0;\n\t\t\t\t' + decl +'d_to_write_'+line.split(' ')[1] +' = ' + line.split(' ')[3] + ' ;\n\t\t\t\t'+ text_decl+ '\n\t\t\t\twhile (doffset_'+line.split(' ')[1]+' < '+ line.split(' ')[3] +'){\n\t\t\t\t\tif (d_to_write_'+ line.split(' ')[1] +' < 32){\n\t\t\t\t\t\tmemcpy((char *)ddata_'+ line.split(' ')[1]+ '+ doffset_'+ line.split(' ')[1] +', dtext_'+ line.split(' ')[1] +', d_to_write_' +line.split(' ')[1]+');\n\t\t\t\t\t\tdoffset_'+ line.split(' ')[1]+' += d_to_write_'+ line.split(' ')[1] +';\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tmemcpy((char *)ddata_'+ line.split(' ')[1] +'+ doffset_'+line.split(' ')[1] +',dtext_'+line.split(' ')[1] +', 32);\n\t\t\t\t\t\tdoffset_'+line.split(' ')[1] +' += 32; \n\t\t\t\t\t} \n\t\t\t\t} \n\n\t\t\t\tif ( pwrite ( fd_' + line.split(' ')[1] + ', ddata_'+ line.split(' ')[1] + ', ' + line.split(' ')[3] + ', ' + line.split(' ')[2] +') < 0){\n\t\t\t\t\tcm_->CmClose( fd_' + line.split(' ')[1] + '); \n\t\t\t\t\treturn errno;\n\t\t\t\t}\n\t\t\t\tcm_->CmClose(fd_' + line.split(' ')[1] + ');\n\n' + + if method == 'setup': + contents.insert(index_map['setup'], to_insert) + updateSetupMap(index_map, 32) + else: + contents.insert(index_map['run'], to_insert) + updateRunMap(index_map, 32) + + +# Insert a function in 'line' into 'file' at location specified by 'index_map' in the specified 'method' +# If the workload has functions with various possible paramter options, the 'permutation' defines the set of +# paramters to be set in this file. + +def insertFunctions(line, file, index_map, method): + with open(file, 'r+') as insert: + + contents = insert.readlines() + + + if line.split(' ')[0] == 'falloc': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + + insertFalloc(contents, line, index_map, method) + if line.split(' ')[-2] == 'addToSetup': + line = line.replace(line.split(' ')[1], line.split(' ')[-1], 1) + insertFalloc(contents, line, index_map, 'setup') + + elif line.split(' ')[0] == 'mkdir': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertMkdir(contents, line, index_map, method) + + elif line.split(' ')[0] == 'mknod': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertMknodFile(contents, line, index_map, method) + + + elif line.split(' ')[0] == 'open': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertOpenFile(contents, line, index_map, method) + + elif line.split(' ')[0] == 'opendir': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertOpenDir(contents, line, index_map, method) + + elif line.split(' ')[0] == 'remove' or line.split(' ')[0] == 'unlink': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + option = line.split(' ')[0] + insertRemoveFile(contents, option, line, index_map, method) + + elif line.split(' ')[0] == 'close': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertClose(contents, line, index_map, method) + + elif line.split(' ')[0] == 'rmdir': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertRmdir(contents, line, index_map, method) + + elif line.split(' ')[0] == 'truncate': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertTruncateFile(contents, line, index_map, method) + + elif line.split(' ')[0] == 'fsync' or line.split(' ')[0] == 'fdatasync': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + option = line.split(' ')[0] + insertFsync(contents, option, line, index_map, method) + + elif line.split(' ')[0] == 'sync': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertSync(contents, line, index_map, method) + + elif line.split(' ')[0] == 'checkpoint': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertCheckpoint(contents, line, index_map, method) + + elif line.split(' ')[0] == 'rename': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertRename(contents, line, index_map, method) + + elif line.split(' ')[0] == 'fsetxattr': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertFsetxattr(contents, line, index_map, method) + + elif line.split(' ')[0] == 'removexattr': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + insertRemovexattr(contents, line, index_map, method) + + elif line.split(' ')[0] == 'link' or line.split(' ')[0] == 'symlink': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + option = line.split(' ')[0] + insertLink(contents, option, line, index_map, method) + + elif line.split(' ')[0] == 'write' or line.split(' ')[0] == 'dwrite' or line.split(' ')[0] == 'mmapwrite': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + option = line.split(' ')[0] + insertWrite(contents, option, line, index_map, method) + + elif line.split(' ')[0] == 'msync': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + option = line.split(' ')[0] + insertMsync(contents, option, line, index_map, method) + + elif line.split(' ')[0] == 'munmap': + if method == 'setup': + updateSetupMap(index_map, 1) + else: + updateRunMap(index_map, 1) + option = line.split(' ')[0] + insertMunmap(contents, option, line, index_map, method) + + elif line.split(' ')[0] == 'none': + pass +# if method == 'setup': +# updateSetupMap(index_map, 1) +# else: +# updateRunMap(index_map, 1) +# #we know this can be only in run +# contents.insert(index_map['run'], '\t\t\t\t return 1;\n') +# updateRunMap(index_map, -1) + + insert.seek(0) + insert.writelines(contents) + insert.close() + + + + +#def hasVariation(keyword): +# if keyword in ['fsync', 'fdatasync', 'falloc', 'remove', 'unlink', 'link', 'symlink', 'write']: +# return True +# +#def buildTuple(command): +# if command == 'fsync' or command == 'fdatasync' : +# d = tuple(FsyncOptions) +# elif command == 'falloc': +# d = tuple(FallocOptions) +# elif command == 'remove' or command == 'unlink': +# d = tuple(RemoveOptions) +# elif command == 'link' or command == 'symlink': +# d = tuple(LinkOptions) +# elif command == 'write': +# d = tuple(WriteOptions) +# else: +# d=() +# return d + + + +def main(): + + #open log file +# log_file = time.strftime('%Y%m%d_%H%M%S') + '-workloadGen.log' +# log_file_handle = open(log_file, 'w') + + #Parse input args + parsed_args = build_parser().parse_args() + + #Print the test setup - just for sanity + # base_test = 'code/tests/base_test.cpp' +# print_setup(parsed_args) + + + #check if test file exists + if not os.path.exists(parsed_args.test_file) or not os.path.isfile(parsed_args.test_file): + print parsed_args.test_file + ' : No such test file\n' + exit(1) + + #Create the target directory + create_dir(parsed_args.target_path) + + #Create a pre-populated dictionary of replacable operations + operation_map = create_dict() + + #Copy base file to target path + base_test = parsed_args.base_file + base_file = parsed_args.target_path + "/" + base_test.split('/')[-1] + # copyfile(base_test, base_file) + test_file = parsed_args.test_file + + index_map = {'define' : 0, 'setup' : 0, 'run' : 0, 'check' : 0} + + #iterate through the base file and populate these values + index = 0 + with open(base_file, 'r') as f: + contents = f.readlines() + for index, line in enumerate(contents): + index += 1 + line = line.strip() + if line.find('setup') != -1: + if line.split(' ')[2] == 'setup()': + index_map['setup'] = index + elif line.find('run') != -1: + if line.split(' ')[2] == 'run(': + index_map['run'] = index + elif line.find('check_test') != -1: + if line.split(' ')[2] == 'check_test(': + index_map['check'] = index + elif line.find('private') != -1: + if line.split(' ')[0] == 'private:': + index_map['define'] = index + f.close() + + +# #Iterate through the lang spec and identify all possible lines that have alternative parameter options +# done_list = [] +# with open(test_file, 'r') as f: +# for line in f: +# +# #ignore newlines +# if line.split(' ')[0] == '\n': +# continue +# +# #Remove leading, trailing spaces +# line = line.strip() +# +# #if the line starts with #, it indicates which region of base file to populate and skip this line +# if line.split(' ')[0] == '#' : +# method = line.strip().split()[-1] +# continue +# +# if hasVariation(line.split(' ')[0] ) is True: +# d = buildTuple(line.split(' ')[0]) +# done_list.append(d) +# +# +# f.close() +# +# count = 0 +# permutations = [] +# for i in itertools.product(*done_list): +# permutations.append(i) +# count +=1 +# +# print 'Total files being created = ', count + + +# #Now populate count num of files +# val = 0 +# for permutation in permutations: + + val = 0 + new_file = test_file + ".cpp" + new_file = parsed_args.target_path + new_file + copyfile(base_file, new_file) + + new_index_map = index_map.copy() +# log = ' ,'.join(permutation); +# log = `val` + ' : ' + log + '\n' +# log_file_handle.write(log) + #Iterate through test file and fill up method by method + with open(test_file, 'r') as f: + iter = 0 + for line in f: + + #ignore newlines + if line.split(' ')[0] == '\n': + continue + + #Remove leading, trailing spaces + line = line.strip() + + #if the line starts with #, it indicates which region of base file to populate and skip this line + if line.split(' ')[0] == '#' : + method = line.strip().split()[-1] + continue + + if method == 'define': + insertDefine(line, new_file, new_index_map) + + elif method == 'declare': + insertDeclare(line, new_file, new_index_map) + + elif (method == 'setup' or method == 'run'): + op_map={} + insertFunctions(line, new_file, new_index_map, method) + + f.close() + val += 1 + + +# log_file_handle.close() + + +if __name__ == '__main__': + main() diff --git a/copy_diff.sh b/copy_diff.sh new file mode 100755 index 0000000..7e0010c --- /dev/null +++ b/copy_diff.sh @@ -0,0 +1,34 @@ +#!/bin/bash +_file="$1" +_target="$2" +_demo=${3:-0} + +#Let's set color codes for passed and failed tests +red=`tput setaf 1` +green=`tput setaf 2` +bgcolor=`tput setab 7` +yellow=`tput setaf 3` +reset=`tput sgr0` +bold=`tput bold` + +[ $# -eq 0 ] && { echo "Usage: $0 filename"; exit 1; } +[ ! -f "$_file" ] && { echo "Error: $0 file not found."; exit 2; } + +if [ -s "$_file" ] +then + echo -e "${red}${bold} : Failed test${reset}" + cat $_file >> diff_results/$_target + if [ $_demo -eq 1 ] + then + source find_diff.sh $_file + fi + rm build/diff* +else + if [ -n "$(ls build | grep diff)" ] + then + rm build/diff* + echo -e "${green}${bold} : Passed test${reset}" + else + echo -e "${yellow}${bold} : Could not run test${reset}" + fi +fi diff --git a/find_diff.sh b/find_diff.sh new file mode 100755 index 0000000..dae5428 --- /dev/null +++ b/find_diff.sh @@ -0,0 +1,124 @@ +#!/bin/bash +_file="$1" + +#Let's set color codes for passed and failed tests +red=`tput setaf 1` +green=`tput setaf 2` +bgcolor=`tput setab 7` +reset=`tput sgr0` +bold=`tput bold` + +stat_diff="DIFF: Content Mismatch" +file_missing="Failed stating" +print_all=0 +stat=0 +index=0 +declare -a Inode +declare -a Size +declare -a BSize +declare -a NumBlocks +declare -a Links + +tput setaf 1 + +num_bugs="bugs" +num_missing="missing" +num_stat="stat" + +#To output bug summary, let's just echo bug counts into appropriate files +bugs=`cat $num_bugs` +missing=`cat $num_missing` +mismatch=`cat $num_stat` + +#If we reached this point, it means we encountered a bug. So increment bug count +bugs=$(( $bugs + 1)) +echo $bugs > $num_bugs + + +#Let's read the diff file line by line and see where it differs +[ $# -eq 0 ] && { echo "Usage: $0 filename"; exit 1; } +[ ! -f "$_file" ] && { echo "Error: $0 file not found."; exit 2; } + +if [ -s "$_file" ] +then + while read line; do + if echo $line | grep -q "$stat_diff" + then + file_name=$line + echo $line + stat=1 + elif echo $line | grep -q "$file_missing" + then + echo $line + print_all=1 + + elif [ $stat -eq 1 ] + then + if echo $line | grep -q "Inode" + then + Inode[$index]=`echo $line|cut -d ' ' -f3` + elif echo $line | grep -q "TotalSize" + then + Size[$index]=`echo $line|cut -d ' ' -f3` + elif echo $line | grep -q "BlockSize" + then + BSize[$index]=`echo $line|cut -d ' ' -f3` + elif echo $line | grep -q "#Blocks" + then + NumBlocks[$index]=`echo $line|cut -d ' ' -f3` + elif echo $line | grep -q "HardLinks" + then + Links[$index]=`echo $line|cut -d ' ' -f2` + index=$(( $index + 1 )) + else + : + fi + + elif [ $print_all -eq 1 ] + then + echo $line + + else + : + fi + done < $_file + + #Now that we've parsed the diff files, let's find out what is different from actual and expected states and print it. + + if [ $stat -eq 1 ] + then + + mismatch=$(( $mismatch + 1)) + echo $mismatch > $num_stat + + if [[ "${Inode[0]}" -ne "${Inode[1]}" ]] + then + echo -e "\tExpected Inode Number = ${Inode[1]}\n\tActual Inode Number = ${Inode[0]}" + + elif [[ "${Size[0]}" -ne "${Size[1]}" ]] + then + echo -e "\tExpected File Size = ${Size[1]}\n\tActual File Size = ${Size[0]}" + + elif [[ ${BSize[0]} -ne ${BSize[1]} ]] + then + echo -e "\tExpected Block Size = ${BSize[1]}\n\tActual Block Size = ${BSize[0]}" + + elif [[ ${NumBlocks[0]} -ne ${NumBlocks[1]} ]] + then + echo -e "\tExpected Block Count = ${NumBlocks[1]}\n\tActual Block Count = ${NumBlocks[0]}" + + elif [[ ${Links[0]} -ne ${Links[1]} ]] + then + echo -e "\tExpected Link Count = ${Links[1]}\n\tActual Link Count = ${Links[0]}" + + else + : + fi + else + missing=$(( $missing + 1)) + echo $missing > $num_missing + + fi +fi + +tput sgr0 diff --git a/personal_plugins/panda/plugins/writetracker/writetracker.cpp b/personal_plugins/panda/plugins/writetracker/writetracker.cpp index e7defb5..35a447c 100644 --- a/personal_plugins/panda/plugins/writetracker/writetracker.cpp +++ b/personal_plugins/panda/plugins/writetracker/writetracker.cpp @@ -154,9 +154,10 @@ static bool try_capture(CPUState *env, target_ulong pc, bool is_translate) { } } - // fdisi - if (insn[0] == 0x9b && insn[1] == 0xdb && insn[2] == 0xe1) { - log_output(pc, CHECKPOINT, 0, 0, nullptr); + // f2xm1 + if (insn[0] == 0xd9 && insn[1] == 0xf0) { + if (!is_translate) + log_output(pc, CHECKPOINT, 0, 0, nullptr); return true; } diff --git a/scripts/reader.cpp b/scripts/reader.cpp index 7ac3cf9..977f8a0 100644 --- a/scripts/reader.cpp +++ b/scripts/reader.cpp @@ -7,6 +7,7 @@ static const int WRITE = 0; static const int FLUSH = 1; static const int FENCE = 2; +static const int CHECKPOINT = 3; int main(int argc, char* argv[]) { if (argc < 2) { @@ -49,6 +50,10 @@ int main(int argc, char* argv[]) { std::cout << "[pc 0x" << std::hex << pc << "] mfence or sfence" << std::endl; break; } + case CHECKPOINT: { + std::cout << "[pc 0x" << std::hex << pc << "] checkpoint" << std::endl; + break; + } } } std::cout << "done?" << std::endl; diff --git a/src/Makefile b/src/Makefile index b4f99f7..3c567f4 100644 --- a/src/Makefile +++ b/src/Makefile @@ -7,12 +7,6 @@ KERNEL_VERSION := $(shell uname -r) KERNEL_MAJ := $(shell echo $(KERNEL_VERSION) | cut -f1 -d.) KERNEL_MIN := $(shell echo $(KERNEL_VERSION) | cut -f2 -d.) -XATTR_DEF_FLAG := -ifeq ($(shell [ $(KERNEL_MAJ) -gt 4 -o \ - \( $(KERNEL_MAJ) -eq 4 -a $(KERNEL_MIN) -ge 15 \) ] && echo true), true) -XATTR_DEF_FLAG := -DNEW_XATTR_INC -endif - BUILDDIR = ../build ROOTDIR = ../ @@ -22,11 +16,20 @@ CM_TESTS = \ $(filter-out $(CM_TESTS_EXCLUDE), \ $(notdir $(wildcard tests/*.cpp)))) +CM_SEQ1_EXCLUDE = base.cpp +CM_SEQ1 = \ + $(patsubst %.cpp, %.so, \ + $(filter-out $(CM_SEQ1_EXCLUDE), \ + $(notdir $(wildcard $(CURDIR)/tests/seq1/*.cpp)))) +CM_SEQ1_OUT = \ + $(foreach TEST, $(CM_SEQ1), \ + $(BUILDDIR)/tests/seq1/$(TEST)) + TARGET = $(ROOTDIR)harness -.PHONY: all tests +.PHONY: all tests seq1 -all: $(BUILDDIR) $(TARGET) tests +all: $(BUILDDIR) $(TARGET) tests seq1 $(BUILDDIR): @mkdir -p $(BUILDDIR) @@ -50,6 +53,8 @@ $(TARGET): \ tests: \ $(foreach TEST, $(CM_TESTS), $(BUILDDIR)/tests/$(TEST)) +seq1: $(CM_SEQ1_OUT) + $(BUILDDIR)/communication/%.o: communication/%.cpp @mkdir -p $(@D) $(G++) -c $(OPT) -fPIC -o $@ $< @@ -84,3 +89,18 @@ $(BUILDDIR)/tests/%.so: tests/%.cpp \ @mkdir -p $(@D) $(G++) $(OPT) $(GOTPSSO) $(XATTR_DEF_FLAG) -Wl,-soname,$(notdir $@) \ -o $@ $^ + +# TODO FIX LINK ERRORS +$(CM_SEQ1_OUT): $(BUILDDIR)/tests/seq1/%.so : \ + tests/seq1/%.cpp \ + $(BUILDDIR)/tests/BaseTestCase.o \ + $(BUILDDIR)/wrapper/actions.o \ + $(BUILDDIR)/wrapper/workload.o \ + $(BUILDDIR)/wrapper/wrapper.o \ + $(BUILDDIR)/wrapper/DiskMod.o \ + $(BUILDDIR)/communication/ClientSocket.o \ + $(BUILDDIR)/results/DataTestResult.o + @mkdir -p $(@D) + $(G++) $(OPT) $(GOTPSSO) $(XATTR_DEF_FLAG) -Wl,-soname,$(notdir $@) \ + -o $@ $^ + diff --git a/src/main.cpp b/src/main.cpp index 67c5a2c..3070620 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -311,11 +311,6 @@ int main(int argc, char** argv) { /*********************************************************** * 3. Execute the workload ************************************************************/ - //TODO - //dummy workload for now - //system("./workload seq 4K 4K overwrite 1"); - //system("./workload seq 1 4K"); - system("./workload"); cout << "Running j-lang test profile" << endl; diff --git a/src/tests/ace-base/base-j-lang b/src/tests/ace-base/base-j-lang new file mode 100644 index 0000000..b819887 --- /dev/null +++ b/src/tests/ace-base/base-j-lang @@ -0,0 +1,18 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup diff --git a/src/tests/ace-base/base.cpp b/src/tests/ace-base/base.cpp new file mode 100644 index 0000000..a66e4d3 --- /dev/null +++ b/src/tests/ace-base/base.cpp @@ -0,0 +1,59 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + return 0; + } + + virtual int run( int checkpoint ) override { + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + return 0; + } + + private: + + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/base-j-lang b/src/tests/seq1/base-j-lang new file mode 100644 index 0000000..b819887 --- /dev/null +++ b/src/tests/seq1/base-j-lang @@ -0,0 +1,18 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup diff --git a/src/tests/seq1/base.cpp b/src/tests/seq1/base.cpp new file mode 100644 index 0000000..a66e4d3 --- /dev/null +++ b/src/tests/seq1/base.cpp @@ -0,0 +1,59 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + return 0; + } + + virtual int run( int checkpoint ) override { + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + return 0; + } + + private: + + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang-files/j-lang1 b/src/tests/seq1/j-lang-files/j-lang1 new file mode 100644 index 0000000..e80a39b --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang1 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +opendir test 0777 +fsync test +checkpoint 1 +close foo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang10 b/src/tests/seq1/j-lang-files/j-lang10 new file mode 100644 index 0000000..e309004 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang10 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +opendir test 0777 +fsync test +checkpoint 1 +close test diff --git a/src/tests/seq1/j-lang-files/j-lang100 b/src/tests/seq1/j-lang-files/j-lang100 new file mode 100644 index 0000000..7b32394 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang100 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE 32768 32768 +sync +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang101 b/src/tests/seq1/j-lang-files/j-lang101 new file mode 100644 index 0000000..72eb1ef --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang101 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE 0 5000 +opendir A 0777 +fsync A +checkpoint 1 +close Afoo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang102 b/src/tests/seq1/j-lang-files/j-lang102 new file mode 100644 index 0000000..ea06473 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang102 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE 0 5000 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang103 b/src/tests/seq1/j-lang-files/j-lang103 new file mode 100644 index 0000000..ae2584d --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang103 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE 0 5000 +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang104 b/src/tests/seq1/j-lang-files/j-lang104 new file mode 100644 index 0000000..6e4523d --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang104 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE 0 5000 +sync +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang105 b/src/tests/seq1/j-lang-files/j-lang105 new file mode 100644 index 0000000..6d4b9b6 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang105 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE 30768 5000 +opendir A 0777 +fsync A +checkpoint 1 +close Afoo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang106 b/src/tests/seq1/j-lang-files/j-lang106 new file mode 100644 index 0000000..3fcd3da --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang106 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE 30768 5000 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang107 b/src/tests/seq1/j-lang-files/j-lang107 new file mode 100644 index 0000000..3bfd834 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang107 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE 30768 5000 +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang108 b/src/tests/seq1/j-lang-files/j-lang108 new file mode 100644 index 0000000..2589e5f --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang108 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE 30768 5000 +sync +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang109 b/src/tests/seq1/j-lang-files/j-lang109 new file mode 100644 index 0000000..dd12b32 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang109 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_KEEP_SIZE 32768 32768 +opendir A 0777 +fsync A +checkpoint 1 +close Afoo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang11 b/src/tests/seq1/j-lang-files/j-lang11 new file mode 100644 index 0000000..f385fe6 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang11 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +mkdir B 0777 +opendir B 0777 +fsync B +checkpoint 1 +close B diff --git a/src/tests/seq1/j-lang-files/j-lang110 b/src/tests/seq1/j-lang-files/j-lang110 new file mode 100644 index 0000000..5eca993 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang110 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_KEEP_SIZE 32768 32768 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang111 b/src/tests/seq1/j-lang-files/j-lang111 new file mode 100644 index 0000000..2107542 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang111 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_KEEP_SIZE 32768 32768 +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang112 b/src/tests/seq1/j-lang-files/j-lang112 new file mode 100644 index 0000000..9c5dd35 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang112 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_KEEP_SIZE 32768 32768 +sync +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang113 b/src/tests/seq1/j-lang-files/j-lang113 new file mode 100644 index 0000000..b01c852 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang113 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_KEEP_SIZE 0 5000 +opendir A 0777 +fsync A +checkpoint 1 +close Afoo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang114 b/src/tests/seq1/j-lang-files/j-lang114 new file mode 100644 index 0000000..f83c285 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang114 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_KEEP_SIZE 0 5000 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang115 b/src/tests/seq1/j-lang-files/j-lang115 new file mode 100644 index 0000000..2135aeb --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang115 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_KEEP_SIZE 0 5000 +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang116 b/src/tests/seq1/j-lang-files/j-lang116 new file mode 100644 index 0000000..8c6258a --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang116 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_KEEP_SIZE 0 5000 +sync +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang117 b/src/tests/seq1/j-lang-files/j-lang117 new file mode 100644 index 0000000..9446883 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang117 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_KEEP_SIZE 30768 5000 +opendir A 0777 +fsync A +checkpoint 1 +close Afoo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang118 b/src/tests/seq1/j-lang-files/j-lang118 new file mode 100644 index 0000000..62ed261 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang118 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_KEEP_SIZE 30768 5000 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang119 b/src/tests/seq1/j-lang-files/j-lang119 new file mode 100644 index 0000000..d451b6b --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang119 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_KEEP_SIZE 30768 5000 +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang12 b/src/tests/seq1/j-lang-files/j-lang12 new file mode 100644 index 0000000..c5c2dff --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang12 @@ -0,0 +1,24 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +sync +checkpoint 1 diff --git a/src/tests/seq1/j-lang-files/j-lang120 b/src/tests/seq1/j-lang-files/j-lang120 new file mode 100644 index 0000000..13428fe --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang120 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_KEEP_SIZE 30768 5000 +sync +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang121 b/src/tests/seq1/j-lang-files/j-lang121 new file mode 100644 index 0000000..6ac848d --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang121 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo 0 32768 32768 +opendir A 0777 +fsync A +checkpoint 1 +close Afoo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang122 b/src/tests/seq1/j-lang-files/j-lang122 new file mode 100644 index 0000000..df1ce0f --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang122 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo 0 32768 32768 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang123 b/src/tests/seq1/j-lang-files/j-lang123 new file mode 100644 index 0000000..658c683 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang123 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo 0 32768 32768 +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang124 b/src/tests/seq1/j-lang-files/j-lang124 new file mode 100644 index 0000000..0c0a480 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang124 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo 0 32768 32768 +sync +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang125 b/src/tests/seq1/j-lang-files/j-lang125 new file mode 100644 index 0000000..4337775 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang125 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo 0 0 5000 +opendir A 0777 +fsync A +checkpoint 1 +close Afoo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang126 b/src/tests/seq1/j-lang-files/j-lang126 new file mode 100644 index 0000000..6be7d74 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang126 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo 0 0 5000 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang127 b/src/tests/seq1/j-lang-files/j-lang127 new file mode 100644 index 0000000..ceb32d6 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang127 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo 0 0 5000 +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang128 b/src/tests/seq1/j-lang-files/j-lang128 new file mode 100644 index 0000000..23b5c6b --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang128 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo 0 0 5000 +sync +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang129 b/src/tests/seq1/j-lang-files/j-lang129 new file mode 100644 index 0000000..a8ed1a2 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang129 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo 0 30768 5000 +opendir A 0777 +fsync A +checkpoint 1 +close Afoo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang13 b/src/tests/seq1/j-lang-files/j-lang13 new file mode 100644 index 0000000..1f86198 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang13 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_ZERO_RANGE 32768 32768 +opendir test 0777 +fsync test +checkpoint 1 +close foo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang130 b/src/tests/seq1/j-lang-files/j-lang130 new file mode 100644 index 0000000..6e494f8 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang130 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo 0 30768 5000 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang131 b/src/tests/seq1/j-lang-files/j-lang131 new file mode 100644 index 0000000..86832d6 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang131 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo 0 30768 5000 +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang132 b/src/tests/seq1/j-lang-files/j-lang132 new file mode 100644 index 0000000..c1ff7ea --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang132 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo 0 30768 5000 +sync +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang133 b/src/tests/seq1/j-lang-files/j-lang133 new file mode 100644 index 0000000..eb78139 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang133 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +opendir test 0777 +fsync test +checkpoint 1 +close foo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang134 b/src/tests/seq1/j-lang-files/j-lang134 new file mode 100644 index 0000000..a0fb89c --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang134 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang135 b/src/tests/seq1/j-lang-files/j-lang135 new file mode 100644 index 0000000..4003002 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang135 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang136 b/src/tests/seq1/j-lang-files/j-lang136 new file mode 100644 index 0000000..620c245 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang136 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +sync +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang137 b/src/tests/seq1/j-lang-files/j-lang137 new file mode 100644 index 0000000..7726a73 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang137 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +write foo 0 5000 +opendir test 0777 +fsync test +checkpoint 1 +close foo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang138 b/src/tests/seq1/j-lang-files/j-lang138 new file mode 100644 index 0000000..f3a5af7 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang138 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +write foo 0 5000 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang139 b/src/tests/seq1/j-lang-files/j-lang139 new file mode 100644 index 0000000..7843bda --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang139 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +write foo 0 5000 +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang14 b/src/tests/seq1/j-lang-files/j-lang14 new file mode 100644 index 0000000..7c95dfd --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang14 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_ZERO_RANGE 32768 32768 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang140 b/src/tests/seq1/j-lang-files/j-lang140 new file mode 100644 index 0000000..642e714 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang140 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +write foo 0 5000 +sync +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang141 b/src/tests/seq1/j-lang-files/j-lang141 new file mode 100644 index 0000000..ec6e277 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang141 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +write foo 30768 5000 +opendir test 0777 +fsync test +checkpoint 1 +close foo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang142 b/src/tests/seq1/j-lang-files/j-lang142 new file mode 100644 index 0000000..8716d31 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang142 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +write foo 30768 5000 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang143 b/src/tests/seq1/j-lang-files/j-lang143 new file mode 100644 index 0000000..606ab0b --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang143 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +write foo 30768 5000 +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang144 b/src/tests/seq1/j-lang-files/j-lang144 new file mode 100644 index 0000000..3ff73cd --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang144 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +write foo 30768 5000 +sync +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang145 b/src/tests/seq1/j-lang-files/j-lang145 new file mode 100644 index 0000000..d6e3a75 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang145 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +opendir A 0777 +fsync A +checkpoint 1 +close Afoo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang146 b/src/tests/seq1/j-lang-files/j-lang146 new file mode 100644 index 0000000..3002a49 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang146 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang147 b/src/tests/seq1/j-lang-files/j-lang147 new file mode 100644 index 0000000..8e5684c --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang147 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang148 b/src/tests/seq1/j-lang-files/j-lang148 new file mode 100644 index 0000000..33dcfb2 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang148 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +sync +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang149 b/src/tests/seq1/j-lang-files/j-lang149 new file mode 100644 index 0000000..4e51334 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang149 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +write Afoo 0 5000 +opendir A 0777 +fsync A +checkpoint 1 +close Afoo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang15 b/src/tests/seq1/j-lang-files/j-lang15 new file mode 100644 index 0000000..25be7c6 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang15 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_ZERO_RANGE 32768 32768 +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang150 b/src/tests/seq1/j-lang-files/j-lang150 new file mode 100644 index 0000000..c69e1cc --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang150 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +write Afoo 0 5000 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang151 b/src/tests/seq1/j-lang-files/j-lang151 new file mode 100644 index 0000000..56a8023 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang151 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +write Afoo 0 5000 +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang152 b/src/tests/seq1/j-lang-files/j-lang152 new file mode 100644 index 0000000..08a436e --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang152 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +write Afoo 0 5000 +sync +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang153 b/src/tests/seq1/j-lang-files/j-lang153 new file mode 100644 index 0000000..120e282 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang153 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +write Afoo 30768 5000 +opendir A 0777 +fsync A +checkpoint 1 +close Afoo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang154 b/src/tests/seq1/j-lang-files/j-lang154 new file mode 100644 index 0000000..0074cbc --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang154 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +write Afoo 30768 5000 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang155 b/src/tests/seq1/j-lang-files/j-lang155 new file mode 100644 index 0000000..e2d3097 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang155 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +write Afoo 30768 5000 +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang156 b/src/tests/seq1/j-lang-files/j-lang156 new file mode 100644 index 0000000..d51ec52 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang156 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +write Afoo 30768 5000 +sync +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang157 b/src/tests/seq1/j-lang-files/j-lang157 new file mode 100644 index 0000000..ceb3f98 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang157 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +dwrite foo 0 32768 +opendir test 0777 +fsync test +checkpoint 1 +close test diff --git a/src/tests/seq1/j-lang-files/j-lang158 b/src/tests/seq1/j-lang-files/j-lang158 new file mode 100644 index 0000000..49be94e --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang158 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +dwrite foo 0 32768 +open foo O_RDWR|O_CREAT 0777 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang159 b/src/tests/seq1/j-lang-files/j-lang159 new file mode 100644 index 0000000..d63767c --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang159 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +dwrite foo 0 32768 +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang16 b/src/tests/seq1/j-lang-files/j-lang16 new file mode 100644 index 0000000..ed86f1f --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang16 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_ZERO_RANGE 32768 32768 +sync +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang160 b/src/tests/seq1/j-lang-files/j-lang160 new file mode 100644 index 0000000..6fc10e4 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang160 @@ -0,0 +1,25 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +dwrite foo 0 32768 +sync +checkpoint 1 diff --git a/src/tests/seq1/j-lang-files/j-lang161 b/src/tests/seq1/j-lang-files/j-lang161 new file mode 100644 index 0000000..080cb24 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang161 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +dwrite foo 0 8192 +opendir test 0777 +fsync test +checkpoint 1 +close test diff --git a/src/tests/seq1/j-lang-files/j-lang162 b/src/tests/seq1/j-lang-files/j-lang162 new file mode 100644 index 0000000..e2b7fc7 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang162 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +dwrite foo 0 8192 +open foo O_RDWR|O_CREAT 0777 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang163 b/src/tests/seq1/j-lang-files/j-lang163 new file mode 100644 index 0000000..9292a4f --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang163 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +dwrite foo 0 8192 +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang164 b/src/tests/seq1/j-lang-files/j-lang164 new file mode 100644 index 0000000..33b6f5b --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang164 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +dwrite foo 0 8192 +sync +checkpoint 1 diff --git a/src/tests/seq1/j-lang-files/j-lang165 b/src/tests/seq1/j-lang-files/j-lang165 new file mode 100644 index 0000000..3860a36 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang165 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +dwrite Afoo 0 32768 +opendir A 0777 +fsync A +checkpoint 1 +close A diff --git a/src/tests/seq1/j-lang-files/j-lang166 b/src/tests/seq1/j-lang-files/j-lang166 new file mode 100644 index 0000000..5173fa5 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang166 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +dwrite Afoo 0 32768 +open Afoo O_RDWR|O_CREAT 0777 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang167 b/src/tests/seq1/j-lang-files/j-lang167 new file mode 100644 index 0000000..199a5dd --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang167 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +dwrite Afoo 0 32768 +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang168 b/src/tests/seq1/j-lang-files/j-lang168 new file mode 100644 index 0000000..5b5534c --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang168 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +dwrite Afoo 0 32768 +sync +checkpoint 1 diff --git a/src/tests/seq1/j-lang-files/j-lang169 b/src/tests/seq1/j-lang-files/j-lang169 new file mode 100644 index 0000000..76a3324 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang169 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +dwrite Afoo 0 8192 +opendir A 0777 +fsync A +checkpoint 1 +close A diff --git a/src/tests/seq1/j-lang-files/j-lang17 b/src/tests/seq1/j-lang-files/j-lang17 new file mode 100644 index 0000000..8bf5ba0 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang17 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_ZERO_RANGE 0 5000 +opendir test 0777 +fsync test +checkpoint 1 +close foo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang170 b/src/tests/seq1/j-lang-files/j-lang170 new file mode 100644 index 0000000..ddfca1e --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang170 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +dwrite Afoo 0 8192 +open Afoo O_RDWR|O_CREAT 0777 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang171 b/src/tests/seq1/j-lang-files/j-lang171 new file mode 100644 index 0000000..a87a925 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang171 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +dwrite Afoo 0 8192 +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang172 b/src/tests/seq1/j-lang-files/j-lang172 new file mode 100644 index 0000000..61f7ab0 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang172 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +dwrite Afoo 0 8192 +sync +checkpoint 1 diff --git a/src/tests/seq1/j-lang-files/j-lang173 b/src/tests/seq1/j-lang-files/j-lang173 new file mode 100644 index 0000000..cb4b1ec --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang173 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +mmapwrite foo 32768 32768 +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang174 b/src/tests/seq1/j-lang-files/j-lang174 new file mode 100644 index 0000000..cb4b1ec --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang174 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +mmapwrite foo 32768 32768 +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang175 b/src/tests/seq1/j-lang-files/j-lang175 new file mode 100644 index 0000000..cb4b1ec --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang175 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +mmapwrite foo 32768 32768 +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang176 b/src/tests/seq1/j-lang-files/j-lang176 new file mode 100644 index 0000000..cb4b1ec --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang176 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +mmapwrite foo 32768 32768 +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang177 b/src/tests/seq1/j-lang-files/j-lang177 new file mode 100644 index 0000000..6201223 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang177 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +mmapwrite foo 0 8192 +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang178 b/src/tests/seq1/j-lang-files/j-lang178 new file mode 100644 index 0000000..6201223 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang178 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +mmapwrite foo 0 8192 +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang179 b/src/tests/seq1/j-lang-files/j-lang179 new file mode 100644 index 0000000..6201223 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang179 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +mmapwrite foo 0 8192 +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang18 b/src/tests/seq1/j-lang-files/j-lang18 new file mode 100644 index 0000000..c6e8dd0 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang18 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_ZERO_RANGE 0 5000 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang180 b/src/tests/seq1/j-lang-files/j-lang180 new file mode 100644 index 0000000..6201223 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang180 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +mmapwrite foo 0 8192 +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang181 b/src/tests/seq1/j-lang-files/j-lang181 new file mode 100644 index 0000000..4761e3e --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang181 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +mmapwrite Afoo 32768 32768 +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang182 b/src/tests/seq1/j-lang-files/j-lang182 new file mode 100644 index 0000000..4761e3e --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang182 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +mmapwrite Afoo 32768 32768 +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang183 b/src/tests/seq1/j-lang-files/j-lang183 new file mode 100644 index 0000000..4761e3e --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang183 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +mmapwrite Afoo 32768 32768 +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang184 b/src/tests/seq1/j-lang-files/j-lang184 new file mode 100644 index 0000000..4761e3e --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang184 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +mmapwrite Afoo 32768 32768 +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang185 b/src/tests/seq1/j-lang-files/j-lang185 new file mode 100644 index 0000000..14d1b58 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang185 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +mmapwrite Afoo 0 8192 +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang186 b/src/tests/seq1/j-lang-files/j-lang186 new file mode 100644 index 0000000..14d1b58 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang186 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +mmapwrite Afoo 0 8192 +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang187 b/src/tests/seq1/j-lang-files/j-lang187 new file mode 100644 index 0000000..14d1b58 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang187 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +mmapwrite Afoo 0 8192 +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang188 b/src/tests/seq1/j-lang-files/j-lang188 new file mode 100644 index 0000000..14d1b58 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang188 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +mmapwrite Afoo 0 8192 +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang189 b/src/tests/seq1/j-lang-files/j-lang189 new file mode 100644 index 0000000..759f1eb --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang189 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +link foo bar +opendir test 0777 +fsync test +checkpoint 1 +close foo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang19 b/src/tests/seq1/j-lang-files/j-lang19 new file mode 100644 index 0000000..780160d --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang19 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_ZERO_RANGE 0 5000 +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang190 b/src/tests/seq1/j-lang-files/j-lang190 new file mode 100644 index 0000000..e2b5d54 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang190 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +link foo bar +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang191 b/src/tests/seq1/j-lang-files/j-lang191 new file mode 100644 index 0000000..7f1e598 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang191 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +link foo bar +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang192 b/src/tests/seq1/j-lang-files/j-lang192 new file mode 100644 index 0000000..67b8cad --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang192 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +link foo bar +sync +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang193 b/src/tests/seq1/j-lang-files/j-lang193 new file mode 100644 index 0000000..9aa8302 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang193 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open foo O_RDWR|O_CREAT 0777 +link foo Abar +opendir A 0777 +fsync A +checkpoint 1 +close foo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang194 b/src/tests/seq1/j-lang-files/j-lang194 new file mode 100644 index 0000000..0dc3cca --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang194 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open foo O_RDWR|O_CREAT 0777 +link foo Abar +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang195 b/src/tests/seq1/j-lang-files/j-lang195 new file mode 100644 index 0000000..17e8a2a --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang195 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open foo O_RDWR|O_CREAT 0777 +link foo Abar +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close foo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang196 b/src/tests/seq1/j-lang-files/j-lang196 new file mode 100644 index 0000000..10d1aa1 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang196 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open foo O_RDWR|O_CREAT 0777 +link foo Abar +open Afoo O_RDWR|O_CREAT 0777 +fsync Afoo +checkpoint 1 +close Afoo +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang197 b/src/tests/seq1/j-lang-files/j-lang197 new file mode 100644 index 0000000..89543a5 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang197 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open foo O_RDWR|O_CREAT 0777 +link foo Abar +opendir test 0777 +fsync test +checkpoint 1 +close foo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang198 b/src/tests/seq1/j-lang-files/j-lang198 new file mode 100644 index 0000000..5f05e6a --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang198 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open foo O_RDWR|O_CREAT 0777 +link foo Abar +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang199 b/src/tests/seq1/j-lang-files/j-lang199 new file mode 100644 index 0000000..c6aea44 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang199 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open foo O_RDWR|O_CREAT 0777 +link foo Abar +sync +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang2 b/src/tests/seq1/j-lang-files/j-lang2 new file mode 100644 index 0000000..fd5b118 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang2 @@ -0,0 +1,25 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang20 b/src/tests/seq1/j-lang-files/j-lang20 new file mode 100644 index 0000000..b4d7ba3 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang20 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_ZERO_RANGE 0 5000 +sync +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang200 b/src/tests/seq1/j-lang-files/j-lang200 new file mode 100644 index 0000000..5305210 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang200 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +link Afoo bar +opendir A 0777 +fsync A +checkpoint 1 +close Afoo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang201 b/src/tests/seq1/j-lang-files/j-lang201 new file mode 100644 index 0000000..37ab288 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang201 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +link Afoo bar +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close Afoo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang202 b/src/tests/seq1/j-lang-files/j-lang202 new file mode 100644 index 0000000..df07087 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang202 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +link Afoo bar +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang203 b/src/tests/seq1/j-lang-files/j-lang203 new file mode 100644 index 0000000..20f8968 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang203 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +link Afoo bar +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang204 b/src/tests/seq1/j-lang-files/j-lang204 new file mode 100644 index 0000000..07327f2 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang204 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +link Afoo bar +opendir test 0777 +fsync test +checkpoint 1 +close Afoo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang205 b/src/tests/seq1/j-lang-files/j-lang205 new file mode 100644 index 0000000..d1b38b3 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang205 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +link Afoo bar +open foo O_RDWR|O_CREAT 0777 +fsync foo +checkpoint 1 +close Afoo +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang206 b/src/tests/seq1/j-lang-files/j-lang206 new file mode 100644 index 0000000..92f5535 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang206 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +link Afoo bar +sync +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang207 b/src/tests/seq1/j-lang-files/j-lang207 new file mode 100644 index 0000000..524cfff --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang207 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +link Afoo Abar +opendir A 0777 +fsync A +checkpoint 1 +close Afoo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang208 b/src/tests/seq1/j-lang-files/j-lang208 new file mode 100644 index 0000000..33229db --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang208 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +link Afoo Abar +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang209 b/src/tests/seq1/j-lang-files/j-lang209 new file mode 100644 index 0000000..531e29f --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang209 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +link Afoo Abar +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang21 b/src/tests/seq1/j-lang-files/j-lang21 new file mode 100644 index 0000000..859323b --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang21 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_ZERO_RANGE 30768 5000 +opendir test 0777 +fsync test +checkpoint 1 +close foo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang210 b/src/tests/seq1/j-lang-files/j-lang210 new file mode 100644 index 0000000..da8d541 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang210 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +link Afoo Abar +sync +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang211 b/src/tests/seq1/j-lang-files/j-lang211 new file mode 100644 index 0000000..00b0b43 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang211 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open bar O_RDWR|O_CREAT 0777 +link bar Abar +opendir A 0777 +fsync A +checkpoint 1 +close bar +close A diff --git a/src/tests/seq1/j-lang-files/j-lang212 b/src/tests/seq1/j-lang-files/j-lang212 new file mode 100644 index 0000000..369102a --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang212 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open bar O_RDWR|O_CREAT 0777 +link bar Abar +fsync bar +checkpoint 1 +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang213 b/src/tests/seq1/j-lang-files/j-lang213 new file mode 100644 index 0000000..55550a9 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang213 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open bar O_RDWR|O_CREAT 0777 +link bar Abar +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close bar +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang214 b/src/tests/seq1/j-lang-files/j-lang214 new file mode 100644 index 0000000..e07c55e --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang214 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open bar O_RDWR|O_CREAT 0777 +link bar Abar +open Afoo O_RDWR|O_CREAT 0777 +fsync Afoo +checkpoint 1 +close Afoo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang215 b/src/tests/seq1/j-lang-files/j-lang215 new file mode 100644 index 0000000..8a9fa8a --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang215 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open bar O_RDWR|O_CREAT 0777 +link bar Abar +opendir test 0777 +fsync test +checkpoint 1 +close bar +close test diff --git a/src/tests/seq1/j-lang-files/j-lang216 b/src/tests/seq1/j-lang-files/j-lang216 new file mode 100644 index 0000000..c4c079d --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang216 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open bar O_RDWR|O_CREAT 0777 +link bar Abar +open foo O_RDWR|O_CREAT 0777 +fsync foo +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang217 b/src/tests/seq1/j-lang-files/j-lang217 new file mode 100644 index 0000000..caa8764 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang217 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open bar O_RDWR|O_CREAT 0777 +link bar Abar +sync +checkpoint 1 +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang218 b/src/tests/seq1/j-lang-files/j-lang218 new file mode 100644 index 0000000..985f40f --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang218 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Abar O_RDWR|O_CREAT 0777 +link Abar bar +opendir A 0777 +fsync A +checkpoint 1 +close Abar +close A diff --git a/src/tests/seq1/j-lang-files/j-lang219 b/src/tests/seq1/j-lang-files/j-lang219 new file mode 100644 index 0000000..2aec30d --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang219 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Abar O_RDWR|O_CREAT 0777 +link Abar bar +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close bar +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang22 b/src/tests/seq1/j-lang-files/j-lang22 new file mode 100644 index 0000000..d474d02 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang22 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_ZERO_RANGE 30768 5000 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang220 b/src/tests/seq1/j-lang-files/j-lang220 new file mode 100644 index 0000000..dd0c7d6 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang220 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Abar O_RDWR|O_CREAT 0777 +link Abar bar +fsync Abar +checkpoint 1 +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang221 b/src/tests/seq1/j-lang-files/j-lang221 new file mode 100644 index 0000000..dd8b89e --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang221 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Abar O_RDWR|O_CREAT 0777 +link Abar bar +open Afoo O_RDWR|O_CREAT 0777 +fsync Afoo +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang222 b/src/tests/seq1/j-lang-files/j-lang222 new file mode 100644 index 0000000..fdb30f8 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang222 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Abar O_RDWR|O_CREAT 0777 +link Abar bar +opendir test 0777 +fsync test +checkpoint 1 +close Abar +close test diff --git a/src/tests/seq1/j-lang-files/j-lang223 b/src/tests/seq1/j-lang-files/j-lang223 new file mode 100644 index 0000000..63b4f60 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang223 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Abar O_RDWR|O_CREAT 0777 +link Abar bar +open foo O_RDWR|O_CREAT 0777 +fsync foo +checkpoint 1 +close foo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang224 b/src/tests/seq1/j-lang-files/j-lang224 new file mode 100644 index 0000000..6311430 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang224 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Abar O_RDWR|O_CREAT 0777 +link Abar bar +sync +checkpoint 1 +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang225 b/src/tests/seq1/j-lang-files/j-lang225 new file mode 100644 index 0000000..99736a0 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang225 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +close foo +unlink foo +opendir test 0777 +fsync test +checkpoint 1 +close test diff --git a/src/tests/seq1/j-lang-files/j-lang226 b/src/tests/seq1/j-lang-files/j-lang226 new file mode 100644 index 0000000..26059d7 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang226 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +close foo +unlink foo +open foo O_RDWR|O_CREAT 0777 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang227 b/src/tests/seq1/j-lang-files/j-lang227 new file mode 100644 index 0000000..86e17b9 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang227 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +close foo +unlink foo +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang228 b/src/tests/seq1/j-lang-files/j-lang228 new file mode 100644 index 0000000..10dc4b1 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang228 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +close foo +unlink foo +sync +checkpoint 1 diff --git a/src/tests/seq1/j-lang-files/j-lang229 b/src/tests/seq1/j-lang-files/j-lang229 new file mode 100644 index 0000000..3bbf175 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang229 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +close Afoo +unlink Afoo +opendir A 0777 +fsync A +checkpoint 1 +close A diff --git a/src/tests/seq1/j-lang-files/j-lang23 b/src/tests/seq1/j-lang-files/j-lang23 new file mode 100644 index 0000000..09a9d2a --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang23 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_ZERO_RANGE 30768 5000 +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang230 b/src/tests/seq1/j-lang-files/j-lang230 new file mode 100644 index 0000000..1fc74ca --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang230 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +close Afoo +unlink Afoo +open Afoo O_RDWR|O_CREAT 0777 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang231 b/src/tests/seq1/j-lang-files/j-lang231 new file mode 100644 index 0000000..d3a4e5d --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang231 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +close Afoo +unlink Afoo +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang232 b/src/tests/seq1/j-lang-files/j-lang232 new file mode 100644 index 0000000..eff77ad --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang232 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +close Afoo +unlink Afoo +sync +checkpoint 1 diff --git a/src/tests/seq1/j-lang-files/j-lang233 b/src/tests/seq1/j-lang-files/j-lang233 new file mode 100644 index 0000000..cb64ffc --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang233 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open bar O_RDWR|O_CREAT 0777 +close bar +unlink bar +opendir test 0777 +fsync test +checkpoint 1 +close test diff --git a/src/tests/seq1/j-lang-files/j-lang234 b/src/tests/seq1/j-lang-files/j-lang234 new file mode 100644 index 0000000..5605e72 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang234 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open bar O_RDWR|O_CREAT 0777 +close bar +unlink bar +open foo O_RDWR|O_CREAT 0777 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang235 b/src/tests/seq1/j-lang-files/j-lang235 new file mode 100644 index 0000000..c4d1b6f --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang235 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open bar O_RDWR|O_CREAT 0777 +close bar +unlink bar +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang236 b/src/tests/seq1/j-lang-files/j-lang236 new file mode 100644 index 0000000..944841a --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang236 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open bar O_RDWR|O_CREAT 0777 +close bar +unlink bar +sync +checkpoint 1 diff --git a/src/tests/seq1/j-lang-files/j-lang237 b/src/tests/seq1/j-lang-files/j-lang237 new file mode 100644 index 0000000..48c198e --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang237 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Abar O_RDWR|O_CREAT 0777 +close Abar +unlink Abar +opendir A 0777 +fsync A +checkpoint 1 +close A diff --git a/src/tests/seq1/j-lang-files/j-lang238 b/src/tests/seq1/j-lang-files/j-lang238 new file mode 100644 index 0000000..9b943c4 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang238 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Abar O_RDWR|O_CREAT 0777 +close Abar +unlink Abar +open Afoo O_RDWR|O_CREAT 0777 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang239 b/src/tests/seq1/j-lang-files/j-lang239 new file mode 100644 index 0000000..324112e --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang239 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Abar O_RDWR|O_CREAT 0777 +close Abar +unlink Abar +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang24 b/src/tests/seq1/j-lang-files/j-lang24 new file mode 100644 index 0000000..88f83ad --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang24 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_ZERO_RANGE 30768 5000 +sync +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang240 b/src/tests/seq1/j-lang-files/j-lang240 new file mode 100644 index 0000000..e48c068 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang240 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Abar O_RDWR|O_CREAT 0777 +close Abar +unlink Abar +sync +checkpoint 1 diff --git a/src/tests/seq1/j-lang-files/j-lang241 b/src/tests/seq1/j-lang-files/j-lang241 new file mode 100644 index 0000000..352f3dd --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang241 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +close foo +remove foo +opendir test 0777 +fsync test +checkpoint 1 +close test diff --git a/src/tests/seq1/j-lang-files/j-lang242 b/src/tests/seq1/j-lang-files/j-lang242 new file mode 100644 index 0000000..8f4a7de --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang242 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +close foo +remove foo +open foo O_RDWR|O_CREAT 0777 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang243 b/src/tests/seq1/j-lang-files/j-lang243 new file mode 100644 index 0000000..6777754 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang243 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +close foo +remove foo +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang244 b/src/tests/seq1/j-lang-files/j-lang244 new file mode 100644 index 0000000..fa714e8 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang244 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +close foo +remove foo +sync +checkpoint 1 diff --git a/src/tests/seq1/j-lang-files/j-lang245 b/src/tests/seq1/j-lang-files/j-lang245 new file mode 100644 index 0000000..14968a5 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang245 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +close Afoo +remove Afoo +opendir A 0777 +fsync A +checkpoint 1 +close A diff --git a/src/tests/seq1/j-lang-files/j-lang246 b/src/tests/seq1/j-lang-files/j-lang246 new file mode 100644 index 0000000..2f4d28b --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang246 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +close Afoo +remove Afoo +open Afoo O_RDWR|O_CREAT 0777 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang247 b/src/tests/seq1/j-lang-files/j-lang247 new file mode 100644 index 0000000..fe92c06 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang247 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +close Afoo +remove Afoo +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang248 b/src/tests/seq1/j-lang-files/j-lang248 new file mode 100644 index 0000000..1bfe176 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang248 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +close Afoo +remove Afoo +sync +checkpoint 1 diff --git a/src/tests/seq1/j-lang-files/j-lang249 b/src/tests/seq1/j-lang-files/j-lang249 new file mode 100644 index 0000000..1deff38 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang249 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open bar O_RDWR|O_CREAT 0777 +close bar +remove bar +opendir test 0777 +fsync test +checkpoint 1 +close test diff --git a/src/tests/seq1/j-lang-files/j-lang25 b/src/tests/seq1/j-lang-files/j-lang25 new file mode 100644 index 0000000..73466c6 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang25 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE 32768 32768 +opendir test 0777 +fsync test +checkpoint 1 +close foo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang250 b/src/tests/seq1/j-lang-files/j-lang250 new file mode 100644 index 0000000..9854042 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang250 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open bar O_RDWR|O_CREAT 0777 +close bar +remove bar +open foo O_RDWR|O_CREAT 0777 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang251 b/src/tests/seq1/j-lang-files/j-lang251 new file mode 100644 index 0000000..27d2185 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang251 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open bar O_RDWR|O_CREAT 0777 +close bar +remove bar +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang252 b/src/tests/seq1/j-lang-files/j-lang252 new file mode 100644 index 0000000..0df3f4c --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang252 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open bar O_RDWR|O_CREAT 0777 +close bar +remove bar +sync +checkpoint 1 diff --git a/src/tests/seq1/j-lang-files/j-lang253 b/src/tests/seq1/j-lang-files/j-lang253 new file mode 100644 index 0000000..b3fc109 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang253 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Abar O_RDWR|O_CREAT 0777 +close Abar +remove Abar +opendir A 0777 +fsync A +checkpoint 1 +close A diff --git a/src/tests/seq1/j-lang-files/j-lang254 b/src/tests/seq1/j-lang-files/j-lang254 new file mode 100644 index 0000000..ec7f714 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang254 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Abar O_RDWR|O_CREAT 0777 +close Abar +remove Abar +open Afoo O_RDWR|O_CREAT 0777 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang255 b/src/tests/seq1/j-lang-files/j-lang255 new file mode 100644 index 0000000..13a94e8 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang255 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Abar O_RDWR|O_CREAT 0777 +close Abar +remove Abar +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang256 b/src/tests/seq1/j-lang-files/j-lang256 new file mode 100644 index 0000000..daa98c1 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang256 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Abar O_RDWR|O_CREAT 0777 +close Abar +remove Abar +sync +checkpoint 1 diff --git a/src/tests/seq1/j-lang-files/j-lang257 b/src/tests/seq1/j-lang-files/j-lang257 new file mode 100644 index 0000000..a4913a9 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang257 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +close foo +rename foo bar +opendir test 0777 +fsync test +checkpoint 1 +close test diff --git a/src/tests/seq1/j-lang-files/j-lang258 b/src/tests/seq1/j-lang-files/j-lang258 new file mode 100644 index 0000000..77f9b6d --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang258 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +close foo +rename foo bar +open foo O_RDWR|O_CREAT 0777 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang259 b/src/tests/seq1/j-lang-files/j-lang259 new file mode 100644 index 0000000..54288c8 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang259 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +close foo +rename foo bar +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang26 b/src/tests/seq1/j-lang-files/j-lang26 new file mode 100644 index 0000000..d048d1a --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang26 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE 32768 32768 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang260 b/src/tests/seq1/j-lang-files/j-lang260 new file mode 100644 index 0000000..50f9b53 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang260 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +close foo +rename foo bar +sync +checkpoint 1 diff --git a/src/tests/seq1/j-lang-files/j-lang261 b/src/tests/seq1/j-lang-files/j-lang261 new file mode 100644 index 0000000..33f2738 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang261 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open foo O_RDWR|O_CREAT 0777 +close foo +rename foo Abar +opendir A 0777 +fsync A +checkpoint 1 +close A diff --git a/src/tests/seq1/j-lang-files/j-lang262 b/src/tests/seq1/j-lang-files/j-lang262 new file mode 100644 index 0000000..5ebc339 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang262 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open foo O_RDWR|O_CREAT 0777 +close foo +rename foo Abar +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang263 b/src/tests/seq1/j-lang-files/j-lang263 new file mode 100644 index 0000000..45dac5b --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang263 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open foo O_RDWR|O_CREAT 0777 +close foo +rename foo Abar +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang264 b/src/tests/seq1/j-lang-files/j-lang264 new file mode 100644 index 0000000..05232c9 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang264 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open foo O_RDWR|O_CREAT 0777 +close foo +rename foo Abar +open Afoo O_RDWR|O_CREAT 0777 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang265 b/src/tests/seq1/j-lang-files/j-lang265 new file mode 100644 index 0000000..ce793ec --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang265 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open foo O_RDWR|O_CREAT 0777 +close foo +rename foo Abar +opendir test 0777 +fsync test +checkpoint 1 +close test diff --git a/src/tests/seq1/j-lang-files/j-lang266 b/src/tests/seq1/j-lang-files/j-lang266 new file mode 100644 index 0000000..ea07e84 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang266 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open foo O_RDWR|O_CREAT 0777 +close foo +rename foo Abar +open foo O_RDWR|O_CREAT 0777 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang267 b/src/tests/seq1/j-lang-files/j-lang267 new file mode 100644 index 0000000..187d671 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang267 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open foo O_RDWR|O_CREAT 0777 +close foo +rename foo Abar +sync +checkpoint 1 diff --git a/src/tests/seq1/j-lang-files/j-lang268 b/src/tests/seq1/j-lang-files/j-lang268 new file mode 100644 index 0000000..527c24c --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang268 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +close Afoo +rename Afoo bar +opendir A 0777 +fsync A +checkpoint 1 +close A diff --git a/src/tests/seq1/j-lang-files/j-lang269 b/src/tests/seq1/j-lang-files/j-lang269 new file mode 100644 index 0000000..c675bc5 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang269 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +close Afoo +rename Afoo bar +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang27 b/src/tests/seq1/j-lang-files/j-lang27 new file mode 100644 index 0000000..7c9b46e --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang27 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE 32768 32768 +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang270 b/src/tests/seq1/j-lang-files/j-lang270 new file mode 100644 index 0000000..c2e624c --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang270 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +close Afoo +rename Afoo bar +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang271 b/src/tests/seq1/j-lang-files/j-lang271 new file mode 100644 index 0000000..d6d069e --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang271 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +close Afoo +rename Afoo bar +open Afoo O_RDWR|O_CREAT 0777 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang272 b/src/tests/seq1/j-lang-files/j-lang272 new file mode 100644 index 0000000..7cd848d --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang272 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +close Afoo +rename Afoo bar +opendir test 0777 +fsync test +checkpoint 1 +close test diff --git a/src/tests/seq1/j-lang-files/j-lang273 b/src/tests/seq1/j-lang-files/j-lang273 new file mode 100644 index 0000000..ceba561 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang273 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +close Afoo +rename Afoo bar +open foo O_RDWR|O_CREAT 0777 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang274 b/src/tests/seq1/j-lang-files/j-lang274 new file mode 100644 index 0000000..bb0dd02 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang274 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +close Afoo +rename Afoo bar +sync +checkpoint 1 diff --git a/src/tests/seq1/j-lang-files/j-lang275 b/src/tests/seq1/j-lang-files/j-lang275 new file mode 100644 index 0000000..36bc01e --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang275 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +close Afoo +rename Afoo Abar +opendir A 0777 +fsync A +checkpoint 1 +close A diff --git a/src/tests/seq1/j-lang-files/j-lang276 b/src/tests/seq1/j-lang-files/j-lang276 new file mode 100644 index 0000000..820a2c4 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang276 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +close Afoo +rename Afoo Abar +open Afoo O_RDWR|O_CREAT 0777 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang277 b/src/tests/seq1/j-lang-files/j-lang277 new file mode 100644 index 0000000..2b4640b --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang277 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +close Afoo +rename Afoo Abar +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang278 b/src/tests/seq1/j-lang-files/j-lang278 new file mode 100644 index 0000000..8031dea --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang278 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +close Afoo +rename Afoo Abar +sync +checkpoint 1 diff --git a/src/tests/seq1/j-lang-files/j-lang279 b/src/tests/seq1/j-lang-files/j-lang279 new file mode 100644 index 0000000..d26cdc2 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang279 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open bar O_RDWR|O_CREAT 0777 +close bar +rename bar Abar +opendir A 0777 +fsync A +checkpoint 1 +close A diff --git a/src/tests/seq1/j-lang-files/j-lang28 b/src/tests/seq1/j-lang-files/j-lang28 new file mode 100644 index 0000000..7e17974 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang28 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE 32768 32768 +sync +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang280 b/src/tests/seq1/j-lang-files/j-lang280 new file mode 100644 index 0000000..437cfc2 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang280 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open bar O_RDWR|O_CREAT 0777 +close bar +rename bar Abar +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang281 b/src/tests/seq1/j-lang-files/j-lang281 new file mode 100644 index 0000000..59888bf --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang281 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open bar O_RDWR|O_CREAT 0777 +close bar +rename bar Abar +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang282 b/src/tests/seq1/j-lang-files/j-lang282 new file mode 100644 index 0000000..001abd2 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang282 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open bar O_RDWR|O_CREAT 0777 +close bar +rename bar Abar +open Afoo O_RDWR|O_CREAT 0777 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang283 b/src/tests/seq1/j-lang-files/j-lang283 new file mode 100644 index 0000000..0079ca4 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang283 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open bar O_RDWR|O_CREAT 0777 +close bar +rename bar Abar +opendir test 0777 +fsync test +checkpoint 1 +close test diff --git a/src/tests/seq1/j-lang-files/j-lang284 b/src/tests/seq1/j-lang-files/j-lang284 new file mode 100644 index 0000000..8db6e1e --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang284 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open bar O_RDWR|O_CREAT 0777 +close bar +rename bar Abar +open foo O_RDWR|O_CREAT 0777 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang285 b/src/tests/seq1/j-lang-files/j-lang285 new file mode 100644 index 0000000..7657e54 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang285 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open bar O_RDWR|O_CREAT 0777 +close bar +rename bar Abar +sync +checkpoint 1 diff --git a/src/tests/seq1/j-lang-files/j-lang286 b/src/tests/seq1/j-lang-files/j-lang286 new file mode 100644 index 0000000..ba0544a --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang286 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Abar O_RDWR|O_CREAT 0777 +close Abar +rename Abar bar +opendir A 0777 +fsync A +checkpoint 1 +close A diff --git a/src/tests/seq1/j-lang-files/j-lang287 b/src/tests/seq1/j-lang-files/j-lang287 new file mode 100644 index 0000000..036de14 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang287 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Abar O_RDWR|O_CREAT 0777 +close Abar +rename Abar bar +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang288 b/src/tests/seq1/j-lang-files/j-lang288 new file mode 100644 index 0000000..3662034 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang288 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Abar O_RDWR|O_CREAT 0777 +close Abar +rename Abar bar +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang289 b/src/tests/seq1/j-lang-files/j-lang289 new file mode 100644 index 0000000..78c3822 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang289 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Abar O_RDWR|O_CREAT 0777 +close Abar +rename Abar bar +open Afoo O_RDWR|O_CREAT 0777 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang29 b/src/tests/seq1/j-lang-files/j-lang29 new file mode 100644 index 0000000..ee42053 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang29 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE 0 5000 +opendir test 0777 +fsync test +checkpoint 1 +close foo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang290 b/src/tests/seq1/j-lang-files/j-lang290 new file mode 100644 index 0000000..f782b85 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang290 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Abar O_RDWR|O_CREAT 0777 +close Abar +rename Abar bar +opendir test 0777 +fsync test +checkpoint 1 +close test diff --git a/src/tests/seq1/j-lang-files/j-lang291 b/src/tests/seq1/j-lang-files/j-lang291 new file mode 100644 index 0000000..7235969 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang291 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Abar O_RDWR|O_CREAT 0777 +close Abar +rename Abar bar +open foo O_RDWR|O_CREAT 0777 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang292 b/src/tests/seq1/j-lang-files/j-lang292 new file mode 100644 index 0000000..6e5a76a --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang292 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Abar O_RDWR|O_CREAT 0777 +close Abar +rename Abar bar +sync +checkpoint 1 diff --git a/src/tests/seq1/j-lang-files/j-lang293 b/src/tests/seq1/j-lang-files/j-lang293 new file mode 100644 index 0000000..5232162 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang293 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +opendir A 0777 +close A +rename A B +mkdir A 0777 +opendir A 0777 +fsync A +checkpoint 1 +close A diff --git a/src/tests/seq1/j-lang-files/j-lang294 b/src/tests/seq1/j-lang-files/j-lang294 new file mode 100644 index 0000000..4c0591c --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang294 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +opendir A 0777 +close A +rename A B +opendir test 0777 +fsync test +checkpoint 1 +close test diff --git a/src/tests/seq1/j-lang-files/j-lang295 b/src/tests/seq1/j-lang-files/j-lang295 new file mode 100644 index 0000000..958e570 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang295 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +opendir A 0777 +close A +rename A B +opendir B 0777 +fsync B +checkpoint 1 +close B diff --git a/src/tests/seq1/j-lang-files/j-lang296 b/src/tests/seq1/j-lang-files/j-lang296 new file mode 100644 index 0000000..6763ace --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang296 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +opendir A 0777 +close A +rename A B +sync +checkpoint 1 diff --git a/src/tests/seq1/j-lang-files/j-lang297 b/src/tests/seq1/j-lang-files/j-lang297 new file mode 100644 index 0000000..14f825f --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang297 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +fsetxattr foo +opendir test 0777 +fsync test +checkpoint 1 +close foo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang298 b/src/tests/seq1/j-lang-files/j-lang298 new file mode 100644 index 0000000..47c82c5 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang298 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +fsetxattr foo +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang299 b/src/tests/seq1/j-lang-files/j-lang299 new file mode 100644 index 0000000..429e6ce --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang299 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +fsetxattr foo +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang3 b/src/tests/seq1/j-lang-files/j-lang3 new file mode 100644 index 0000000..099d546 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang3 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang30 b/src/tests/seq1/j-lang-files/j-lang30 new file mode 100644 index 0000000..be8110a --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang30 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE 0 5000 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang300 b/src/tests/seq1/j-lang-files/j-lang300 new file mode 100644 index 0000000..aed3018 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang300 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +fsetxattr foo +sync +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang301 b/src/tests/seq1/j-lang-files/j-lang301 new file mode 100644 index 0000000..5b11199 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang301 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +fsetxattr Afoo +opendir A 0777 +fsync A +checkpoint 1 +close Afoo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang302 b/src/tests/seq1/j-lang-files/j-lang302 new file mode 100644 index 0000000..6f73c4b --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang302 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +fsetxattr Afoo +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang303 b/src/tests/seq1/j-lang-files/j-lang303 new file mode 100644 index 0000000..e6ac407 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang303 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +fsetxattr Afoo +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang304 b/src/tests/seq1/j-lang-files/j-lang304 new file mode 100644 index 0000000..fc8f930 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang304 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +fsetxattr Afoo +sync +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang305 b/src/tests/seq1/j-lang-files/j-lang305 new file mode 100644 index 0000000..4d3ac3b --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang305 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +fsetxattr foo +removexattr foo +opendir test 0777 +fsync test +checkpoint 1 +close foo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang306 b/src/tests/seq1/j-lang-files/j-lang306 new file mode 100644 index 0000000..9bdc6ca --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang306 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +fsetxattr foo +removexattr foo +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang307 b/src/tests/seq1/j-lang-files/j-lang307 new file mode 100644 index 0000000..5a5f8ff --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang307 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +fsetxattr foo +removexattr foo +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang308 b/src/tests/seq1/j-lang-files/j-lang308 new file mode 100644 index 0000000..2aa29b2 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang308 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +fsetxattr foo +removexattr foo +sync +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang309 b/src/tests/seq1/j-lang-files/j-lang309 new file mode 100644 index 0000000..54ec430 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang309 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +fsetxattr Afoo +removexattr Afoo +opendir A 0777 +fsync A +checkpoint 1 +close Afoo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang31 b/src/tests/seq1/j-lang-files/j-lang31 new file mode 100644 index 0000000..d8a3512 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang31 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE 0 5000 +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang310 b/src/tests/seq1/j-lang-files/j-lang310 new file mode 100644 index 0000000..e9aa503 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang310 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +fsetxattr Afoo +removexattr Afoo +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang311 b/src/tests/seq1/j-lang-files/j-lang311 new file mode 100644 index 0000000..142ace7 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang311 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +fsetxattr Afoo +removexattr Afoo +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang312 b/src/tests/seq1/j-lang-files/j-lang312 new file mode 100644 index 0000000..24c426d --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang312 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +fsetxattr Afoo +removexattr Afoo +sync +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang313 b/src/tests/seq1/j-lang-files/j-lang313 new file mode 100644 index 0000000..37f2e71 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang313 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +truncate foo 2500 +opendir test 0777 +fsync test +checkpoint 1 +close foo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang314 b/src/tests/seq1/j-lang-files/j-lang314 new file mode 100644 index 0000000..458e4ab --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang314 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +truncate foo 2500 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang315 b/src/tests/seq1/j-lang-files/j-lang315 new file mode 100644 index 0000000..2d9ddd6 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang315 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +truncate foo 2500 +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang316 b/src/tests/seq1/j-lang-files/j-lang316 new file mode 100644 index 0000000..0b3b6d7 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang316 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +truncate foo 2500 +sync +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang317 b/src/tests/seq1/j-lang-files/j-lang317 new file mode 100644 index 0000000..4491628 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang317 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +truncate Afoo 2500 +opendir A 0777 +fsync A +checkpoint 1 +close Afoo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang318 b/src/tests/seq1/j-lang-files/j-lang318 new file mode 100644 index 0000000..b749935 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang318 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +truncate Afoo 2500 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang319 b/src/tests/seq1/j-lang-files/j-lang319 new file mode 100644 index 0000000..10c6d75 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang319 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +truncate Afoo 2500 +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang32 b/src/tests/seq1/j-lang-files/j-lang32 new file mode 100644 index 0000000..fabd97e --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang32 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE 0 5000 +sync +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang320 b/src/tests/seq1/j-lang-files/j-lang320 new file mode 100644 index 0000000..d8fe59c --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang320 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +truncate Afoo 2500 +sync +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang321 b/src/tests/seq1/j-lang-files/j-lang321 new file mode 100644 index 0000000..7be2ede --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang321 @@ -0,0 +1,25 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +fdatasync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang322 b/src/tests/seq1/j-lang-files/j-lang322 new file mode 100644 index 0000000..7be2ede --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang322 @@ -0,0 +1,25 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +fdatasync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang323 b/src/tests/seq1/j-lang-files/j-lang323 new file mode 100644 index 0000000..7be2ede --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang323 @@ -0,0 +1,25 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +fdatasync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang324 b/src/tests/seq1/j-lang-files/j-lang324 new file mode 100644 index 0000000..7be2ede --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang324 @@ -0,0 +1,25 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +fdatasync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang325 b/src/tests/seq1/j-lang-files/j-lang325 new file mode 100644 index 0000000..232f95e --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang325 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +fdatasync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang326 b/src/tests/seq1/j-lang-files/j-lang326 new file mode 100644 index 0000000..232f95e --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang326 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +fdatasync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang327 b/src/tests/seq1/j-lang-files/j-lang327 new file mode 100644 index 0000000..232f95e --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang327 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +fdatasync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang328 b/src/tests/seq1/j-lang-files/j-lang328 new file mode 100644 index 0000000..232f95e --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang328 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +fdatasync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang33 b/src/tests/seq1/j-lang-files/j-lang33 new file mode 100644 index 0000000..7ec8014 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang33 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE 30768 5000 +opendir test 0777 +fsync test +checkpoint 1 +close foo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang34 b/src/tests/seq1/j-lang-files/j-lang34 new file mode 100644 index 0000000..76e806b --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang34 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE 30768 5000 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang35 b/src/tests/seq1/j-lang-files/j-lang35 new file mode 100644 index 0000000..e38aeb7 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang35 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE 30768 5000 +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang36 b/src/tests/seq1/j-lang-files/j-lang36 new file mode 100644 index 0000000..e5bdbed --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang36 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE 30768 5000 +sync +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang37 b/src/tests/seq1/j-lang-files/j-lang37 new file mode 100644 index 0000000..34df286 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang37 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE 32768 32768 +opendir test 0777 +fsync test +checkpoint 1 +close foo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang38 b/src/tests/seq1/j-lang-files/j-lang38 new file mode 100644 index 0000000..ee0722e --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang38 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE 32768 32768 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang39 b/src/tests/seq1/j-lang-files/j-lang39 new file mode 100644 index 0000000..1f96bb9 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang39 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE 32768 32768 +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang4 b/src/tests/seq1/j-lang-files/j-lang4 new file mode 100644 index 0000000..8b4919e --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang4 @@ -0,0 +1,25 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +sync +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang40 b/src/tests/seq1/j-lang-files/j-lang40 new file mode 100644 index 0000000..4142aa8 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang40 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE 32768 32768 +sync +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang41 b/src/tests/seq1/j-lang-files/j-lang41 new file mode 100644 index 0000000..a7c2ac5 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang41 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE 0 5000 +opendir test 0777 +fsync test +checkpoint 1 +close foo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang42 b/src/tests/seq1/j-lang-files/j-lang42 new file mode 100644 index 0000000..def949b --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang42 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE 0 5000 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang43 b/src/tests/seq1/j-lang-files/j-lang43 new file mode 100644 index 0000000..11fb54d --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang43 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE 0 5000 +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang44 b/src/tests/seq1/j-lang-files/j-lang44 new file mode 100644 index 0000000..649c9e1 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang44 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE 0 5000 +sync +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang45 b/src/tests/seq1/j-lang-files/j-lang45 new file mode 100644 index 0000000..fbb933f --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang45 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE 30768 5000 +opendir test 0777 +fsync test +checkpoint 1 +close foo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang46 b/src/tests/seq1/j-lang-files/j-lang46 new file mode 100644 index 0000000..c9cf6e5 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang46 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE 30768 5000 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang47 b/src/tests/seq1/j-lang-files/j-lang47 new file mode 100644 index 0000000..8c485b7 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang47 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE 30768 5000 +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang48 b/src/tests/seq1/j-lang-files/j-lang48 new file mode 100644 index 0000000..3862ff2 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang48 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE 30768 5000 +sync +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang49 b/src/tests/seq1/j-lang-files/j-lang49 new file mode 100644 index 0000000..4acbc08 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang49 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_KEEP_SIZE 32768 32768 +opendir test 0777 +fsync test +checkpoint 1 +close foo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang5 b/src/tests/seq1/j-lang-files/j-lang5 new file mode 100644 index 0000000..642e06b --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang5 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +opendir A 0777 +fsync A +checkpoint 1 +close Afoo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang50 b/src/tests/seq1/j-lang-files/j-lang50 new file mode 100644 index 0000000..0ddc618 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang50 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_KEEP_SIZE 32768 32768 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang51 b/src/tests/seq1/j-lang-files/j-lang51 new file mode 100644 index 0000000..d1e0b9b --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang51 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_KEEP_SIZE 32768 32768 +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang52 b/src/tests/seq1/j-lang-files/j-lang52 new file mode 100644 index 0000000..7d72029 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang52 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_KEEP_SIZE 32768 32768 +sync +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang53 b/src/tests/seq1/j-lang-files/j-lang53 new file mode 100644 index 0000000..1a72b4a --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang53 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_KEEP_SIZE 0 5000 +opendir test 0777 +fsync test +checkpoint 1 +close foo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang54 b/src/tests/seq1/j-lang-files/j-lang54 new file mode 100644 index 0000000..0f34e3e --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang54 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_KEEP_SIZE 0 5000 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang55 b/src/tests/seq1/j-lang-files/j-lang55 new file mode 100644 index 0000000..656b624 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang55 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_KEEP_SIZE 0 5000 +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang56 b/src/tests/seq1/j-lang-files/j-lang56 new file mode 100644 index 0000000..363ed7e --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang56 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_KEEP_SIZE 0 5000 +sync +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang57 b/src/tests/seq1/j-lang-files/j-lang57 new file mode 100644 index 0000000..cd74d0a --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang57 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_KEEP_SIZE 30768 5000 +opendir test 0777 +fsync test +checkpoint 1 +close foo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang58 b/src/tests/seq1/j-lang-files/j-lang58 new file mode 100644 index 0000000..7899a4f --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang58 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_KEEP_SIZE 30768 5000 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang59 b/src/tests/seq1/j-lang-files/j-lang59 new file mode 100644 index 0000000..49432c9 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang59 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_KEEP_SIZE 30768 5000 +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang6 b/src/tests/seq1/j-lang-files/j-lang6 new file mode 100644 index 0000000..5419962 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang6 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang60 b/src/tests/seq1/j-lang-files/j-lang60 new file mode 100644 index 0000000..af8b802 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang60 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo FALLOC_FL_KEEP_SIZE 30768 5000 +sync +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang61 b/src/tests/seq1/j-lang-files/j-lang61 new file mode 100644 index 0000000..ac6fe99 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang61 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo 0 32768 32768 +opendir test 0777 +fsync test +checkpoint 1 +close foo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang62 b/src/tests/seq1/j-lang-files/j-lang62 new file mode 100644 index 0000000..ed8c498 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang62 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo 0 32768 32768 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang63 b/src/tests/seq1/j-lang-files/j-lang63 new file mode 100644 index 0000000..9e4d410 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang63 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo 0 32768 32768 +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang64 b/src/tests/seq1/j-lang-files/j-lang64 new file mode 100644 index 0000000..40be0fa --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang64 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo 0 32768 32768 +sync +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang65 b/src/tests/seq1/j-lang-files/j-lang65 new file mode 100644 index 0000000..d84c13a --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang65 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo 0 0 5000 +opendir test 0777 +fsync test +checkpoint 1 +close foo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang66 b/src/tests/seq1/j-lang-files/j-lang66 new file mode 100644 index 0000000..ed0ed63 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang66 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo 0 0 5000 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang67 b/src/tests/seq1/j-lang-files/j-lang67 new file mode 100644 index 0000000..e6c6369 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang67 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo 0 0 5000 +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang68 b/src/tests/seq1/j-lang-files/j-lang68 new file mode 100644 index 0000000..37eaf80 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang68 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo 0 0 5000 +sync +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang69 b/src/tests/seq1/j-lang-files/j-lang69 new file mode 100644 index 0000000..d7b64f7 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang69 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo 0 30768 5000 +opendir test 0777 +fsync test +checkpoint 1 +close foo +close test diff --git a/src/tests/seq1/j-lang-files/j-lang7 b/src/tests/seq1/j-lang-files/j-lang7 new file mode 100644 index 0000000..a469200 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang7 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang70 b/src/tests/seq1/j-lang-files/j-lang70 new file mode 100644 index 0000000..696bb1b --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang70 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo 0 30768 5000 +fsync foo +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang71 b/src/tests/seq1/j-lang-files/j-lang71 new file mode 100644 index 0000000..f21bc0b --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang71 @@ -0,0 +1,29 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo 0 30768 5000 +open bar O_RDWR|O_CREAT 0777 +fsync bar +checkpoint 1 +close foo +close bar diff --git a/src/tests/seq1/j-lang-files/j-lang72 b/src/tests/seq1/j-lang-files/j-lang72 new file mode 100644 index 0000000..59f4673 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang72 @@ -0,0 +1,27 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +open foo O_RDWR|O_CREAT 0777 +write foo 0 32768 +falloc foo 0 30768 5000 +sync +checkpoint 1 +close foo diff --git a/src/tests/seq1/j-lang-files/j-lang73 b/src/tests/seq1/j-lang-files/j-lang73 new file mode 100644 index 0000000..a89a689 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang73 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_ZERO_RANGE 32768 32768 +opendir A 0777 +fsync A +checkpoint 1 +close Afoo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang74 b/src/tests/seq1/j-lang-files/j-lang74 new file mode 100644 index 0000000..6440b33 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang74 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_ZERO_RANGE 32768 32768 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang75 b/src/tests/seq1/j-lang-files/j-lang75 new file mode 100644 index 0000000..664dedd --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang75 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_ZERO_RANGE 32768 32768 +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang76 b/src/tests/seq1/j-lang-files/j-lang76 new file mode 100644 index 0000000..4122cef --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang76 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_ZERO_RANGE 32768 32768 +sync +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang77 b/src/tests/seq1/j-lang-files/j-lang77 new file mode 100644 index 0000000..a7e5e9a --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang77 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_ZERO_RANGE 0 5000 +opendir A 0777 +fsync A +checkpoint 1 +close Afoo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang78 b/src/tests/seq1/j-lang-files/j-lang78 new file mode 100644 index 0000000..044c6ad --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang78 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_ZERO_RANGE 0 5000 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang79 b/src/tests/seq1/j-lang-files/j-lang79 new file mode 100644 index 0000000..3f6daf0 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang79 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_ZERO_RANGE 0 5000 +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang8 b/src/tests/seq1/j-lang-files/j-lang8 new file mode 100644 index 0000000..970a83c --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang8 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +sync +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang80 b/src/tests/seq1/j-lang-files/j-lang80 new file mode 100644 index 0000000..6d6af4b --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang80 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_ZERO_RANGE 0 5000 +sync +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang81 b/src/tests/seq1/j-lang-files/j-lang81 new file mode 100644 index 0000000..84d8170 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang81 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_ZERO_RANGE 30768 5000 +opendir A 0777 +fsync A +checkpoint 1 +close Afoo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang82 b/src/tests/seq1/j-lang-files/j-lang82 new file mode 100644 index 0000000..c06381c --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang82 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_ZERO_RANGE 30768 5000 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang83 b/src/tests/seq1/j-lang-files/j-lang83 new file mode 100644 index 0000000..ac7091f --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang83 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_ZERO_RANGE 30768 5000 +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang84 b/src/tests/seq1/j-lang-files/j-lang84 new file mode 100644 index 0000000..44d4b5c --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang84 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_ZERO_RANGE 30768 5000 +sync +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang85 b/src/tests/seq1/j-lang-files/j-lang85 new file mode 100644 index 0000000..9ebe26b --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang85 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE 32768 32768 +opendir A 0777 +fsync A +checkpoint 1 +close Afoo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang86 b/src/tests/seq1/j-lang-files/j-lang86 new file mode 100644 index 0000000..6e4fd0a --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang86 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE 32768 32768 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang87 b/src/tests/seq1/j-lang-files/j-lang87 new file mode 100644 index 0000000..cf571af --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang87 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE 32768 32768 +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang88 b/src/tests/seq1/j-lang-files/j-lang88 new file mode 100644 index 0000000..53a5138 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang88 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE 32768 32768 +sync +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang89 b/src/tests/seq1/j-lang-files/j-lang89 new file mode 100644 index 0000000..eef02d4 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang89 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE 0 5000 +opendir A 0777 +fsync A +checkpoint 1 +close Afoo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang9 b/src/tests/seq1/j-lang-files/j-lang9 new file mode 100644 index 0000000..954d795 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang9 @@ -0,0 +1,26 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +opendir A 0777 +fsync A +checkpoint 1 +close A diff --git a/src/tests/seq1/j-lang-files/j-lang90 b/src/tests/seq1/j-lang-files/j-lang90 new file mode 100644 index 0000000..8a54bed --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang90 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE 0 5000 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang91 b/src/tests/seq1/j-lang-files/j-lang91 new file mode 100644 index 0000000..305b06d --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang91 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE 0 5000 +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang92 b/src/tests/seq1/j-lang-files/j-lang92 new file mode 100644 index 0000000..e1f3991 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang92 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE 0 5000 +sync +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang93 b/src/tests/seq1/j-lang-files/j-lang93 new file mode 100644 index 0000000..3b9cce9 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang93 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE 30768 5000 +opendir A 0777 +fsync A +checkpoint 1 +close Afoo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang94 b/src/tests/seq1/j-lang-files/j-lang94 new file mode 100644 index 0000000..1efe375 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang94 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE 30768 5000 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang95 b/src/tests/seq1/j-lang-files/j-lang95 new file mode 100644 index 0000000..32e8bf6 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang95 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE 30768 5000 +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang-files/j-lang96 b/src/tests/seq1/j-lang-files/j-lang96 new file mode 100644 index 0000000..a23e727 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang96 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE 30768 5000 +sync +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang97 b/src/tests/seq1/j-lang-files/j-lang97 new file mode 100644 index 0000000..6aa2db9 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang97 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE 32768 32768 +opendir A 0777 +fsync A +checkpoint 1 +close Afoo +close A diff --git a/src/tests/seq1/j-lang-files/j-lang98 b/src/tests/seq1/j-lang-files/j-lang98 new file mode 100644 index 0000000..6d7abd1 --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang98 @@ -0,0 +1,28 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE 32768 32768 +fsync Afoo +checkpoint 1 +close Afoo diff --git a/src/tests/seq1/j-lang-files/j-lang99 b/src/tests/seq1/j-lang-files/j-lang99 new file mode 100644 index 0000000..c9d2cae --- /dev/null +++ b/src/tests/seq1/j-lang-files/j-lang99 @@ -0,0 +1,30 @@ +# define +test +A +A/C +B +foo +bar +A/foo +A/bar +B/foo +B/bar +A/C/foo +A/C/bar + +# declare +local_checkpoint + +# setup + + +# run +mkdir A 0777 +open Afoo O_RDWR|O_CREAT 0777 +write Afoo 0 32768 +falloc Afoo FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE 32768 32768 +open Abar O_RDWR|O_CREAT 0777 +fsync Abar +checkpoint 1 +close Afoo +close Abar diff --git a/src/tests/seq1/j-lang1.cpp b/src/tests/seq1/j-lang1.cpp new file mode 100644 index 0000000..73e5286 --- /dev/null +++ b/src/tests/seq1/j-lang1.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang10.cpp b/src/tests/seq1/j-lang10.cpp new file mode 100644 index 0000000..915d5d6 --- /dev/null +++ b/src/tests/seq1/j-lang10.cpp @@ -0,0 +1,139 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang100.cpp b/src/tests/seq1/j-lang100.cpp new file mode 100644 index 0000000..6204737 --- /dev/null +++ b/src/tests/seq1/j-lang100.cpp @@ -0,0 +1,149 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE , 32768 , 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang101.cpp b/src/tests/seq1/j-lang101.cpp new file mode 100644 index 0000000..4eadbbb --- /dev/null +++ b/src/tests/seq1/j-lang101.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE , 0 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang102.cpp b/src/tests/seq1/j-lang102.cpp new file mode 100644 index 0000000..4ce42e3 --- /dev/null +++ b/src/tests/seq1/j-lang102.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE , 0 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang103.cpp b/src/tests/seq1/j-lang103.cpp new file mode 100644 index 0000000..b752bfb --- /dev/null +++ b/src/tests/seq1/j-lang103.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE , 0 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang104.cpp b/src/tests/seq1/j-lang104.cpp new file mode 100644 index 0000000..1b81c84 --- /dev/null +++ b/src/tests/seq1/j-lang104.cpp @@ -0,0 +1,149 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE , 0 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang105.cpp b/src/tests/seq1/j-lang105.cpp new file mode 100644 index 0000000..63b1120 --- /dev/null +++ b/src/tests/seq1/j-lang105.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE , 30768 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang106.cpp b/src/tests/seq1/j-lang106.cpp new file mode 100644 index 0000000..c4f5b72 --- /dev/null +++ b/src/tests/seq1/j-lang106.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE , 30768 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang107.cpp b/src/tests/seq1/j-lang107.cpp new file mode 100644 index 0000000..24b6608 --- /dev/null +++ b/src/tests/seq1/j-lang107.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE , 30768 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang108.cpp b/src/tests/seq1/j-lang108.cpp new file mode 100644 index 0000000..2c0993f --- /dev/null +++ b/src/tests/seq1/j-lang108.cpp @@ -0,0 +1,149 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE , 30768 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang109.cpp b/src/tests/seq1/j-lang109.cpp new file mode 100644 index 0000000..a09f778 --- /dev/null +++ b/src/tests/seq1/j-lang109.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_KEEP_SIZE , 32768 , 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang11.cpp b/src/tests/seq1/j-lang11.cpp new file mode 100644 index 0000000..922812a --- /dev/null +++ b/src/tests/seq1/j-lang11.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + if ( mkdir(B_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_B = cm_->CmOpen(B_path.c_str() , O_DIRECTORY , 0777); + if ( fd_B < 0 ) { + cm_->CmClose( fd_B); + return errno; + } + + + if ( cm_->CmFsync( fd_B) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_B) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang110.cpp b/src/tests/seq1/j-lang110.cpp new file mode 100644 index 0000000..9cdfc22 --- /dev/null +++ b/src/tests/seq1/j-lang110.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_KEEP_SIZE , 32768 , 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang111.cpp b/src/tests/seq1/j-lang111.cpp new file mode 100644 index 0000000..9b898f1 --- /dev/null +++ b/src/tests/seq1/j-lang111.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_KEEP_SIZE , 32768 , 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang112.cpp b/src/tests/seq1/j-lang112.cpp new file mode 100644 index 0000000..1b386c6 --- /dev/null +++ b/src/tests/seq1/j-lang112.cpp @@ -0,0 +1,149 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_KEEP_SIZE , 32768 , 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang113.cpp b/src/tests/seq1/j-lang113.cpp new file mode 100644 index 0000000..cd38e6b --- /dev/null +++ b/src/tests/seq1/j-lang113.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_KEEP_SIZE , 0 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang114.cpp b/src/tests/seq1/j-lang114.cpp new file mode 100644 index 0000000..34f3ded --- /dev/null +++ b/src/tests/seq1/j-lang114.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_KEEP_SIZE , 0 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang115.cpp b/src/tests/seq1/j-lang115.cpp new file mode 100644 index 0000000..737efcf --- /dev/null +++ b/src/tests/seq1/j-lang115.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_KEEP_SIZE , 0 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang116.cpp b/src/tests/seq1/j-lang116.cpp new file mode 100644 index 0000000..81faa83 --- /dev/null +++ b/src/tests/seq1/j-lang116.cpp @@ -0,0 +1,149 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_KEEP_SIZE , 0 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang117.cpp b/src/tests/seq1/j-lang117.cpp new file mode 100644 index 0000000..df95ce1 --- /dev/null +++ b/src/tests/seq1/j-lang117.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_KEEP_SIZE , 30768 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang118.cpp b/src/tests/seq1/j-lang118.cpp new file mode 100644 index 0000000..6d63e0c --- /dev/null +++ b/src/tests/seq1/j-lang118.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_KEEP_SIZE , 30768 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang119.cpp b/src/tests/seq1/j-lang119.cpp new file mode 100644 index 0000000..e499cd2 --- /dev/null +++ b/src/tests/seq1/j-lang119.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_KEEP_SIZE , 30768 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang12.cpp b/src/tests/seq1/j-lang12.cpp new file mode 100644 index 0000000..abfd161 --- /dev/null +++ b/src/tests/seq1/j-lang12.cpp @@ -0,0 +1,125 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang120.cpp b/src/tests/seq1/j-lang120.cpp new file mode 100644 index 0000000..58357a1 --- /dev/null +++ b/src/tests/seq1/j-lang120.cpp @@ -0,0 +1,149 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_KEEP_SIZE , 30768 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang121.cpp b/src/tests/seq1/j-lang121.cpp new file mode 100644 index 0000000..154b12a --- /dev/null +++ b/src/tests/seq1/j-lang121.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , 0 , 32768 , 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang122.cpp b/src/tests/seq1/j-lang122.cpp new file mode 100644 index 0000000..6ae1e46 --- /dev/null +++ b/src/tests/seq1/j-lang122.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , 0 , 32768 , 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang123.cpp b/src/tests/seq1/j-lang123.cpp new file mode 100644 index 0000000..490f965 --- /dev/null +++ b/src/tests/seq1/j-lang123.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , 0 , 32768 , 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang124.cpp b/src/tests/seq1/j-lang124.cpp new file mode 100644 index 0000000..3008d9c --- /dev/null +++ b/src/tests/seq1/j-lang124.cpp @@ -0,0 +1,149 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , 0 , 32768 , 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang125.cpp b/src/tests/seq1/j-lang125.cpp new file mode 100644 index 0000000..bb8abbd --- /dev/null +++ b/src/tests/seq1/j-lang125.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , 0 , 0 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang126.cpp b/src/tests/seq1/j-lang126.cpp new file mode 100644 index 0000000..9187a45 --- /dev/null +++ b/src/tests/seq1/j-lang126.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , 0 , 0 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang127.cpp b/src/tests/seq1/j-lang127.cpp new file mode 100644 index 0000000..0698daa --- /dev/null +++ b/src/tests/seq1/j-lang127.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , 0 , 0 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang128.cpp b/src/tests/seq1/j-lang128.cpp new file mode 100644 index 0000000..dededfa --- /dev/null +++ b/src/tests/seq1/j-lang128.cpp @@ -0,0 +1,149 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , 0 , 0 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang129.cpp b/src/tests/seq1/j-lang129.cpp new file mode 100644 index 0000000..fa702fa --- /dev/null +++ b/src/tests/seq1/j-lang129.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , 0 , 30768 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang13.cpp b/src/tests/seq1/j-lang13.cpp new file mode 100644 index 0000000..35f50ff --- /dev/null +++ b/src/tests/seq1/j-lang13.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_ZERO_RANGE , 32768 , 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang130.cpp b/src/tests/seq1/j-lang130.cpp new file mode 100644 index 0000000..6f27ed2 --- /dev/null +++ b/src/tests/seq1/j-lang130.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , 0 , 30768 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang131.cpp b/src/tests/seq1/j-lang131.cpp new file mode 100644 index 0000000..ee80fce --- /dev/null +++ b/src/tests/seq1/j-lang131.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , 0 , 30768 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang132.cpp b/src/tests/seq1/j-lang132.cpp new file mode 100644 index 0000000..50b879c --- /dev/null +++ b/src/tests/seq1/j-lang132.cpp @@ -0,0 +1,149 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , 0 , 30768 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang133.cpp b/src/tests/seq1/j-lang133.cpp new file mode 100644 index 0000000..374100a --- /dev/null +++ b/src/tests/seq1/j-lang133.cpp @@ -0,0 +1,152 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang134.cpp b/src/tests/seq1/j-lang134.cpp new file mode 100644 index 0000000..fcdff7b --- /dev/null +++ b/src/tests/seq1/j-lang134.cpp @@ -0,0 +1,140 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang135.cpp b/src/tests/seq1/j-lang135.cpp new file mode 100644 index 0000000..e567e44 --- /dev/null +++ b/src/tests/seq1/j-lang135.cpp @@ -0,0 +1,152 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang136.cpp b/src/tests/seq1/j-lang136.cpp new file mode 100644 index 0000000..d2b2c6d --- /dev/null +++ b/src/tests/seq1/j-lang136.cpp @@ -0,0 +1,138 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang137.cpp b/src/tests/seq1/j-lang137.cpp new file mode 100644 index 0000000..0bbed9f --- /dev/null +++ b/src/tests/seq1/j-lang137.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang138.cpp b/src/tests/seq1/j-lang138.cpp new file mode 100644 index 0000000..e08ac9b --- /dev/null +++ b/src/tests/seq1/j-lang138.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang139.cpp b/src/tests/seq1/j-lang139.cpp new file mode 100644 index 0000000..b505463 --- /dev/null +++ b/src/tests/seq1/j-lang139.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang14.cpp b/src/tests/seq1/j-lang14.cpp new file mode 100644 index 0000000..117d329 --- /dev/null +++ b/src/tests/seq1/j-lang14.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_ZERO_RANGE , 32768 , 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang140.cpp b/src/tests/seq1/j-lang140.cpp new file mode 100644 index 0000000..9a38f8a --- /dev/null +++ b/src/tests/seq1/j-lang140.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang141.cpp b/src/tests/seq1/j-lang141.cpp new file mode 100644 index 0000000..2999e17 --- /dev/null +++ b/src/tests/seq1/j-lang141.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 30768, 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang142.cpp b/src/tests/seq1/j-lang142.cpp new file mode 100644 index 0000000..eeea250 --- /dev/null +++ b/src/tests/seq1/j-lang142.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 30768, 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang143.cpp b/src/tests/seq1/j-lang143.cpp new file mode 100644 index 0000000..e74c1af --- /dev/null +++ b/src/tests/seq1/j-lang143.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 30768, 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang144.cpp b/src/tests/seq1/j-lang144.cpp new file mode 100644 index 0000000..486eac9 --- /dev/null +++ b/src/tests/seq1/j-lang144.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 30768, 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang145.cpp b/src/tests/seq1/j-lang145.cpp new file mode 100644 index 0000000..22ab6f7 --- /dev/null +++ b/src/tests/seq1/j-lang145.cpp @@ -0,0 +1,157 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang146.cpp b/src/tests/seq1/j-lang146.cpp new file mode 100644 index 0000000..3f3cad5 --- /dev/null +++ b/src/tests/seq1/j-lang146.cpp @@ -0,0 +1,145 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang147.cpp b/src/tests/seq1/j-lang147.cpp new file mode 100644 index 0000000..f65e3df --- /dev/null +++ b/src/tests/seq1/j-lang147.cpp @@ -0,0 +1,157 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang148.cpp b/src/tests/seq1/j-lang148.cpp new file mode 100644 index 0000000..c824457 --- /dev/null +++ b/src/tests/seq1/j-lang148.cpp @@ -0,0 +1,143 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang149.cpp b/src/tests/seq1/j-lang149.cpp new file mode 100644 index 0000000..09fb3b7 --- /dev/null +++ b/src/tests/seq1/j-lang149.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang15.cpp b/src/tests/seq1/j-lang15.cpp new file mode 100644 index 0000000..69124cb --- /dev/null +++ b/src/tests/seq1/j-lang15.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_ZERO_RANGE , 32768 , 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang150.cpp b/src/tests/seq1/j-lang150.cpp new file mode 100644 index 0000000..989592c --- /dev/null +++ b/src/tests/seq1/j-lang150.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang151.cpp b/src/tests/seq1/j-lang151.cpp new file mode 100644 index 0000000..0064f86 --- /dev/null +++ b/src/tests/seq1/j-lang151.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang152.cpp b/src/tests/seq1/j-lang152.cpp new file mode 100644 index 0000000..8d4dae9 --- /dev/null +++ b/src/tests/seq1/j-lang152.cpp @@ -0,0 +1,149 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang153.cpp b/src/tests/seq1/j-lang153.cpp new file mode 100644 index 0000000..dc989bb --- /dev/null +++ b/src/tests/seq1/j-lang153.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 30768, 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang154.cpp b/src/tests/seq1/j-lang154.cpp new file mode 100644 index 0000000..bf956de --- /dev/null +++ b/src/tests/seq1/j-lang154.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 30768, 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang155.cpp b/src/tests/seq1/j-lang155.cpp new file mode 100644 index 0000000..084f3d6 --- /dev/null +++ b/src/tests/seq1/j-lang155.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 30768, 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang156.cpp b/src/tests/seq1/j-lang156.cpp new file mode 100644 index 0000000..539c335 --- /dev/null +++ b/src/tests/seq1/j-lang156.cpp @@ -0,0 +1,149 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 30768, 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang157.cpp b/src/tests/seq1/j-lang157.cpp new file mode 100644 index 0000000..6b534de --- /dev/null +++ b/src/tests/seq1/j-lang157.cpp @@ -0,0 +1,175 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmClose(fd_foo); + fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_DIRECT|O_SYNC , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + void* data_foo; + if (posix_memalign(&data_foo , 4096, 32768 ) < 0) { + return errno; + } + + + int offset_foo = 0; + int to_write_foo = 32768 ; + const char *text_foo = "ddddddddddklmnopqrstuvwxyz123456"; + while (offset_foo < 32768){ + if (to_write_foo < 32){ + memcpy((char *)data_foo+ offset_foo, text_foo, to_write_foo); + offset_foo += to_write_foo; + } + else { + memcpy((char *)data_foo+ offset_foo,text_foo, 32); + offset_foo += 32; + } + } + + if ( pwrite ( fd_foo, data_foo, 32768, 0) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + cm_->CmClose(fd_foo); + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang158.cpp b/src/tests/seq1/j-lang158.cpp new file mode 100644 index 0000000..e43e01d --- /dev/null +++ b/src/tests/seq1/j-lang158.cpp @@ -0,0 +1,175 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmClose(fd_foo); + fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_DIRECT|O_SYNC , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + void* data_foo; + if (posix_memalign(&data_foo , 4096, 32768 ) < 0) { + return errno; + } + + + int offset_foo = 0; + int to_write_foo = 32768 ; + const char *text_foo = "ddddddddddklmnopqrstuvwxyz123456"; + while (offset_foo < 32768){ + if (to_write_foo < 32){ + memcpy((char *)data_foo+ offset_foo, text_foo, to_write_foo); + offset_foo += to_write_foo; + } + else { + memcpy((char *)data_foo+ offset_foo,text_foo, 32); + offset_foo += 32; + } + } + + if ( pwrite ( fd_foo, data_foo, 32768, 0) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + cm_->CmClose(fd_foo); + + fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang159.cpp b/src/tests/seq1/j-lang159.cpp new file mode 100644 index 0000000..bd25c81 --- /dev/null +++ b/src/tests/seq1/j-lang159.cpp @@ -0,0 +1,175 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmClose(fd_foo); + fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_DIRECT|O_SYNC , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + void* data_foo; + if (posix_memalign(&data_foo , 4096, 32768 ) < 0) { + return errno; + } + + + int offset_foo = 0; + int to_write_foo = 32768 ; + const char *text_foo = "ddddddddddklmnopqrstuvwxyz123456"; + while (offset_foo < 32768){ + if (to_write_foo < 32){ + memcpy((char *)data_foo+ offset_foo, text_foo, to_write_foo); + offset_foo += to_write_foo; + } + else { + memcpy((char *)data_foo+ offset_foo,text_foo, 32); + offset_foo += 32; + } + } + + if ( pwrite ( fd_foo, data_foo, 32768, 0) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + cm_->CmClose(fd_foo); + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang16.cpp b/src/tests/seq1/j-lang16.cpp new file mode 100644 index 0000000..e52b8fb --- /dev/null +++ b/src/tests/seq1/j-lang16.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_ZERO_RANGE , 32768 , 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang160.cpp b/src/tests/seq1/j-lang160.cpp new file mode 100644 index 0000000..95647b9 --- /dev/null +++ b/src/tests/seq1/j-lang160.cpp @@ -0,0 +1,161 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmClose(fd_foo); + fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_DIRECT|O_SYNC , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + void* data_foo; + if (posix_memalign(&data_foo , 4096, 32768 ) < 0) { + return errno; + } + + + int offset_foo = 0; + int to_write_foo = 32768 ; + const char *text_foo = "ddddddddddklmnopqrstuvwxyz123456"; + while (offset_foo < 32768){ + if (to_write_foo < 32){ + memcpy((char *)data_foo+ offset_foo, text_foo, to_write_foo); + offset_foo += to_write_foo; + } + else { + memcpy((char *)data_foo+ offset_foo,text_foo, 32); + offset_foo += 32; + } + } + + if ( pwrite ( fd_foo, data_foo, 32768, 0) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + cm_->CmClose(fd_foo); + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang161.cpp b/src/tests/seq1/j-lang161.cpp new file mode 100644 index 0000000..efe9875 --- /dev/null +++ b/src/tests/seq1/j-lang161.cpp @@ -0,0 +1,181 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmClose(fd_foo); + fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_DIRECT|O_SYNC , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + void* data_foo; + if (posix_memalign(&data_foo , 4096, 8192 ) < 0) { + return errno; + } + + + int offset_foo = 0; + int to_write_foo = 8192 ; + const char *text_foo = "ddddddddddklmnopqrstuvwxyz123456"; + while (offset_foo < 8192){ + if (to_write_foo < 32){ + memcpy((char *)data_foo+ offset_foo, text_foo, to_write_foo); + offset_foo += to_write_foo; + } + else { + memcpy((char *)data_foo+ offset_foo,text_foo, 32); + offset_foo += 32; + } + } + + if ( pwrite ( fd_foo, data_foo, 8192, 0) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + cm_->CmClose(fd_foo); + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang162.cpp b/src/tests/seq1/j-lang162.cpp new file mode 100644 index 0000000..4257293 --- /dev/null +++ b/src/tests/seq1/j-lang162.cpp @@ -0,0 +1,181 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmClose(fd_foo); + fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_DIRECT|O_SYNC , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + void* data_foo; + if (posix_memalign(&data_foo , 4096, 8192 ) < 0) { + return errno; + } + + + int offset_foo = 0; + int to_write_foo = 8192 ; + const char *text_foo = "ddddddddddklmnopqrstuvwxyz123456"; + while (offset_foo < 8192){ + if (to_write_foo < 32){ + memcpy((char *)data_foo+ offset_foo, text_foo, to_write_foo); + offset_foo += to_write_foo; + } + else { + memcpy((char *)data_foo+ offset_foo,text_foo, 32); + offset_foo += 32; + } + } + + if ( pwrite ( fd_foo, data_foo, 8192, 0) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + cm_->CmClose(fd_foo); + + fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang163.cpp b/src/tests/seq1/j-lang163.cpp new file mode 100644 index 0000000..08a5405 --- /dev/null +++ b/src/tests/seq1/j-lang163.cpp @@ -0,0 +1,181 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmClose(fd_foo); + fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_DIRECT|O_SYNC , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + void* data_foo; + if (posix_memalign(&data_foo , 4096, 8192 ) < 0) { + return errno; + } + + + int offset_foo = 0; + int to_write_foo = 8192 ; + const char *text_foo = "ddddddddddklmnopqrstuvwxyz123456"; + while (offset_foo < 8192){ + if (to_write_foo < 32){ + memcpy((char *)data_foo+ offset_foo, text_foo, to_write_foo); + offset_foo += to_write_foo; + } + else { + memcpy((char *)data_foo+ offset_foo,text_foo, 32); + offset_foo += 32; + } + } + + if ( pwrite ( fd_foo, data_foo, 8192, 0) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + cm_->CmClose(fd_foo); + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang164.cpp b/src/tests/seq1/j-lang164.cpp new file mode 100644 index 0000000..e564e49 --- /dev/null +++ b/src/tests/seq1/j-lang164.cpp @@ -0,0 +1,167 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmClose(fd_foo); + fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_DIRECT|O_SYNC , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + void* data_foo; + if (posix_memalign(&data_foo , 4096, 8192 ) < 0) { + return errno; + } + + + int offset_foo = 0; + int to_write_foo = 8192 ; + const char *text_foo = "ddddddddddklmnopqrstuvwxyz123456"; + while (offset_foo < 8192){ + if (to_write_foo < 32){ + memcpy((char *)data_foo+ offset_foo, text_foo, to_write_foo); + offset_foo += to_write_foo; + } + else { + memcpy((char *)data_foo+ offset_foo,text_foo, 32); + offset_foo += 32; + } + } + + if ( pwrite ( fd_foo, data_foo, 8192, 0) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + cm_->CmClose(fd_foo); + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang165.cpp b/src/tests/seq1/j-lang165.cpp new file mode 100644 index 0000000..bfb1937 --- /dev/null +++ b/src/tests/seq1/j-lang165.cpp @@ -0,0 +1,180 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmClose(fd_Afoo); + fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_DIRECT|O_SYNC , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + void* data_Afoo; + if (posix_memalign(&data_Afoo , 4096, 32768 ) < 0) { + return errno; + } + + + int offset_Afoo = 0; + int to_write_Afoo = 32768 ; + const char *text_Afoo = "ddddddddddklmnopqrstuvwxyz123456"; + while (offset_Afoo < 32768){ + if (to_write_Afoo < 32){ + memcpy((char *)data_Afoo+ offset_Afoo, text_Afoo, to_write_Afoo); + offset_Afoo += to_write_Afoo; + } + else { + memcpy((char *)data_Afoo+ offset_Afoo,text_Afoo, 32); + offset_Afoo += 32; + } + } + + if ( pwrite ( fd_Afoo, data_Afoo, 32768, 0) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + cm_->CmClose(fd_Afoo); + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang166.cpp b/src/tests/seq1/j-lang166.cpp new file mode 100644 index 0000000..f535b36 --- /dev/null +++ b/src/tests/seq1/j-lang166.cpp @@ -0,0 +1,180 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmClose(fd_Afoo); + fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_DIRECT|O_SYNC , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + void* data_Afoo; + if (posix_memalign(&data_Afoo , 4096, 32768 ) < 0) { + return errno; + } + + + int offset_Afoo = 0; + int to_write_Afoo = 32768 ; + const char *text_Afoo = "ddddddddddklmnopqrstuvwxyz123456"; + while (offset_Afoo < 32768){ + if (to_write_Afoo < 32){ + memcpy((char *)data_Afoo+ offset_Afoo, text_Afoo, to_write_Afoo); + offset_Afoo += to_write_Afoo; + } + else { + memcpy((char *)data_Afoo+ offset_Afoo,text_Afoo, 32); + offset_Afoo += 32; + } + } + + if ( pwrite ( fd_Afoo, data_Afoo, 32768, 0) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + cm_->CmClose(fd_Afoo); + + fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang167.cpp b/src/tests/seq1/j-lang167.cpp new file mode 100644 index 0000000..fa84045 --- /dev/null +++ b/src/tests/seq1/j-lang167.cpp @@ -0,0 +1,180 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmClose(fd_Afoo); + fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_DIRECT|O_SYNC , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + void* data_Afoo; + if (posix_memalign(&data_Afoo , 4096, 32768 ) < 0) { + return errno; + } + + + int offset_Afoo = 0; + int to_write_Afoo = 32768 ; + const char *text_Afoo = "ddddddddddklmnopqrstuvwxyz123456"; + while (offset_Afoo < 32768){ + if (to_write_Afoo < 32){ + memcpy((char *)data_Afoo+ offset_Afoo, text_Afoo, to_write_Afoo); + offset_Afoo += to_write_Afoo; + } + else { + memcpy((char *)data_Afoo+ offset_Afoo,text_Afoo, 32); + offset_Afoo += 32; + } + } + + if ( pwrite ( fd_Afoo, data_Afoo, 32768, 0) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + cm_->CmClose(fd_Afoo); + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang168.cpp b/src/tests/seq1/j-lang168.cpp new file mode 100644 index 0000000..931b7b0 --- /dev/null +++ b/src/tests/seq1/j-lang168.cpp @@ -0,0 +1,166 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmClose(fd_Afoo); + fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_DIRECT|O_SYNC , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + void* data_Afoo; + if (posix_memalign(&data_Afoo , 4096, 32768 ) < 0) { + return errno; + } + + + int offset_Afoo = 0; + int to_write_Afoo = 32768 ; + const char *text_Afoo = "ddddddddddklmnopqrstuvwxyz123456"; + while (offset_Afoo < 32768){ + if (to_write_Afoo < 32){ + memcpy((char *)data_Afoo+ offset_Afoo, text_Afoo, to_write_Afoo); + offset_Afoo += to_write_Afoo; + } + else { + memcpy((char *)data_Afoo+ offset_Afoo,text_Afoo, 32); + offset_Afoo += 32; + } + } + + if ( pwrite ( fd_Afoo, data_Afoo, 32768, 0) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + cm_->CmClose(fd_Afoo); + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang169.cpp b/src/tests/seq1/j-lang169.cpp new file mode 100644 index 0000000..5920352 --- /dev/null +++ b/src/tests/seq1/j-lang169.cpp @@ -0,0 +1,186 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmClose(fd_Afoo); + fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_DIRECT|O_SYNC , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + void* data_Afoo; + if (posix_memalign(&data_Afoo , 4096, 8192 ) < 0) { + return errno; + } + + + int offset_Afoo = 0; + int to_write_Afoo = 8192 ; + const char *text_Afoo = "ddddddddddklmnopqrstuvwxyz123456"; + while (offset_Afoo < 8192){ + if (to_write_Afoo < 32){ + memcpy((char *)data_Afoo+ offset_Afoo, text_Afoo, to_write_Afoo); + offset_Afoo += to_write_Afoo; + } + else { + memcpy((char *)data_Afoo+ offset_Afoo,text_Afoo, 32); + offset_Afoo += 32; + } + } + + if ( pwrite ( fd_Afoo, data_Afoo, 8192, 0) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + cm_->CmClose(fd_Afoo); + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang17.cpp b/src/tests/seq1/j-lang17.cpp new file mode 100644 index 0000000..16422bd --- /dev/null +++ b/src/tests/seq1/j-lang17.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_ZERO_RANGE , 0 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang170.cpp b/src/tests/seq1/j-lang170.cpp new file mode 100644 index 0000000..fb33afa --- /dev/null +++ b/src/tests/seq1/j-lang170.cpp @@ -0,0 +1,186 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmClose(fd_Afoo); + fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_DIRECT|O_SYNC , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + void* data_Afoo; + if (posix_memalign(&data_Afoo , 4096, 8192 ) < 0) { + return errno; + } + + + int offset_Afoo = 0; + int to_write_Afoo = 8192 ; + const char *text_Afoo = "ddddddddddklmnopqrstuvwxyz123456"; + while (offset_Afoo < 8192){ + if (to_write_Afoo < 32){ + memcpy((char *)data_Afoo+ offset_Afoo, text_Afoo, to_write_Afoo); + offset_Afoo += to_write_Afoo; + } + else { + memcpy((char *)data_Afoo+ offset_Afoo,text_Afoo, 32); + offset_Afoo += 32; + } + } + + if ( pwrite ( fd_Afoo, data_Afoo, 8192, 0) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + cm_->CmClose(fd_Afoo); + + fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang171.cpp b/src/tests/seq1/j-lang171.cpp new file mode 100644 index 0000000..b6a9324 --- /dev/null +++ b/src/tests/seq1/j-lang171.cpp @@ -0,0 +1,186 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmClose(fd_Afoo); + fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_DIRECT|O_SYNC , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + void* data_Afoo; + if (posix_memalign(&data_Afoo , 4096, 8192 ) < 0) { + return errno; + } + + + int offset_Afoo = 0; + int to_write_Afoo = 8192 ; + const char *text_Afoo = "ddddddddddklmnopqrstuvwxyz123456"; + while (offset_Afoo < 8192){ + if (to_write_Afoo < 32){ + memcpy((char *)data_Afoo+ offset_Afoo, text_Afoo, to_write_Afoo); + offset_Afoo += to_write_Afoo; + } + else { + memcpy((char *)data_Afoo+ offset_Afoo,text_Afoo, 32); + offset_Afoo += 32; + } + } + + if ( pwrite ( fd_Afoo, data_Afoo, 8192, 0) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + cm_->CmClose(fd_Afoo); + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang172.cpp b/src/tests/seq1/j-lang172.cpp new file mode 100644 index 0000000..ae26913 --- /dev/null +++ b/src/tests/seq1/j-lang172.cpp @@ -0,0 +1,172 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmClose(fd_Afoo); + fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_DIRECT|O_SYNC , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + void* data_Afoo; + if (posix_memalign(&data_Afoo , 4096, 8192 ) < 0) { + return errno; + } + + + int offset_Afoo = 0; + int to_write_Afoo = 8192 ; + const char *text_Afoo = "ddddddddddklmnopqrstuvwxyz123456"; + while (offset_Afoo < 8192){ + if (to_write_Afoo < 32){ + memcpy((char *)data_Afoo+ offset_Afoo, text_Afoo, to_write_Afoo); + offset_Afoo += to_write_Afoo; + } + else { + memcpy((char *)data_Afoo+ offset_Afoo,text_Afoo, 32); + offset_Afoo += 32; + } + } + + if ( pwrite ( fd_Afoo, data_Afoo, 8192, 0) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + cm_->CmClose(fd_Afoo); + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang173.cpp b/src/tests/seq1/j-lang173.cpp new file mode 100644 index 0000000..1b32e19 --- /dev/null +++ b/src/tests/seq1/j-lang173.cpp @@ -0,0 +1,166 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , 0 , 32768 , 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + char *filep_foo = (char *) cm_->CmMmap(NULL, 32768 + 32768, PROT_WRITE|PROT_READ, MAP_SHARED, fd_foo, 0); + if (filep_foo == MAP_FAILED) { + return -1; + } + + int moffset_foo = 0; + int to_write_foo = 32768 ; + const char *mtext_foo = "mmmmmmmmmmklmnopqrstuvwxyz123456"; + + while (moffset_foo < 32768){ + if (to_write_foo < 32){ + memcpy(filep_foo + 32768 + moffset_foo, mtext_foo, to_write_foo); + moffset_foo += to_write_foo; + } + else { + memcpy(filep_foo + 32768 + moffset_foo,mtext_foo, 32); + moffset_foo += 32; + } + } + + if ( cm_->CmMsync ( filep_foo + 32768, 8192 , MS_SYNC) < 0){ + cm_->CmMunmap( filep_foo,32768 + 32768); + return -1; + } + cm_->CmMunmap( filep_foo , 32768 + 32768); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang174.cpp b/src/tests/seq1/j-lang174.cpp new file mode 100644 index 0000000..1b32e19 --- /dev/null +++ b/src/tests/seq1/j-lang174.cpp @@ -0,0 +1,166 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , 0 , 32768 , 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + char *filep_foo = (char *) cm_->CmMmap(NULL, 32768 + 32768, PROT_WRITE|PROT_READ, MAP_SHARED, fd_foo, 0); + if (filep_foo == MAP_FAILED) { + return -1; + } + + int moffset_foo = 0; + int to_write_foo = 32768 ; + const char *mtext_foo = "mmmmmmmmmmklmnopqrstuvwxyz123456"; + + while (moffset_foo < 32768){ + if (to_write_foo < 32){ + memcpy(filep_foo + 32768 + moffset_foo, mtext_foo, to_write_foo); + moffset_foo += to_write_foo; + } + else { + memcpy(filep_foo + 32768 + moffset_foo,mtext_foo, 32); + moffset_foo += 32; + } + } + + if ( cm_->CmMsync ( filep_foo + 32768, 8192 , MS_SYNC) < 0){ + cm_->CmMunmap( filep_foo,32768 + 32768); + return -1; + } + cm_->CmMunmap( filep_foo , 32768 + 32768); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang175.cpp b/src/tests/seq1/j-lang175.cpp new file mode 100644 index 0000000..1b32e19 --- /dev/null +++ b/src/tests/seq1/j-lang175.cpp @@ -0,0 +1,166 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , 0 , 32768 , 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + char *filep_foo = (char *) cm_->CmMmap(NULL, 32768 + 32768, PROT_WRITE|PROT_READ, MAP_SHARED, fd_foo, 0); + if (filep_foo == MAP_FAILED) { + return -1; + } + + int moffset_foo = 0; + int to_write_foo = 32768 ; + const char *mtext_foo = "mmmmmmmmmmklmnopqrstuvwxyz123456"; + + while (moffset_foo < 32768){ + if (to_write_foo < 32){ + memcpy(filep_foo + 32768 + moffset_foo, mtext_foo, to_write_foo); + moffset_foo += to_write_foo; + } + else { + memcpy(filep_foo + 32768 + moffset_foo,mtext_foo, 32); + moffset_foo += 32; + } + } + + if ( cm_->CmMsync ( filep_foo + 32768, 8192 , MS_SYNC) < 0){ + cm_->CmMunmap( filep_foo,32768 + 32768); + return -1; + } + cm_->CmMunmap( filep_foo , 32768 + 32768); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang176.cpp b/src/tests/seq1/j-lang176.cpp new file mode 100644 index 0000000..1b32e19 --- /dev/null +++ b/src/tests/seq1/j-lang176.cpp @@ -0,0 +1,166 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , 0 , 32768 , 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + char *filep_foo = (char *) cm_->CmMmap(NULL, 32768 + 32768, PROT_WRITE|PROT_READ, MAP_SHARED, fd_foo, 0); + if (filep_foo == MAP_FAILED) { + return -1; + } + + int moffset_foo = 0; + int to_write_foo = 32768 ; + const char *mtext_foo = "mmmmmmmmmmklmnopqrstuvwxyz123456"; + + while (moffset_foo < 32768){ + if (to_write_foo < 32){ + memcpy(filep_foo + 32768 + moffset_foo, mtext_foo, to_write_foo); + moffset_foo += to_write_foo; + } + else { + memcpy(filep_foo + 32768 + moffset_foo,mtext_foo, 32); + moffset_foo += 32; + } + } + + if ( cm_->CmMsync ( filep_foo + 32768, 8192 , MS_SYNC) < 0){ + cm_->CmMunmap( filep_foo,32768 + 32768); + return -1; + } + cm_->CmMunmap( filep_foo , 32768 + 32768); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang177.cpp b/src/tests/seq1/j-lang177.cpp new file mode 100644 index 0000000..f734e9c --- /dev/null +++ b/src/tests/seq1/j-lang177.cpp @@ -0,0 +1,166 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , 0 , 0 , 8192) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + char *filep_foo = (char *) cm_->CmMmap(NULL, 8192 + 0, PROT_WRITE|PROT_READ, MAP_SHARED, fd_foo, 0); + if (filep_foo == MAP_FAILED) { + return -1; + } + + int moffset_foo = 0; + int to_write_foo = 8192 ; + const char *mtext_foo = "mmmmmmmmmmklmnopqrstuvwxyz123456"; + + while (moffset_foo < 8192){ + if (to_write_foo < 32){ + memcpy(filep_foo + 0 + moffset_foo, mtext_foo, to_write_foo); + moffset_foo += to_write_foo; + } + else { + memcpy(filep_foo + 0 + moffset_foo,mtext_foo, 32); + moffset_foo += 32; + } + } + + if ( cm_->CmMsync ( filep_foo + 0, 8192 , MS_SYNC) < 0){ + cm_->CmMunmap( filep_foo,0 + 8192); + return -1; + } + cm_->CmMunmap( filep_foo , 0 + 8192); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang178.cpp b/src/tests/seq1/j-lang178.cpp new file mode 100644 index 0000000..f734e9c --- /dev/null +++ b/src/tests/seq1/j-lang178.cpp @@ -0,0 +1,166 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , 0 , 0 , 8192) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + char *filep_foo = (char *) cm_->CmMmap(NULL, 8192 + 0, PROT_WRITE|PROT_READ, MAP_SHARED, fd_foo, 0); + if (filep_foo == MAP_FAILED) { + return -1; + } + + int moffset_foo = 0; + int to_write_foo = 8192 ; + const char *mtext_foo = "mmmmmmmmmmklmnopqrstuvwxyz123456"; + + while (moffset_foo < 8192){ + if (to_write_foo < 32){ + memcpy(filep_foo + 0 + moffset_foo, mtext_foo, to_write_foo); + moffset_foo += to_write_foo; + } + else { + memcpy(filep_foo + 0 + moffset_foo,mtext_foo, 32); + moffset_foo += 32; + } + } + + if ( cm_->CmMsync ( filep_foo + 0, 8192 , MS_SYNC) < 0){ + cm_->CmMunmap( filep_foo,0 + 8192); + return -1; + } + cm_->CmMunmap( filep_foo , 0 + 8192); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang179.cpp b/src/tests/seq1/j-lang179.cpp new file mode 100644 index 0000000..f734e9c --- /dev/null +++ b/src/tests/seq1/j-lang179.cpp @@ -0,0 +1,166 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , 0 , 0 , 8192) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + char *filep_foo = (char *) cm_->CmMmap(NULL, 8192 + 0, PROT_WRITE|PROT_READ, MAP_SHARED, fd_foo, 0); + if (filep_foo == MAP_FAILED) { + return -1; + } + + int moffset_foo = 0; + int to_write_foo = 8192 ; + const char *mtext_foo = "mmmmmmmmmmklmnopqrstuvwxyz123456"; + + while (moffset_foo < 8192){ + if (to_write_foo < 32){ + memcpy(filep_foo + 0 + moffset_foo, mtext_foo, to_write_foo); + moffset_foo += to_write_foo; + } + else { + memcpy(filep_foo + 0 + moffset_foo,mtext_foo, 32); + moffset_foo += 32; + } + } + + if ( cm_->CmMsync ( filep_foo + 0, 8192 , MS_SYNC) < 0){ + cm_->CmMunmap( filep_foo,0 + 8192); + return -1; + } + cm_->CmMunmap( filep_foo , 0 + 8192); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang18.cpp b/src/tests/seq1/j-lang18.cpp new file mode 100644 index 0000000..c3871fa --- /dev/null +++ b/src/tests/seq1/j-lang18.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_ZERO_RANGE , 0 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang180.cpp b/src/tests/seq1/j-lang180.cpp new file mode 100644 index 0000000..f734e9c --- /dev/null +++ b/src/tests/seq1/j-lang180.cpp @@ -0,0 +1,166 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , 0 , 0 , 8192) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + char *filep_foo = (char *) cm_->CmMmap(NULL, 8192 + 0, PROT_WRITE|PROT_READ, MAP_SHARED, fd_foo, 0); + if (filep_foo == MAP_FAILED) { + return -1; + } + + int moffset_foo = 0; + int to_write_foo = 8192 ; + const char *mtext_foo = "mmmmmmmmmmklmnopqrstuvwxyz123456"; + + while (moffset_foo < 8192){ + if (to_write_foo < 32){ + memcpy(filep_foo + 0 + moffset_foo, mtext_foo, to_write_foo); + moffset_foo += to_write_foo; + } + else { + memcpy(filep_foo + 0 + moffset_foo,mtext_foo, 32); + moffset_foo += 32; + } + } + + if ( cm_->CmMsync ( filep_foo + 0, 8192 , MS_SYNC) < 0){ + cm_->CmMunmap( filep_foo,0 + 8192); + return -1; + } + cm_->CmMunmap( filep_foo , 0 + 8192); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang181.cpp b/src/tests/seq1/j-lang181.cpp new file mode 100644 index 0000000..3a0705a --- /dev/null +++ b/src/tests/seq1/j-lang181.cpp @@ -0,0 +1,171 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , 0 , 32768 , 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + char *filep_Afoo = (char *) cm_->CmMmap(NULL, 32768 + 32768, PROT_WRITE|PROT_READ, MAP_SHARED, fd_Afoo, 0); + if (filep_Afoo == MAP_FAILED) { + return -1; + } + + int moffset_Afoo = 0; + int to_write_Afoo = 32768 ; + const char *mtext_Afoo = "mmmmmmmmmmklmnopqrstuvwxyz123456"; + + while (moffset_Afoo < 32768){ + if (to_write_Afoo < 32){ + memcpy(filep_Afoo + 32768 + moffset_Afoo, mtext_Afoo, to_write_Afoo); + moffset_Afoo += to_write_Afoo; + } + else { + memcpy(filep_Afoo + 32768 + moffset_Afoo,mtext_Afoo, 32); + moffset_Afoo += 32; + } + } + + if ( cm_->CmMsync ( filep_Afoo + 32768, 8192 , MS_SYNC) < 0){ + cm_->CmMunmap( filep_Afoo,32768 + 32768); + return -1; + } + cm_->CmMunmap( filep_Afoo , 32768 + 32768); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang182.cpp b/src/tests/seq1/j-lang182.cpp new file mode 100644 index 0000000..3a0705a --- /dev/null +++ b/src/tests/seq1/j-lang182.cpp @@ -0,0 +1,171 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , 0 , 32768 , 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + char *filep_Afoo = (char *) cm_->CmMmap(NULL, 32768 + 32768, PROT_WRITE|PROT_READ, MAP_SHARED, fd_Afoo, 0); + if (filep_Afoo == MAP_FAILED) { + return -1; + } + + int moffset_Afoo = 0; + int to_write_Afoo = 32768 ; + const char *mtext_Afoo = "mmmmmmmmmmklmnopqrstuvwxyz123456"; + + while (moffset_Afoo < 32768){ + if (to_write_Afoo < 32){ + memcpy(filep_Afoo + 32768 + moffset_Afoo, mtext_Afoo, to_write_Afoo); + moffset_Afoo += to_write_Afoo; + } + else { + memcpy(filep_Afoo + 32768 + moffset_Afoo,mtext_Afoo, 32); + moffset_Afoo += 32; + } + } + + if ( cm_->CmMsync ( filep_Afoo + 32768, 8192 , MS_SYNC) < 0){ + cm_->CmMunmap( filep_Afoo,32768 + 32768); + return -1; + } + cm_->CmMunmap( filep_Afoo , 32768 + 32768); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang183.cpp b/src/tests/seq1/j-lang183.cpp new file mode 100644 index 0000000..3a0705a --- /dev/null +++ b/src/tests/seq1/j-lang183.cpp @@ -0,0 +1,171 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , 0 , 32768 , 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + char *filep_Afoo = (char *) cm_->CmMmap(NULL, 32768 + 32768, PROT_WRITE|PROT_READ, MAP_SHARED, fd_Afoo, 0); + if (filep_Afoo == MAP_FAILED) { + return -1; + } + + int moffset_Afoo = 0; + int to_write_Afoo = 32768 ; + const char *mtext_Afoo = "mmmmmmmmmmklmnopqrstuvwxyz123456"; + + while (moffset_Afoo < 32768){ + if (to_write_Afoo < 32){ + memcpy(filep_Afoo + 32768 + moffset_Afoo, mtext_Afoo, to_write_Afoo); + moffset_Afoo += to_write_Afoo; + } + else { + memcpy(filep_Afoo + 32768 + moffset_Afoo,mtext_Afoo, 32); + moffset_Afoo += 32; + } + } + + if ( cm_->CmMsync ( filep_Afoo + 32768, 8192 , MS_SYNC) < 0){ + cm_->CmMunmap( filep_Afoo,32768 + 32768); + return -1; + } + cm_->CmMunmap( filep_Afoo , 32768 + 32768); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang184.cpp b/src/tests/seq1/j-lang184.cpp new file mode 100644 index 0000000..3a0705a --- /dev/null +++ b/src/tests/seq1/j-lang184.cpp @@ -0,0 +1,171 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , 0 , 32768 , 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + char *filep_Afoo = (char *) cm_->CmMmap(NULL, 32768 + 32768, PROT_WRITE|PROT_READ, MAP_SHARED, fd_Afoo, 0); + if (filep_Afoo == MAP_FAILED) { + return -1; + } + + int moffset_Afoo = 0; + int to_write_Afoo = 32768 ; + const char *mtext_Afoo = "mmmmmmmmmmklmnopqrstuvwxyz123456"; + + while (moffset_Afoo < 32768){ + if (to_write_Afoo < 32){ + memcpy(filep_Afoo + 32768 + moffset_Afoo, mtext_Afoo, to_write_Afoo); + moffset_Afoo += to_write_Afoo; + } + else { + memcpy(filep_Afoo + 32768 + moffset_Afoo,mtext_Afoo, 32); + moffset_Afoo += 32; + } + } + + if ( cm_->CmMsync ( filep_Afoo + 32768, 8192 , MS_SYNC) < 0){ + cm_->CmMunmap( filep_Afoo,32768 + 32768); + return -1; + } + cm_->CmMunmap( filep_Afoo , 32768 + 32768); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang185.cpp b/src/tests/seq1/j-lang185.cpp new file mode 100644 index 0000000..a557a2f --- /dev/null +++ b/src/tests/seq1/j-lang185.cpp @@ -0,0 +1,171 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , 0 , 0 , 8192) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + char *filep_Afoo = (char *) cm_->CmMmap(NULL, 8192 + 0, PROT_WRITE|PROT_READ, MAP_SHARED, fd_Afoo, 0); + if (filep_Afoo == MAP_FAILED) { + return -1; + } + + int moffset_Afoo = 0; + int to_write_Afoo = 8192 ; + const char *mtext_Afoo = "mmmmmmmmmmklmnopqrstuvwxyz123456"; + + while (moffset_Afoo < 8192){ + if (to_write_Afoo < 32){ + memcpy(filep_Afoo + 0 + moffset_Afoo, mtext_Afoo, to_write_Afoo); + moffset_Afoo += to_write_Afoo; + } + else { + memcpy(filep_Afoo + 0 + moffset_Afoo,mtext_Afoo, 32); + moffset_Afoo += 32; + } + } + + if ( cm_->CmMsync ( filep_Afoo + 0, 8192 , MS_SYNC) < 0){ + cm_->CmMunmap( filep_Afoo,0 + 8192); + return -1; + } + cm_->CmMunmap( filep_Afoo , 0 + 8192); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang186.cpp b/src/tests/seq1/j-lang186.cpp new file mode 100644 index 0000000..a557a2f --- /dev/null +++ b/src/tests/seq1/j-lang186.cpp @@ -0,0 +1,171 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , 0 , 0 , 8192) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + char *filep_Afoo = (char *) cm_->CmMmap(NULL, 8192 + 0, PROT_WRITE|PROT_READ, MAP_SHARED, fd_Afoo, 0); + if (filep_Afoo == MAP_FAILED) { + return -1; + } + + int moffset_Afoo = 0; + int to_write_Afoo = 8192 ; + const char *mtext_Afoo = "mmmmmmmmmmklmnopqrstuvwxyz123456"; + + while (moffset_Afoo < 8192){ + if (to_write_Afoo < 32){ + memcpy(filep_Afoo + 0 + moffset_Afoo, mtext_Afoo, to_write_Afoo); + moffset_Afoo += to_write_Afoo; + } + else { + memcpy(filep_Afoo + 0 + moffset_Afoo,mtext_Afoo, 32); + moffset_Afoo += 32; + } + } + + if ( cm_->CmMsync ( filep_Afoo + 0, 8192 , MS_SYNC) < 0){ + cm_->CmMunmap( filep_Afoo,0 + 8192); + return -1; + } + cm_->CmMunmap( filep_Afoo , 0 + 8192); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang187.cpp b/src/tests/seq1/j-lang187.cpp new file mode 100644 index 0000000..a557a2f --- /dev/null +++ b/src/tests/seq1/j-lang187.cpp @@ -0,0 +1,171 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , 0 , 0 , 8192) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + char *filep_Afoo = (char *) cm_->CmMmap(NULL, 8192 + 0, PROT_WRITE|PROT_READ, MAP_SHARED, fd_Afoo, 0); + if (filep_Afoo == MAP_FAILED) { + return -1; + } + + int moffset_Afoo = 0; + int to_write_Afoo = 8192 ; + const char *mtext_Afoo = "mmmmmmmmmmklmnopqrstuvwxyz123456"; + + while (moffset_Afoo < 8192){ + if (to_write_Afoo < 32){ + memcpy(filep_Afoo + 0 + moffset_Afoo, mtext_Afoo, to_write_Afoo); + moffset_Afoo += to_write_Afoo; + } + else { + memcpy(filep_Afoo + 0 + moffset_Afoo,mtext_Afoo, 32); + moffset_Afoo += 32; + } + } + + if ( cm_->CmMsync ( filep_Afoo + 0, 8192 , MS_SYNC) < 0){ + cm_->CmMunmap( filep_Afoo,0 + 8192); + return -1; + } + cm_->CmMunmap( filep_Afoo , 0 + 8192); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang188.cpp b/src/tests/seq1/j-lang188.cpp new file mode 100644 index 0000000..a557a2f --- /dev/null +++ b/src/tests/seq1/j-lang188.cpp @@ -0,0 +1,171 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , 0 , 0 , 8192) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + char *filep_Afoo = (char *) cm_->CmMmap(NULL, 8192 + 0, PROT_WRITE|PROT_READ, MAP_SHARED, fd_Afoo, 0); + if (filep_Afoo == MAP_FAILED) { + return -1; + } + + int moffset_Afoo = 0; + int to_write_Afoo = 8192 ; + const char *mtext_Afoo = "mmmmmmmmmmklmnopqrstuvwxyz123456"; + + while (moffset_Afoo < 8192){ + if (to_write_Afoo < 32){ + memcpy(filep_Afoo + 0 + moffset_Afoo, mtext_Afoo, to_write_Afoo); + moffset_Afoo += to_write_Afoo; + } + else { + memcpy(filep_Afoo + 0 + moffset_Afoo,mtext_Afoo, 32); + moffset_Afoo += 32; + } + } + + if ( cm_->CmMsync ( filep_Afoo + 0, 8192 , MS_SYNC) < 0){ + cm_->CmMunmap( filep_Afoo,0 + 8192); + return -1; + } + cm_->CmMunmap( filep_Afoo , 0 + 8192); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang189.cpp b/src/tests/seq1/j-lang189.cpp new file mode 100644 index 0000000..421f977 --- /dev/null +++ b/src/tests/seq1/j-lang189.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( link(foo_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang19.cpp b/src/tests/seq1/j-lang19.cpp new file mode 100644 index 0000000..fbe46e9 --- /dev/null +++ b/src/tests/seq1/j-lang19.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_ZERO_RANGE , 0 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang190.cpp b/src/tests/seq1/j-lang190.cpp new file mode 100644 index 0000000..dda8f4f --- /dev/null +++ b/src/tests/seq1/j-lang190.cpp @@ -0,0 +1,139 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( link(foo_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang191.cpp b/src/tests/seq1/j-lang191.cpp new file mode 100644 index 0000000..2751d58 --- /dev/null +++ b/src/tests/seq1/j-lang191.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( link(foo_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang192.cpp b/src/tests/seq1/j-lang192.cpp new file mode 100644 index 0000000..d0a0a35 --- /dev/null +++ b/src/tests/seq1/j-lang192.cpp @@ -0,0 +1,137 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( link(foo_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang193.cpp b/src/tests/seq1/j-lang193.cpp new file mode 100644 index 0000000..ea085a2 --- /dev/null +++ b/src/tests/seq1/j-lang193.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( link(foo_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang194.cpp b/src/tests/seq1/j-lang194.cpp new file mode 100644 index 0000000..86eb1d3 --- /dev/null +++ b/src/tests/seq1/j-lang194.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( link(foo_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang195.cpp b/src/tests/seq1/j-lang195.cpp new file mode 100644 index 0000000..99b71ff --- /dev/null +++ b/src/tests/seq1/j-lang195.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( link(foo_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang196.cpp b/src/tests/seq1/j-lang196.cpp new file mode 100644 index 0000000..47bd2fd --- /dev/null +++ b/src/tests/seq1/j-lang196.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( link(foo_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang197.cpp b/src/tests/seq1/j-lang197.cpp new file mode 100644 index 0000000..3e0f539 --- /dev/null +++ b/src/tests/seq1/j-lang197.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( link(foo_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang198.cpp b/src/tests/seq1/j-lang198.cpp new file mode 100644 index 0000000..7467fcc --- /dev/null +++ b/src/tests/seq1/j-lang198.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( link(foo_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang199.cpp b/src/tests/seq1/j-lang199.cpp new file mode 100644 index 0000000..e984c2a --- /dev/null +++ b/src/tests/seq1/j-lang199.cpp @@ -0,0 +1,142 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( link(foo_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang2.cpp b/src/tests/seq1/j-lang2.cpp new file mode 100644 index 0000000..faeefc0 --- /dev/null +++ b/src/tests/seq1/j-lang2.cpp @@ -0,0 +1,134 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang20.cpp b/src/tests/seq1/j-lang20.cpp new file mode 100644 index 0000000..59abb41 --- /dev/null +++ b/src/tests/seq1/j-lang20.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_ZERO_RANGE , 0 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang200.cpp b/src/tests/seq1/j-lang200.cpp new file mode 100644 index 0000000..aa425df --- /dev/null +++ b/src/tests/seq1/j-lang200.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( link(Afoo_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang201.cpp b/src/tests/seq1/j-lang201.cpp new file mode 100644 index 0000000..9682165 --- /dev/null +++ b/src/tests/seq1/j-lang201.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( link(Afoo_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang202.cpp b/src/tests/seq1/j-lang202.cpp new file mode 100644 index 0000000..5fe78b5 --- /dev/null +++ b/src/tests/seq1/j-lang202.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( link(Afoo_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang203.cpp b/src/tests/seq1/j-lang203.cpp new file mode 100644 index 0000000..8bb8673 --- /dev/null +++ b/src/tests/seq1/j-lang203.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( link(Afoo_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang204.cpp b/src/tests/seq1/j-lang204.cpp new file mode 100644 index 0000000..be2cf3c --- /dev/null +++ b/src/tests/seq1/j-lang204.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( link(Afoo_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang205.cpp b/src/tests/seq1/j-lang205.cpp new file mode 100644 index 0000000..41d32ec --- /dev/null +++ b/src/tests/seq1/j-lang205.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( link(Afoo_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang206.cpp b/src/tests/seq1/j-lang206.cpp new file mode 100644 index 0000000..75057ea --- /dev/null +++ b/src/tests/seq1/j-lang206.cpp @@ -0,0 +1,142 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( link(Afoo_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang207.cpp b/src/tests/seq1/j-lang207.cpp new file mode 100644 index 0000000..a919414 --- /dev/null +++ b/src/tests/seq1/j-lang207.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( link(Afoo_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang208.cpp b/src/tests/seq1/j-lang208.cpp new file mode 100644 index 0000000..b2c6e25 --- /dev/null +++ b/src/tests/seq1/j-lang208.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( link(Afoo_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang209.cpp b/src/tests/seq1/j-lang209.cpp new file mode 100644 index 0000000..d4931c7 --- /dev/null +++ b/src/tests/seq1/j-lang209.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( link(Afoo_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang21.cpp b/src/tests/seq1/j-lang21.cpp new file mode 100644 index 0000000..c6413d5 --- /dev/null +++ b/src/tests/seq1/j-lang21.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_ZERO_RANGE , 30768 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang210.cpp b/src/tests/seq1/j-lang210.cpp new file mode 100644 index 0000000..413bcc7 --- /dev/null +++ b/src/tests/seq1/j-lang210.cpp @@ -0,0 +1,142 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( link(Afoo_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang211.cpp b/src/tests/seq1/j-lang211.cpp new file mode 100644 index 0000000..2951651 --- /dev/null +++ b/src/tests/seq1/j-lang211.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( link(bar_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang212.cpp b/src/tests/seq1/j-lang212.cpp new file mode 100644 index 0000000..8986382 --- /dev/null +++ b/src/tests/seq1/j-lang212.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( link(bar_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang213.cpp b/src/tests/seq1/j-lang213.cpp new file mode 100644 index 0000000..4b50255 --- /dev/null +++ b/src/tests/seq1/j-lang213.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( link(bar_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang214.cpp b/src/tests/seq1/j-lang214.cpp new file mode 100644 index 0000000..8ce0813 --- /dev/null +++ b/src/tests/seq1/j-lang214.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( link(bar_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang215.cpp b/src/tests/seq1/j-lang215.cpp new file mode 100644 index 0000000..328a497 --- /dev/null +++ b/src/tests/seq1/j-lang215.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( link(bar_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang216.cpp b/src/tests/seq1/j-lang216.cpp new file mode 100644 index 0000000..348a081 --- /dev/null +++ b/src/tests/seq1/j-lang216.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( link(bar_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang217.cpp b/src/tests/seq1/j-lang217.cpp new file mode 100644 index 0000000..d675360 --- /dev/null +++ b/src/tests/seq1/j-lang217.cpp @@ -0,0 +1,142 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( link(bar_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang218.cpp b/src/tests/seq1/j-lang218.cpp new file mode 100644 index 0000000..f0f619c --- /dev/null +++ b/src/tests/seq1/j-lang218.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( link(Abar_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang219.cpp b/src/tests/seq1/j-lang219.cpp new file mode 100644 index 0000000..d756c64 --- /dev/null +++ b/src/tests/seq1/j-lang219.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( link(Abar_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang22.cpp b/src/tests/seq1/j-lang22.cpp new file mode 100644 index 0000000..94910c8 --- /dev/null +++ b/src/tests/seq1/j-lang22.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_ZERO_RANGE , 30768 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang220.cpp b/src/tests/seq1/j-lang220.cpp new file mode 100644 index 0000000..dc0755d --- /dev/null +++ b/src/tests/seq1/j-lang220.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( link(Abar_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang221.cpp b/src/tests/seq1/j-lang221.cpp new file mode 100644 index 0000000..83a7381 --- /dev/null +++ b/src/tests/seq1/j-lang221.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( link(Abar_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang222.cpp b/src/tests/seq1/j-lang222.cpp new file mode 100644 index 0000000..dffa08b --- /dev/null +++ b/src/tests/seq1/j-lang222.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( link(Abar_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang223.cpp b/src/tests/seq1/j-lang223.cpp new file mode 100644 index 0000000..17bc700 --- /dev/null +++ b/src/tests/seq1/j-lang223.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( link(Abar_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang224.cpp b/src/tests/seq1/j-lang224.cpp new file mode 100644 index 0000000..68f7c7e --- /dev/null +++ b/src/tests/seq1/j-lang224.cpp @@ -0,0 +1,142 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( link(Abar_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang225.cpp b/src/tests/seq1/j-lang225.cpp new file mode 100644 index 0000000..5885570 --- /dev/null +++ b/src/tests/seq1/j-lang225.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( unlink(foo_path.c_str() ) < 0){ + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang226.cpp b/src/tests/seq1/j-lang226.cpp new file mode 100644 index 0000000..0e78cad --- /dev/null +++ b/src/tests/seq1/j-lang226.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( unlink(foo_path.c_str() ) < 0){ + return errno; + } + + + fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang227.cpp b/src/tests/seq1/j-lang227.cpp new file mode 100644 index 0000000..7209198 --- /dev/null +++ b/src/tests/seq1/j-lang227.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( unlink(foo_path.c_str() ) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang228.cpp b/src/tests/seq1/j-lang228.cpp new file mode 100644 index 0000000..29eb28e --- /dev/null +++ b/src/tests/seq1/j-lang228.cpp @@ -0,0 +1,137 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( unlink(foo_path.c_str() ) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang229.cpp b/src/tests/seq1/j-lang229.cpp new file mode 100644 index 0000000..891ea8a --- /dev/null +++ b/src/tests/seq1/j-lang229.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( unlink(Afoo_path.c_str() ) < 0){ + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang23.cpp b/src/tests/seq1/j-lang23.cpp new file mode 100644 index 0000000..ab24834 --- /dev/null +++ b/src/tests/seq1/j-lang23.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_ZERO_RANGE , 30768 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang230.cpp b/src/tests/seq1/j-lang230.cpp new file mode 100644 index 0000000..1b233da --- /dev/null +++ b/src/tests/seq1/j-lang230.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( unlink(Afoo_path.c_str() ) < 0){ + return errno; + } + + + fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang231.cpp b/src/tests/seq1/j-lang231.cpp new file mode 100644 index 0000000..34dcf78 --- /dev/null +++ b/src/tests/seq1/j-lang231.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( unlink(Afoo_path.c_str() ) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang232.cpp b/src/tests/seq1/j-lang232.cpp new file mode 100644 index 0000000..9982cfa --- /dev/null +++ b/src/tests/seq1/j-lang232.cpp @@ -0,0 +1,142 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( unlink(Afoo_path.c_str() ) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang233.cpp b/src/tests/seq1/j-lang233.cpp new file mode 100644 index 0000000..949f2db --- /dev/null +++ b/src/tests/seq1/j-lang233.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + + if ( unlink(bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang234.cpp b/src/tests/seq1/j-lang234.cpp new file mode 100644 index 0000000..65fe15e --- /dev/null +++ b/src/tests/seq1/j-lang234.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + + if ( unlink(bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang235.cpp b/src/tests/seq1/j-lang235.cpp new file mode 100644 index 0000000..53981ed --- /dev/null +++ b/src/tests/seq1/j-lang235.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + + if ( unlink(bar_path.c_str() ) < 0){ + return errno; + } + + + fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang236.cpp b/src/tests/seq1/j-lang236.cpp new file mode 100644 index 0000000..eadec32 --- /dev/null +++ b/src/tests/seq1/j-lang236.cpp @@ -0,0 +1,137 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + + if ( unlink(bar_path.c_str() ) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang237.cpp b/src/tests/seq1/j-lang237.cpp new file mode 100644 index 0000000..30cf085 --- /dev/null +++ b/src/tests/seq1/j-lang237.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + + if ( unlink(Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang238.cpp b/src/tests/seq1/j-lang238.cpp new file mode 100644 index 0000000..18b4e63 --- /dev/null +++ b/src/tests/seq1/j-lang238.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + + if ( unlink(Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang239.cpp b/src/tests/seq1/j-lang239.cpp new file mode 100644 index 0000000..17cf656 --- /dev/null +++ b/src/tests/seq1/j-lang239.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + + if ( unlink(Abar_path.c_str() ) < 0){ + return errno; + } + + + fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang24.cpp b/src/tests/seq1/j-lang24.cpp new file mode 100644 index 0000000..ebff163 --- /dev/null +++ b/src/tests/seq1/j-lang24.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_ZERO_RANGE , 30768 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang240.cpp b/src/tests/seq1/j-lang240.cpp new file mode 100644 index 0000000..6a2f794 --- /dev/null +++ b/src/tests/seq1/j-lang240.cpp @@ -0,0 +1,142 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + + if ( unlink(Abar_path.c_str() ) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang241.cpp b/src/tests/seq1/j-lang241.cpp new file mode 100644 index 0000000..1b2197b --- /dev/null +++ b/src/tests/seq1/j-lang241.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( remove(foo_path.c_str() ) < 0){ + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang242.cpp b/src/tests/seq1/j-lang242.cpp new file mode 100644 index 0000000..67ed9b0 --- /dev/null +++ b/src/tests/seq1/j-lang242.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( remove(foo_path.c_str() ) < 0){ + return errno; + } + + + fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang243.cpp b/src/tests/seq1/j-lang243.cpp new file mode 100644 index 0000000..f9ed41c --- /dev/null +++ b/src/tests/seq1/j-lang243.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( remove(foo_path.c_str() ) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang244.cpp b/src/tests/seq1/j-lang244.cpp new file mode 100644 index 0000000..3201100 --- /dev/null +++ b/src/tests/seq1/j-lang244.cpp @@ -0,0 +1,137 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( remove(foo_path.c_str() ) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang245.cpp b/src/tests/seq1/j-lang245.cpp new file mode 100644 index 0000000..cb20b60 --- /dev/null +++ b/src/tests/seq1/j-lang245.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( remove(Afoo_path.c_str() ) < 0){ + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang246.cpp b/src/tests/seq1/j-lang246.cpp new file mode 100644 index 0000000..5089381 --- /dev/null +++ b/src/tests/seq1/j-lang246.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( remove(Afoo_path.c_str() ) < 0){ + return errno; + } + + + fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang247.cpp b/src/tests/seq1/j-lang247.cpp new file mode 100644 index 0000000..567e769 --- /dev/null +++ b/src/tests/seq1/j-lang247.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( remove(Afoo_path.c_str() ) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang248.cpp b/src/tests/seq1/j-lang248.cpp new file mode 100644 index 0000000..a907e30 --- /dev/null +++ b/src/tests/seq1/j-lang248.cpp @@ -0,0 +1,142 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( remove(Afoo_path.c_str() ) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang249.cpp b/src/tests/seq1/j-lang249.cpp new file mode 100644 index 0000000..23903b6 --- /dev/null +++ b/src/tests/seq1/j-lang249.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + + if ( remove(bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang25.cpp b/src/tests/seq1/j-lang25.cpp new file mode 100644 index 0000000..cb8aa5b --- /dev/null +++ b/src/tests/seq1/j-lang25.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE , 32768 , 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang250.cpp b/src/tests/seq1/j-lang250.cpp new file mode 100644 index 0000000..1133d9c --- /dev/null +++ b/src/tests/seq1/j-lang250.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + + if ( remove(bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang251.cpp b/src/tests/seq1/j-lang251.cpp new file mode 100644 index 0000000..f55d2de --- /dev/null +++ b/src/tests/seq1/j-lang251.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + + if ( remove(bar_path.c_str() ) < 0){ + return errno; + } + + + fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang252.cpp b/src/tests/seq1/j-lang252.cpp new file mode 100644 index 0000000..4987cde --- /dev/null +++ b/src/tests/seq1/j-lang252.cpp @@ -0,0 +1,137 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + + if ( remove(bar_path.c_str() ) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang253.cpp b/src/tests/seq1/j-lang253.cpp new file mode 100644 index 0000000..e2daab5 --- /dev/null +++ b/src/tests/seq1/j-lang253.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + + if ( remove(Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang254.cpp b/src/tests/seq1/j-lang254.cpp new file mode 100644 index 0000000..7eb315c --- /dev/null +++ b/src/tests/seq1/j-lang254.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + + if ( remove(Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang255.cpp b/src/tests/seq1/j-lang255.cpp new file mode 100644 index 0000000..a7607e2 --- /dev/null +++ b/src/tests/seq1/j-lang255.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + + if ( remove(Abar_path.c_str() ) < 0){ + return errno; + } + + + fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang256.cpp b/src/tests/seq1/j-lang256.cpp new file mode 100644 index 0000000..fba5f89 --- /dev/null +++ b/src/tests/seq1/j-lang256.cpp @@ -0,0 +1,142 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + + if ( remove(Abar_path.c_str() ) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang257.cpp b/src/tests/seq1/j-lang257.cpp new file mode 100644 index 0000000..2d8329c --- /dev/null +++ b/src/tests/seq1/j-lang257.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmRename (foo_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang258.cpp b/src/tests/seq1/j-lang258.cpp new file mode 100644 index 0000000..5f2fcde --- /dev/null +++ b/src/tests/seq1/j-lang258.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmRename (foo_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang259.cpp b/src/tests/seq1/j-lang259.cpp new file mode 100644 index 0000000..123c36d --- /dev/null +++ b/src/tests/seq1/j-lang259.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmRename (foo_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang26.cpp b/src/tests/seq1/j-lang26.cpp new file mode 100644 index 0000000..57dfac1 --- /dev/null +++ b/src/tests/seq1/j-lang26.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE , 32768 , 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang260.cpp b/src/tests/seq1/j-lang260.cpp new file mode 100644 index 0000000..36a87e2 --- /dev/null +++ b/src/tests/seq1/j-lang260.cpp @@ -0,0 +1,137 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmRename (foo_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang261.cpp b/src/tests/seq1/j-lang261.cpp new file mode 100644 index 0000000..e4df63e --- /dev/null +++ b/src/tests/seq1/j-lang261.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmRename (foo_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang262.cpp b/src/tests/seq1/j-lang262.cpp new file mode 100644 index 0000000..53486e9 --- /dev/null +++ b/src/tests/seq1/j-lang262.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmRename (foo_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang263.cpp b/src/tests/seq1/j-lang263.cpp new file mode 100644 index 0000000..8738f33 --- /dev/null +++ b/src/tests/seq1/j-lang263.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmRename (foo_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang264.cpp b/src/tests/seq1/j-lang264.cpp new file mode 100644 index 0000000..76fab2a --- /dev/null +++ b/src/tests/seq1/j-lang264.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmRename (foo_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang265.cpp b/src/tests/seq1/j-lang265.cpp new file mode 100644 index 0000000..4d76798 --- /dev/null +++ b/src/tests/seq1/j-lang265.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmRename (foo_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang266.cpp b/src/tests/seq1/j-lang266.cpp new file mode 100644 index 0000000..155e2c2 --- /dev/null +++ b/src/tests/seq1/j-lang266.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmRename (foo_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang267.cpp b/src/tests/seq1/j-lang267.cpp new file mode 100644 index 0000000..5a5e736 --- /dev/null +++ b/src/tests/seq1/j-lang267.cpp @@ -0,0 +1,142 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmRename (foo_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang268.cpp b/src/tests/seq1/j-lang268.cpp new file mode 100644 index 0000000..5fa427a --- /dev/null +++ b/src/tests/seq1/j-lang268.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmRename (Afoo_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang269.cpp b/src/tests/seq1/j-lang269.cpp new file mode 100644 index 0000000..6dd2077 --- /dev/null +++ b/src/tests/seq1/j-lang269.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmRename (Afoo_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang27.cpp b/src/tests/seq1/j-lang27.cpp new file mode 100644 index 0000000..c719e8e --- /dev/null +++ b/src/tests/seq1/j-lang27.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE , 32768 , 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang270.cpp b/src/tests/seq1/j-lang270.cpp new file mode 100644 index 0000000..59e4e4e --- /dev/null +++ b/src/tests/seq1/j-lang270.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmRename (Afoo_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang271.cpp b/src/tests/seq1/j-lang271.cpp new file mode 100644 index 0000000..bcc19cf --- /dev/null +++ b/src/tests/seq1/j-lang271.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmRename (Afoo_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang272.cpp b/src/tests/seq1/j-lang272.cpp new file mode 100644 index 0000000..5c9c6ce --- /dev/null +++ b/src/tests/seq1/j-lang272.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmRename (Afoo_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang273.cpp b/src/tests/seq1/j-lang273.cpp new file mode 100644 index 0000000..dae8a67 --- /dev/null +++ b/src/tests/seq1/j-lang273.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmRename (Afoo_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang274.cpp b/src/tests/seq1/j-lang274.cpp new file mode 100644 index 0000000..0222732 --- /dev/null +++ b/src/tests/seq1/j-lang274.cpp @@ -0,0 +1,142 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmRename (Afoo_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang275.cpp b/src/tests/seq1/j-lang275.cpp new file mode 100644 index 0000000..d69b367 --- /dev/null +++ b/src/tests/seq1/j-lang275.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmRename (Afoo_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang276.cpp b/src/tests/seq1/j-lang276.cpp new file mode 100644 index 0000000..484ffd7 --- /dev/null +++ b/src/tests/seq1/j-lang276.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmRename (Afoo_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang277.cpp b/src/tests/seq1/j-lang277.cpp new file mode 100644 index 0000000..5875962 --- /dev/null +++ b/src/tests/seq1/j-lang277.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmRename (Afoo_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang278.cpp b/src/tests/seq1/j-lang278.cpp new file mode 100644 index 0000000..a80ccd5 --- /dev/null +++ b/src/tests/seq1/j-lang278.cpp @@ -0,0 +1,142 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmRename (Afoo_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang279.cpp b/src/tests/seq1/j-lang279.cpp new file mode 100644 index 0000000..721cb41 --- /dev/null +++ b/src/tests/seq1/j-lang279.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmRename (bar_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang28.cpp b/src/tests/seq1/j-lang28.cpp new file mode 100644 index 0000000..a217559 --- /dev/null +++ b/src/tests/seq1/j-lang28.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE , 32768 , 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang280.cpp b/src/tests/seq1/j-lang280.cpp new file mode 100644 index 0000000..22fdf1a --- /dev/null +++ b/src/tests/seq1/j-lang280.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmRename (bar_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang281.cpp b/src/tests/seq1/j-lang281.cpp new file mode 100644 index 0000000..3009641 --- /dev/null +++ b/src/tests/seq1/j-lang281.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmRename (bar_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang282.cpp b/src/tests/seq1/j-lang282.cpp new file mode 100644 index 0000000..48d89f5 --- /dev/null +++ b/src/tests/seq1/j-lang282.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmRename (bar_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang283.cpp b/src/tests/seq1/j-lang283.cpp new file mode 100644 index 0000000..d3889e9 --- /dev/null +++ b/src/tests/seq1/j-lang283.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmRename (bar_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang284.cpp b/src/tests/seq1/j-lang284.cpp new file mode 100644 index 0000000..0cafeef --- /dev/null +++ b/src/tests/seq1/j-lang284.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmRename (bar_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang285.cpp b/src/tests/seq1/j-lang285.cpp new file mode 100644 index 0000000..caa4cc4 --- /dev/null +++ b/src/tests/seq1/j-lang285.cpp @@ -0,0 +1,142 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmRename (bar_path.c_str() , Abar_path.c_str() ) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang286.cpp b/src/tests/seq1/j-lang286.cpp new file mode 100644 index 0000000..baa8c89 --- /dev/null +++ b/src/tests/seq1/j-lang286.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmRename (Abar_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang287.cpp b/src/tests/seq1/j-lang287.cpp new file mode 100644 index 0000000..261a454 --- /dev/null +++ b/src/tests/seq1/j-lang287.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmRename (Abar_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang288.cpp b/src/tests/seq1/j-lang288.cpp new file mode 100644 index 0000000..89287f9 --- /dev/null +++ b/src/tests/seq1/j-lang288.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmRename (Abar_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang289.cpp b/src/tests/seq1/j-lang289.cpp new file mode 100644 index 0000000..b502947 --- /dev/null +++ b/src/tests/seq1/j-lang289.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmRename (Abar_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang29.cpp b/src/tests/seq1/j-lang29.cpp new file mode 100644 index 0000000..09b8d58 --- /dev/null +++ b/src/tests/seq1/j-lang29.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE , 0 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang290.cpp b/src/tests/seq1/j-lang290.cpp new file mode 100644 index 0000000..0620c27 --- /dev/null +++ b/src/tests/seq1/j-lang290.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmRename (Abar_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang291.cpp b/src/tests/seq1/j-lang291.cpp new file mode 100644 index 0000000..0cf36c8 --- /dev/null +++ b/src/tests/seq1/j-lang291.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmRename (Abar_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang292.cpp b/src/tests/seq1/j-lang292.cpp new file mode 100644 index 0000000..dc650d8 --- /dev/null +++ b/src/tests/seq1/j-lang292.cpp @@ -0,0 +1,142 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmRename (Abar_path.c_str() , bar_path.c_str() ) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang293.cpp b/src/tests/seq1/j-lang293.cpp new file mode 100644 index 0000000..ba5d3f0 --- /dev/null +++ b/src/tests/seq1/j-lang293.cpp @@ -0,0 +1,161 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmRename (A_path.c_str() , B_path.c_str() ) < 0){ + return errno; + } + + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang294.cpp b/src/tests/seq1/j-lang294.cpp new file mode 100644 index 0000000..19994a8 --- /dev/null +++ b/src/tests/seq1/j-lang294.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmRename (A_path.c_str() , B_path.c_str() ) < 0){ + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang295.cpp b/src/tests/seq1/j-lang295.cpp new file mode 100644 index 0000000..8a2436e --- /dev/null +++ b/src/tests/seq1/j-lang295.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmRename (A_path.c_str() , B_path.c_str() ) < 0){ + return errno; + } + + + int fd_B = cm_->CmOpen(B_path.c_str() , O_DIRECTORY , 0777); + if ( fd_B < 0 ) { + cm_->CmClose( fd_B); + return errno; + } + + + if ( cm_->CmFsync( fd_B) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_B) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang296.cpp b/src/tests/seq1/j-lang296.cpp new file mode 100644 index 0000000..b3cc5df --- /dev/null +++ b/src/tests/seq1/j-lang296.cpp @@ -0,0 +1,142 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmRename (A_path.c_str() , B_path.c_str() ) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang297.cpp b/src/tests/seq1/j-lang297.cpp new file mode 100644 index 0000000..9944c18 --- /dev/null +++ b/src/tests/seq1/j-lang297.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fsetxattr( fd_foo, "user.xattr1", "val1 ", 4, 0 ) < 0){ + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang298.cpp b/src/tests/seq1/j-lang298.cpp new file mode 100644 index 0000000..f0e0c4c --- /dev/null +++ b/src/tests/seq1/j-lang298.cpp @@ -0,0 +1,139 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fsetxattr( fd_foo, "user.xattr1", "val1 ", 4, 0 ) < 0){ + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang299.cpp b/src/tests/seq1/j-lang299.cpp new file mode 100644 index 0000000..c9f0dd2 --- /dev/null +++ b/src/tests/seq1/j-lang299.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fsetxattr( fd_foo, "user.xattr1", "val1 ", 4, 0 ) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang3.cpp b/src/tests/seq1/j-lang3.cpp new file mode 100644 index 0000000..6288cee --- /dev/null +++ b/src/tests/seq1/j-lang3.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang30.cpp b/src/tests/seq1/j-lang30.cpp new file mode 100644 index 0000000..a1b86d8 --- /dev/null +++ b/src/tests/seq1/j-lang30.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE , 0 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang300.cpp b/src/tests/seq1/j-lang300.cpp new file mode 100644 index 0000000..71a1775 --- /dev/null +++ b/src/tests/seq1/j-lang300.cpp @@ -0,0 +1,137 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fsetxattr( fd_foo, "user.xattr1", "val1 ", 4, 0 ) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang301.cpp b/src/tests/seq1/j-lang301.cpp new file mode 100644 index 0000000..e9052f0 --- /dev/null +++ b/src/tests/seq1/j-lang301.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fsetxattr( fd_Afoo, "user.xattr1", "val1 ", 4, 0 ) < 0){ + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang302.cpp b/src/tests/seq1/j-lang302.cpp new file mode 100644 index 0000000..53af7e7 --- /dev/null +++ b/src/tests/seq1/j-lang302.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fsetxattr( fd_Afoo, "user.xattr1", "val1 ", 4, 0 ) < 0){ + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang303.cpp b/src/tests/seq1/j-lang303.cpp new file mode 100644 index 0000000..1db0b2d --- /dev/null +++ b/src/tests/seq1/j-lang303.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fsetxattr( fd_Afoo, "user.xattr1", "val1 ", 4, 0 ) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang304.cpp b/src/tests/seq1/j-lang304.cpp new file mode 100644 index 0000000..23f76ca --- /dev/null +++ b/src/tests/seq1/j-lang304.cpp @@ -0,0 +1,142 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fsetxattr( fd_Afoo, "user.xattr1", "val1 ", 4, 0 ) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang305.cpp b/src/tests/seq1/j-lang305.cpp new file mode 100644 index 0000000..9acb8e5 --- /dev/null +++ b/src/tests/seq1/j-lang305.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fsetxattr( fd_foo, "user.xattr1", "val1 ", 4, 0 ) < 0){ + return errno; + } + + + if ( removexattr(foo_path.c_str() , "user.xattr1") < 0){ + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang306.cpp b/src/tests/seq1/j-lang306.cpp new file mode 100644 index 0000000..0c08ab0 --- /dev/null +++ b/src/tests/seq1/j-lang306.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fsetxattr( fd_foo, "user.xattr1", "val1 ", 4, 0 ) < 0){ + return errno; + } + + + if ( removexattr(foo_path.c_str() , "user.xattr1") < 0){ + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang307.cpp b/src/tests/seq1/j-lang307.cpp new file mode 100644 index 0000000..eb0f4a0 --- /dev/null +++ b/src/tests/seq1/j-lang307.cpp @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fsetxattr( fd_foo, "user.xattr1", "val1 ", 4, 0 ) < 0){ + return errno; + } + + + if ( removexattr(foo_path.c_str() , "user.xattr1") < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang308.cpp b/src/tests/seq1/j-lang308.cpp new file mode 100644 index 0000000..f03ec8a --- /dev/null +++ b/src/tests/seq1/j-lang308.cpp @@ -0,0 +1,142 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fsetxattr( fd_foo, "user.xattr1", "val1 ", 4, 0 ) < 0){ + return errno; + } + + + if ( removexattr(foo_path.c_str() , "user.xattr1") < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang309.cpp b/src/tests/seq1/j-lang309.cpp new file mode 100644 index 0000000..7f58432 --- /dev/null +++ b/src/tests/seq1/j-lang309.cpp @@ -0,0 +1,161 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fsetxattr( fd_Afoo, "user.xattr1", "val1 ", 4, 0 ) < 0){ + return errno; + } + + + if ( removexattr(Afoo_path.c_str() , "user.xattr1") < 0){ + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang31.cpp b/src/tests/seq1/j-lang31.cpp new file mode 100644 index 0000000..83d8517 --- /dev/null +++ b/src/tests/seq1/j-lang31.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE , 0 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang310.cpp b/src/tests/seq1/j-lang310.cpp new file mode 100644 index 0000000..a5fc1a4 --- /dev/null +++ b/src/tests/seq1/j-lang310.cpp @@ -0,0 +1,149 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fsetxattr( fd_Afoo, "user.xattr1", "val1 ", 4, 0 ) < 0){ + return errno; + } + + + if ( removexattr(Afoo_path.c_str() , "user.xattr1") < 0){ + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang311.cpp b/src/tests/seq1/j-lang311.cpp new file mode 100644 index 0000000..ab90236 --- /dev/null +++ b/src/tests/seq1/j-lang311.cpp @@ -0,0 +1,161 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fsetxattr( fd_Afoo, "user.xattr1", "val1 ", 4, 0 ) < 0){ + return errno; + } + + + if ( removexattr(Afoo_path.c_str() , "user.xattr1") < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang312.cpp b/src/tests/seq1/j-lang312.cpp new file mode 100644 index 0000000..e24b937 --- /dev/null +++ b/src/tests/seq1/j-lang312.cpp @@ -0,0 +1,147 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fsetxattr( fd_Afoo, "user.xattr1", "val1 ", 4, 0 ) < 0){ + return errno; + } + + + if ( removexattr(Afoo_path.c_str() , "user.xattr1") < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang313.cpp b/src/tests/seq1/j-lang313.cpp new file mode 100644 index 0000000..d45b5d0 --- /dev/null +++ b/src/tests/seq1/j-lang313.cpp @@ -0,0 +1,157 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( truncate (foo_path.c_str(), 2500) < 0){ + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang314.cpp b/src/tests/seq1/j-lang314.cpp new file mode 100644 index 0000000..56639f7 --- /dev/null +++ b/src/tests/seq1/j-lang314.cpp @@ -0,0 +1,145 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( truncate (foo_path.c_str(), 2500) < 0){ + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang315.cpp b/src/tests/seq1/j-lang315.cpp new file mode 100644 index 0000000..2a3b782 --- /dev/null +++ b/src/tests/seq1/j-lang315.cpp @@ -0,0 +1,157 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( truncate (foo_path.c_str(), 2500) < 0){ + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang316.cpp b/src/tests/seq1/j-lang316.cpp new file mode 100644 index 0000000..7b6bb9f --- /dev/null +++ b/src/tests/seq1/j-lang316.cpp @@ -0,0 +1,143 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( truncate (foo_path.c_str(), 2500) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang317.cpp b/src/tests/seq1/j-lang317.cpp new file mode 100644 index 0000000..fe5609e --- /dev/null +++ b/src/tests/seq1/j-lang317.cpp @@ -0,0 +1,162 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( truncate (Afoo_path.c_str(), 2500) < 0){ + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang318.cpp b/src/tests/seq1/j-lang318.cpp new file mode 100644 index 0000000..61e317d --- /dev/null +++ b/src/tests/seq1/j-lang318.cpp @@ -0,0 +1,150 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( truncate (Afoo_path.c_str(), 2500) < 0){ + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang319.cpp b/src/tests/seq1/j-lang319.cpp new file mode 100644 index 0000000..d15e010 --- /dev/null +++ b/src/tests/seq1/j-lang319.cpp @@ -0,0 +1,162 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( truncate (Afoo_path.c_str(), 2500) < 0){ + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang32.cpp b/src/tests/seq1/j-lang32.cpp new file mode 100644 index 0000000..a0838f4 --- /dev/null +++ b/src/tests/seq1/j-lang32.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE , 0 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang320.cpp b/src/tests/seq1/j-lang320.cpp new file mode 100644 index 0000000..5b64b74 --- /dev/null +++ b/src/tests/seq1/j-lang320.cpp @@ -0,0 +1,148 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( truncate (Afoo_path.c_str(), 2500) < 0){ + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang321.cpp b/src/tests/seq1/j-lang321.cpp new file mode 100644 index 0000000..c65e947 --- /dev/null +++ b/src/tests/seq1/j-lang321.cpp @@ -0,0 +1,134 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFdatasync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang322.cpp b/src/tests/seq1/j-lang322.cpp new file mode 100644 index 0000000..c65e947 --- /dev/null +++ b/src/tests/seq1/j-lang322.cpp @@ -0,0 +1,134 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFdatasync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang323.cpp b/src/tests/seq1/j-lang323.cpp new file mode 100644 index 0000000..c65e947 --- /dev/null +++ b/src/tests/seq1/j-lang323.cpp @@ -0,0 +1,134 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFdatasync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang324.cpp b/src/tests/seq1/j-lang324.cpp new file mode 100644 index 0000000..c65e947 --- /dev/null +++ b/src/tests/seq1/j-lang324.cpp @@ -0,0 +1,134 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFdatasync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang325.cpp b/src/tests/seq1/j-lang325.cpp new file mode 100644 index 0000000..36ff38f --- /dev/null +++ b/src/tests/seq1/j-lang325.cpp @@ -0,0 +1,139 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFdatasync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang326.cpp b/src/tests/seq1/j-lang326.cpp new file mode 100644 index 0000000..36ff38f --- /dev/null +++ b/src/tests/seq1/j-lang326.cpp @@ -0,0 +1,139 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFdatasync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang327.cpp b/src/tests/seq1/j-lang327.cpp new file mode 100644 index 0000000..36ff38f --- /dev/null +++ b/src/tests/seq1/j-lang327.cpp @@ -0,0 +1,139 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFdatasync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang328.cpp b/src/tests/seq1/j-lang328.cpp new file mode 100644 index 0000000..36ff38f --- /dev/null +++ b/src/tests/seq1/j-lang328.cpp @@ -0,0 +1,139 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFdatasync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang33.cpp b/src/tests/seq1/j-lang33.cpp new file mode 100644 index 0000000..29c730d --- /dev/null +++ b/src/tests/seq1/j-lang33.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE , 30768 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang34.cpp b/src/tests/seq1/j-lang34.cpp new file mode 100644 index 0000000..90b5a9e --- /dev/null +++ b/src/tests/seq1/j-lang34.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE , 30768 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang35.cpp b/src/tests/seq1/j-lang35.cpp new file mode 100644 index 0000000..c845ffe --- /dev/null +++ b/src/tests/seq1/j-lang35.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE , 30768 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang36.cpp b/src/tests/seq1/j-lang36.cpp new file mode 100644 index 0000000..299c6a3 --- /dev/null +++ b/src/tests/seq1/j-lang36.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE , 30768 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang37.cpp b/src/tests/seq1/j-lang37.cpp new file mode 100644 index 0000000..786b542 --- /dev/null +++ b/src/tests/seq1/j-lang37.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE , 32768 , 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang38.cpp b/src/tests/seq1/j-lang38.cpp new file mode 100644 index 0000000..79af8b6 --- /dev/null +++ b/src/tests/seq1/j-lang38.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE , 32768 , 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang39.cpp b/src/tests/seq1/j-lang39.cpp new file mode 100644 index 0000000..3cb7bba --- /dev/null +++ b/src/tests/seq1/j-lang39.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE , 32768 , 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang4.cpp b/src/tests/seq1/j-lang4.cpp new file mode 100644 index 0000000..8ebc8f4 --- /dev/null +++ b/src/tests/seq1/j-lang4.cpp @@ -0,0 +1,132 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang40.cpp b/src/tests/seq1/j-lang40.cpp new file mode 100644 index 0000000..28c07c7 --- /dev/null +++ b/src/tests/seq1/j-lang40.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE , 32768 , 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang41.cpp b/src/tests/seq1/j-lang41.cpp new file mode 100644 index 0000000..58c10c9 --- /dev/null +++ b/src/tests/seq1/j-lang41.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE , 0 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang42.cpp b/src/tests/seq1/j-lang42.cpp new file mode 100644 index 0000000..72c47b7 --- /dev/null +++ b/src/tests/seq1/j-lang42.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE , 0 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang43.cpp b/src/tests/seq1/j-lang43.cpp new file mode 100644 index 0000000..f3b6c45 --- /dev/null +++ b/src/tests/seq1/j-lang43.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE , 0 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang44.cpp b/src/tests/seq1/j-lang44.cpp new file mode 100644 index 0000000..f9448cf --- /dev/null +++ b/src/tests/seq1/j-lang44.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE , 0 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang45.cpp b/src/tests/seq1/j-lang45.cpp new file mode 100644 index 0000000..5048b50 --- /dev/null +++ b/src/tests/seq1/j-lang45.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE , 30768 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang46.cpp b/src/tests/seq1/j-lang46.cpp new file mode 100644 index 0000000..d4e2065 --- /dev/null +++ b/src/tests/seq1/j-lang46.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE , 30768 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang47.cpp b/src/tests/seq1/j-lang47.cpp new file mode 100644 index 0000000..ef61148 --- /dev/null +++ b/src/tests/seq1/j-lang47.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE , 30768 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang48.cpp b/src/tests/seq1/j-lang48.cpp new file mode 100644 index 0000000..ba5b3c2 --- /dev/null +++ b/src/tests/seq1/j-lang48.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE , 30768 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang49.cpp b/src/tests/seq1/j-lang49.cpp new file mode 100644 index 0000000..7def3b3 --- /dev/null +++ b/src/tests/seq1/j-lang49.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_KEEP_SIZE , 32768 , 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang5.cpp b/src/tests/seq1/j-lang5.cpp new file mode 100644 index 0000000..0313949 --- /dev/null +++ b/src/tests/seq1/j-lang5.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang50.cpp b/src/tests/seq1/j-lang50.cpp new file mode 100644 index 0000000..42e23fc --- /dev/null +++ b/src/tests/seq1/j-lang50.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_KEEP_SIZE , 32768 , 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang51.cpp b/src/tests/seq1/j-lang51.cpp new file mode 100644 index 0000000..86631b8 --- /dev/null +++ b/src/tests/seq1/j-lang51.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_KEEP_SIZE , 32768 , 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang52.cpp b/src/tests/seq1/j-lang52.cpp new file mode 100644 index 0000000..4ad926a --- /dev/null +++ b/src/tests/seq1/j-lang52.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_KEEP_SIZE , 32768 , 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang53.cpp b/src/tests/seq1/j-lang53.cpp new file mode 100644 index 0000000..251855e --- /dev/null +++ b/src/tests/seq1/j-lang53.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_KEEP_SIZE , 0 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang54.cpp b/src/tests/seq1/j-lang54.cpp new file mode 100644 index 0000000..cb86df4 --- /dev/null +++ b/src/tests/seq1/j-lang54.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_KEEP_SIZE , 0 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang55.cpp b/src/tests/seq1/j-lang55.cpp new file mode 100644 index 0000000..4827f84 --- /dev/null +++ b/src/tests/seq1/j-lang55.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_KEEP_SIZE , 0 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang56.cpp b/src/tests/seq1/j-lang56.cpp new file mode 100644 index 0000000..a448aad --- /dev/null +++ b/src/tests/seq1/j-lang56.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_KEEP_SIZE , 0 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang57.cpp b/src/tests/seq1/j-lang57.cpp new file mode 100644 index 0000000..4f1391f --- /dev/null +++ b/src/tests/seq1/j-lang57.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_KEEP_SIZE , 30768 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang58.cpp b/src/tests/seq1/j-lang58.cpp new file mode 100644 index 0000000..b3bf042 --- /dev/null +++ b/src/tests/seq1/j-lang58.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_KEEP_SIZE , 30768 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang59.cpp b/src/tests/seq1/j-lang59.cpp new file mode 100644 index 0000000..30f676f --- /dev/null +++ b/src/tests/seq1/j-lang59.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_KEEP_SIZE , 30768 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang6.cpp b/src/tests/seq1/j-lang6.cpp new file mode 100644 index 0000000..41118c3 --- /dev/null +++ b/src/tests/seq1/j-lang6.cpp @@ -0,0 +1,139 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang60.cpp b/src/tests/seq1/j-lang60.cpp new file mode 100644 index 0000000..e513a59 --- /dev/null +++ b/src/tests/seq1/j-lang60.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , FALLOC_FL_KEEP_SIZE , 30768 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang61.cpp b/src/tests/seq1/j-lang61.cpp new file mode 100644 index 0000000..12c952b --- /dev/null +++ b/src/tests/seq1/j-lang61.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , 0 , 32768 , 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang62.cpp b/src/tests/seq1/j-lang62.cpp new file mode 100644 index 0000000..b02bb38 --- /dev/null +++ b/src/tests/seq1/j-lang62.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , 0 , 32768 , 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang63.cpp b/src/tests/seq1/j-lang63.cpp new file mode 100644 index 0000000..bfa5617 --- /dev/null +++ b/src/tests/seq1/j-lang63.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , 0 , 32768 , 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang64.cpp b/src/tests/seq1/j-lang64.cpp new file mode 100644 index 0000000..ee04d9b --- /dev/null +++ b/src/tests/seq1/j-lang64.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , 0 , 32768 , 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang65.cpp b/src/tests/seq1/j-lang65.cpp new file mode 100644 index 0000000..5c12ac5 --- /dev/null +++ b/src/tests/seq1/j-lang65.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , 0 , 0 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang66.cpp b/src/tests/seq1/j-lang66.cpp new file mode 100644 index 0000000..2a528fb --- /dev/null +++ b/src/tests/seq1/j-lang66.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , 0 , 0 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang67.cpp b/src/tests/seq1/j-lang67.cpp new file mode 100644 index 0000000..a51f88d --- /dev/null +++ b/src/tests/seq1/j-lang67.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , 0 , 0 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang68.cpp b/src/tests/seq1/j-lang68.cpp new file mode 100644 index 0000000..62e9661 --- /dev/null +++ b/src/tests/seq1/j-lang68.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , 0 , 0 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang69.cpp b/src/tests/seq1/j-lang69.cpp new file mode 100644 index 0000000..14fdea9 --- /dev/null +++ b/src/tests/seq1/j-lang69.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , 0 , 30768 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_test = cm_->CmOpen(test_path.c_str() , O_DIRECTORY , 0777); + if ( fd_test < 0 ) { + cm_->CmClose( fd_test); + return errno; + } + + + if ( cm_->CmFsync( fd_test) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_test) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang7.cpp b/src/tests/seq1/j-lang7.cpp new file mode 100644 index 0000000..b3a1d94 --- /dev/null +++ b/src/tests/seq1/j-lang7.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang70.cpp b/src/tests/seq1/j-lang70.cpp new file mode 100644 index 0000000..84ac67f --- /dev/null +++ b/src/tests/seq1/j-lang70.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , 0 , 30768 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( cm_->CmFsync( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang71.cpp b/src/tests/seq1/j-lang71.cpp new file mode 100644 index 0000000..8444adf --- /dev/null +++ b/src/tests/seq1/j-lang71.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , 0 , 30768 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + int fd_bar = cm_->CmOpen(bar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_bar < 0 ) { + cm_->CmClose( fd_bar); + return errno; + } + + + if ( cm_->CmFsync( fd_bar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_bar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang72.cpp b/src/tests/seq1/j-lang72.cpp new file mode 100644 index 0000000..fd37876 --- /dev/null +++ b/src/tests/seq1/j-lang72.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + int fd_foo = cm_->CmOpen(foo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_foo < 0 ) { + cm_->CmClose( fd_foo); + return errno; + } + + + if ( WriteData ( fd_foo, 0, 32768) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + if ( fallocate( fd_foo , 0 , 30768 , 5000) < 0){ + cm_->CmClose( fd_foo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_foo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang73.cpp b/src/tests/seq1/j-lang73.cpp new file mode 100644 index 0000000..e9086d9 --- /dev/null +++ b/src/tests/seq1/j-lang73.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_ZERO_RANGE , 32768 , 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang74.cpp b/src/tests/seq1/j-lang74.cpp new file mode 100644 index 0000000..35af75c --- /dev/null +++ b/src/tests/seq1/j-lang74.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_ZERO_RANGE , 32768 , 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang75.cpp b/src/tests/seq1/j-lang75.cpp new file mode 100644 index 0000000..0df9123 --- /dev/null +++ b/src/tests/seq1/j-lang75.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_ZERO_RANGE , 32768 , 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang76.cpp b/src/tests/seq1/j-lang76.cpp new file mode 100644 index 0000000..2127898 --- /dev/null +++ b/src/tests/seq1/j-lang76.cpp @@ -0,0 +1,149 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_ZERO_RANGE , 32768 , 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang77.cpp b/src/tests/seq1/j-lang77.cpp new file mode 100644 index 0000000..350bd40 --- /dev/null +++ b/src/tests/seq1/j-lang77.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_ZERO_RANGE , 0 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang78.cpp b/src/tests/seq1/j-lang78.cpp new file mode 100644 index 0000000..ae5dab0 --- /dev/null +++ b/src/tests/seq1/j-lang78.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_ZERO_RANGE , 0 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang79.cpp b/src/tests/seq1/j-lang79.cpp new file mode 100644 index 0000000..47bce5e --- /dev/null +++ b/src/tests/seq1/j-lang79.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_ZERO_RANGE , 0 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang8.cpp b/src/tests/seq1/j-lang8.cpp new file mode 100644 index 0000000..3342956 --- /dev/null +++ b/src/tests/seq1/j-lang8.cpp @@ -0,0 +1,137 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang80.cpp b/src/tests/seq1/j-lang80.cpp new file mode 100644 index 0000000..c5a7934 --- /dev/null +++ b/src/tests/seq1/j-lang80.cpp @@ -0,0 +1,149 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_ZERO_RANGE , 0 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang81.cpp b/src/tests/seq1/j-lang81.cpp new file mode 100644 index 0000000..29d6163 --- /dev/null +++ b/src/tests/seq1/j-lang81.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_ZERO_RANGE , 30768 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang82.cpp b/src/tests/seq1/j-lang82.cpp new file mode 100644 index 0000000..4c19ee6 --- /dev/null +++ b/src/tests/seq1/j-lang82.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_ZERO_RANGE , 30768 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang83.cpp b/src/tests/seq1/j-lang83.cpp new file mode 100644 index 0000000..dba84ca --- /dev/null +++ b/src/tests/seq1/j-lang83.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_ZERO_RANGE , 30768 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang84.cpp b/src/tests/seq1/j-lang84.cpp new file mode 100644 index 0000000..b73558c --- /dev/null +++ b/src/tests/seq1/j-lang84.cpp @@ -0,0 +1,149 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_ZERO_RANGE , 30768 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang85.cpp b/src/tests/seq1/j-lang85.cpp new file mode 100644 index 0000000..79ea7b5 --- /dev/null +++ b/src/tests/seq1/j-lang85.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE , 32768 , 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang86.cpp b/src/tests/seq1/j-lang86.cpp new file mode 100644 index 0000000..0a24229 --- /dev/null +++ b/src/tests/seq1/j-lang86.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE , 32768 , 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang87.cpp b/src/tests/seq1/j-lang87.cpp new file mode 100644 index 0000000..2db1395 --- /dev/null +++ b/src/tests/seq1/j-lang87.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE , 32768 , 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang88.cpp b/src/tests/seq1/j-lang88.cpp new file mode 100644 index 0000000..de8f1db --- /dev/null +++ b/src/tests/seq1/j-lang88.cpp @@ -0,0 +1,149 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE , 32768 , 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang89.cpp b/src/tests/seq1/j-lang89.cpp new file mode 100644 index 0000000..40ba019 --- /dev/null +++ b/src/tests/seq1/j-lang89.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE , 0 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang9.cpp b/src/tests/seq1/j-lang9.cpp new file mode 100644 index 0000000..5d76dba --- /dev/null +++ b/src/tests/seq1/j-lang9.cpp @@ -0,0 +1,139 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang90.cpp b/src/tests/seq1/j-lang90.cpp new file mode 100644 index 0000000..57789f9 --- /dev/null +++ b/src/tests/seq1/j-lang90.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE , 0 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang91.cpp b/src/tests/seq1/j-lang91.cpp new file mode 100644 index 0000000..01652ff --- /dev/null +++ b/src/tests/seq1/j-lang91.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE , 0 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang92.cpp b/src/tests/seq1/j-lang92.cpp new file mode 100644 index 0000000..3b25c52 --- /dev/null +++ b/src/tests/seq1/j-lang92.cpp @@ -0,0 +1,149 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE , 0 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang93.cpp b/src/tests/seq1/j-lang93.cpp new file mode 100644 index 0000000..5d352fd --- /dev/null +++ b/src/tests/seq1/j-lang93.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE , 30768 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang94.cpp b/src/tests/seq1/j-lang94.cpp new file mode 100644 index 0000000..731aaf3 --- /dev/null +++ b/src/tests/seq1/j-lang94.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE , 30768 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang95.cpp b/src/tests/seq1/j-lang95.cpp new file mode 100644 index 0000000..019a67f --- /dev/null +++ b/src/tests/seq1/j-lang95.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE , 30768 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang96.cpp b/src/tests/seq1/j-lang96.cpp new file mode 100644 index 0000000..87b39b9 --- /dev/null +++ b/src/tests/seq1/j-lang96.cpp @@ -0,0 +1,149 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE , 30768 , 5000) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + cm_->CmSync(); + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang97.cpp b/src/tests/seq1/j-lang97.cpp new file mode 100644 index 0000000..9161e31 --- /dev/null +++ b/src/tests/seq1/j-lang97.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE , 32768 , 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_A = cm_->CmOpen(A_path.c_str() , O_DIRECTORY , 0777); + if ( fd_A < 0 ) { + cm_->CmClose( fd_A); + return errno; + } + + + if ( cm_->CmFsync( fd_A) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_A) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang98.cpp b/src/tests/seq1/j-lang98.cpp new file mode 100644 index 0000000..9acb211 --- /dev/null +++ b/src/tests/seq1/j-lang98.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE , 32768 , 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( cm_->CmFsync( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/tests/seq1/j-lang99.cpp b/src/tests/seq1/j-lang99.cpp new file mode 100644 index 0000000..2ebaced --- /dev/null +++ b/src/tests/seq1/j-lang99.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../BaseTestCase.h" +#include "../../wrapper/workload.h" +#include "../../wrapper/actions.h" + +using tests::DataTestResult; +using wrapper::WriteData; +using wrapper::WriteDataMmap; +using wrapper::Checkpoint; +using std::string; + +#define TEST_FILE_PERMS ((mode_t) (S_IRWXU | S_IRWXG | S_IRWXO)) + + namespace tests { + + + class testName: public BaseTestCase { + + public: + + virtual int setup() override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + virtual int run( int checkpoint ) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + int local_checkpoint = 0 ; + + if ( mkdir(A_path.c_str() , 0777) < 0){ + return errno; + } + + + int fd_Afoo = cm_->CmOpen(Afoo_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Afoo < 0 ) { + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( WriteData ( fd_Afoo, 0, 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + if ( fallocate( fd_Afoo , FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE , 32768 , 32768) < 0){ + cm_->CmClose( fd_Afoo); + return errno; + } + + + int fd_Abar = cm_->CmOpen(Abar_path.c_str() , O_RDWR|O_CREAT , 0777); + if ( fd_Abar < 0 ) { + cm_->CmClose( fd_Abar); + return errno; + } + + + if ( cm_->CmFsync( fd_Abar) < 0){ + return errno; + } + + + if ( cm_->CmCheckpoint() < 0){ + return -1; + } + local_checkpoint += 1; + if (local_checkpoint == checkpoint) { + return 1; + } + + + if ( cm_->CmClose ( fd_Afoo) < 0){ + return errno; + } + + + if ( cm_->CmClose ( fd_Abar) < 0){ + return errno; + } + + return 0; + } + + virtual int check_test( unsigned int last_checkpoint, DataTestResult *test_result) override { + + test_path = mnt_dir_ ; + A_path = mnt_dir_ + "/A"; + AC_path = mnt_dir_ + "/A/C"; + B_path = mnt_dir_ + "/B"; + foo_path = mnt_dir_ + "/foo"; + bar_path = mnt_dir_ + "/bar"; + Afoo_path = mnt_dir_ + "/A/foo"; + Abar_path = mnt_dir_ + "/A/bar"; + Bfoo_path = mnt_dir_ + "/B/foo"; + Bbar_path = mnt_dir_ + "/B/bar"; + ACfoo_path = mnt_dir_ + "/A/C/foo"; + ACbar_path = mnt_dir_ + "/A/C/bar"; + return 0; + } + + private: + + string test_path; + string A_path; + string AC_path; + string B_path; + string foo_path; + string bar_path; + string Afoo_path; + string Abar_path; + string Bfoo_path; + string Bbar_path; + string ACfoo_path; + string ACbar_path; + + }; + + } // namespace tests + + extern "C" tests::BaseTestCase *test_case_get_instance() { + return new tests::testName; + } + + extern "C" void test_case_delete_instance(tests::BaseTestCase *tc) { + delete tc; + } diff --git a/src/wrapper/actions.cpp b/src/wrapper/actions.cpp index 642de6b..bb2112d 100644 --- a/src/wrapper/actions.cpp +++ b/src/wrapper/actions.cpp @@ -4,9 +4,9 @@ namespace wrapper { int Checkpoint() { - // Issue an unusual, old instruction so that writetracker can pick it up and record a checkpoint in wt.out - // fdisi is an old "disable floating point interrupts" instruction that is a nop on modern CPUs - asm volatile("fdisi"); + // Issue an unusual instruction so that writetracker can pick it up and record a checkpoint in wt.out + // f2xm1 is 2^x-1 floating point, likely to be unused by file systems + asm volatile("f2xm1"); return 0; } diff --git a/xfsMonkey.py b/xfsMonkey.py new file mode 100755 index 0000000..4de7235 --- /dev/null +++ b/xfsMonkey.py @@ -0,0 +1,185 @@ +#!/usr/bin/env python3 +# XFSMonkey is the tool that let's you run a collection of tests on CrashMonkey. +# These tests could be auto-generated by Ace, or could be a pre-defined set of tests such as the ones at code/tests/reproduced_bugs, code/tests/new_bugs + +import os +import re +import sys +import stat +import subprocess +import argparse +import time + + +class Log: + def __init__(self, *files): + self.files = files + def write(self, obj): + for f in self.files: + f.write(obj) + f.flush() + def flush(self) : + for f in self.files: + f.flush() + +def build_parser(): + parser = argparse.ArgumentParser(description='XFSMonkey') + + # global args + parser.add_argument('--fs_type', '-f', default='NOVA', help='Filesystem on which you wish to run tests using XFSMonkey. Default = NOVA') + + # crash monkey args + parser.add_argument('--record_start', '-b', default=0x40000000, type=int, help='Start of recorded region') + parser.add_argument('--record_end', '-e', default=0x48000000, type=int, help='End of recorded region') + parser.add_argument('--iterations', '-s', default=10000, type=int, help='Number of random crash states to test on. Default = 1000') + parser.add_argument('--record_dev', '-d', default='/dev/pmem0', help='Record device. Default = /dev/pmem0') + parser.add_argument('--replay_dev', '-r', default='/dev/pmem1', help='Replay device. Default = /dev/pmem1') + + #Requires changes to Makefile to place our xfstests into this folder by default. + parser.add_argument('--test_path', '-u', default='build/tests/', help='Path to xfsMonkeyTests') + return parser + +def cleanup(): + #clean up umount and rmmod errors + # command = 'umount /mnt/snapshot; rmmod ./build/disk_wrapper.ko; rmmod ./build/cow_brd.ko' + # p=subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) + # (out, err) = p.communicate() + # p.wait() + #print 'Done cleaning up test harness' + pass + +def get_current_epoch_micros(): + return int(time.time() * 1000) + + +def get_time_string(): + epoch_micros = get_current_epoch_micros() + epoch_secs = epoch_micros / 1000 + micros = epoch_micros % 1000 + + return time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(epoch_secs)) + '.' + str(micros) + ' ' + # return time.strftime('%c') + ' ' + + +def get_time_from_epoch(epoch_secs): + return time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(epoch_secs)) + +def print_setup(parsed_args): + print('==================== Setup ====================\n') + print('{0:20} {1}'.format('Filesystem type', parsed_args.fs_type)) + print('{0:20} {1}'.format('Record Start', parsed_args.record_start)) + print('{0:20} {1}'.format('Record End', parsed_args.record_end)) + #print '{0:20} {1}'.format('Iterations per test', parsed_args.iterations) + print('{0:20} {1}'.format('Record device', parsed_args.record_dev)) + print('{0:20} {1}'.format('Replay device', parsed_args.replay_dev)) + print('{0:20} {1}'.format('Test path', parsed_args.test_path)) + print('\n================================================\n') + +def main(): + + # Open the log file + log_file = time.strftime('%Y%m%d_%H%M%S') + '-xfsMonkey.log' + log_file_handle = open(log_file, 'w') + original = sys.stdout + sys.stdout = Log(sys.stdout, log_file_handle) + + parsed_args = build_parser().parse_args() + + #Print the test setup + print_setup(parsed_args) + + #Assign a test num + test_num = 0 + + #This is the directory that contains the bug reports from this xfsMonkey run + subprocess.call('mkdir diff_results', shell=True) + subprocess.call('echo 0 > missing; echo 0 > stat; echo 0 > bugs; echo 0 > others', shell=True) + + #Get the relative path to test directory + xfsMonkeyTestPath = './' + parsed_args.test_path + + for filename in os.listdir(xfsMonkeyTestPath): + if filename.endswith('.so'): + + #Assign a snapshot file name for replay using CrashMonkey. + #If we have a large number of tests in the test suite, then this might blow + #up space. (Feature not implemented yet). + snapshot = filename.replace('.so', '') + '_' + parsed_args.fs_type + + #Get full test file path + test_file = xfsMonkeyTestPath + filename + + #Build command to run c_harness + print(test_file) + command = ('./harness -v -b {} -e {} -f {} -d {} -r {} {}'.format( + parsed_args.record_start, + parsed_args.record_end, + parsed_args.fs_type, + parsed_args.record_dev, + parsed_args.replay_dev, + test_file + )) + + #Cleanup errors due to prev runs if any + cleanup() + + + #Print the test number + test_num+=1 + log = '\n' + '-'*20 + 'Test #' + str(test_num) + '-'*20 + '\n' + log_file_handle.write(log) + + #Run the test now + log = get_time_string() + 'Running test : '+ filename.replace('.so', '') + 'as Crashmonkey standalone \n' + log_file_handle.write(log) + sys.stdout.write('Running test #' + str(test_num) + ' : ' + filename.replace('.so', '')) + #get_time_string(), 'Running...' + + #Sometimes we face an error connecting to socket. So let's retry one more time + #if CM throws a error for a particular test. + retry = 0 + while True: + p=subprocess.Popen(command, stdout=subprocess.PIPE, shell=True) + (output,err)=p.communicate() + p_status=p.wait() + + # Printing the output on stdout seems too noisy. It's cleaner to have only the result + # of each test printed. However due to the long writeback delay, it seems as though + # the test case hung. + # (TODO : Add a flag in c_harness to interactively print when we wait for writeback + # or start testing) + res = re.sub(br'(?s).*Reordering', b'\nReordering', output, flags=re.I) + res_final = re.sub(br'==.*(?s)', '\n', res) + + #print output + retry += 1 + if (p_status == 0 or retry == 4): + if retry == 4 and p_status != 0 : + log_file_handle.write(get_time_string() + 'Could not run test : ' + filename.replace('.so', '')) + else: + log_file_handle.write(str(res_final)) + break + else: + error = re.sub(br'(?s).*error', b'\nError', output, flags=re.I) + log_file_handle.write(get_time_string() + str(error)) + #os.system('bash vm_scripts/cm_cleanup.sh') + cleanup() + log_file_handle.write(get_time_string() + 'Retry running ' + filename.replace('.so', '') + '\n' + get_time_string() + 'Running... ') + file = filename.replace('.so', '') + #diff_command = 'tail -vn +1 build/diff* >> diff_results/' + file + '; rm build/diff*' + #subprocess.call('cat build/diff* > out', shell=True) + + #Get the last numbered diff file if present, and clean up diffs + subprocess.call('cat build/$(ls build/ | grep diff | tail -n -1) > out 2>/dev/null', shell=True) + diff_command = './copy_diff.sh out ' + file + ' 1' + #subprocess.call('tail -vn +1 build/diff*', shell=True) + subprocess.call(diff_command, shell=True) + + log_file_handle.write('\n'+ get_time_string() + ': Test completed. See ' + log_file + ' for test summary\n') + #Stop logging + sys.stdout = original + log_file_handle.close() + print("\nTesting complete...\n") + +if __name__ == '__main__': + main()