MCPcopy Create free account
hub / github.com/Singular/Singular / omtTestErrors

Function omtTestErrors

omalloc/omtTestError.c:37–437  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37int omtTestErrors()
38{
39#ifndef OM_NDEBUG
40 int level = om_Opts.MinCheck;
41 omError_t error;
42 struct LongSpec spec;
43 int missed = 0, alloc;
44 omMemCell cell = NULL;
45
46 printf("omtTestErrors: Start\n");
47 om_Opts.MinCheck = 2;
48 for (error = omError_MemoryCorrupted; error < omError_MaxError; error++)
49 {
50 om_InternalErrorStatus = omError_NoError;
51 om_ErrorStatus = omError_NoError;
52 printf("!!!expect %s\n", omError2Serror(error));
53 memset(&spec, 0, sizeof(struct LongSpec));
54 cell = NULL;
55 alloc = 0;
56 switch (error)
57 {
58 case omError_MemoryCorrupted:
59 {
60 spec.MaxSize = OM_MAX_BLOCK_SIZE;
61 cell = omFindCell(spec);
62 if (cell != NULL)
63 {
64 omBin bin = omGetTopBinOfAddr(cell->addr);
65 omBinPage last_page = bin->last_page;
66 omAssume(last_page != NULL);
67 bin->last_page = NULL;
68 omDebugBin(cell->bin);
69 bin->last_page = last_page;
70 }
71 else printf("cell not found\n");
72 break;
73 }
74
75 case omError_NullAddr:
76 {
77 omDebugAddr(NULL);
78 break;
79 }
80
81 case omError_InvalidRangeAddr:
82 {
83 omDebugAddr((void*) om_MaxAddr);
84 break;
85 }
86
87 case omError_FalseAddr:
88 {
89 spec.MinSize = 8;
90 spec.MaxSize = OM_MAX_BLOCK_SIZE;
91 spec.NoTrack = 1;
92 cell = omFindCell(spec);
93 if (cell != NULL)
94 {

Callers 1

mainFunction · 0.85

Calls 8

omError2SerrorFunction · 0.85
omFindCellFunction · 0.85
omAddr_2_OutAddrFunction · 0.85
omSizeOfAddrFunction · 0.85
InitCellAddrContentFunction · 0.85
omMergeStickyBinIntoBinFunction · 0.85
TestAllocFunction · 0.85
omtTestDebugFunction · 0.85

Tested by

no test coverage detected