Subversion Repositories Kolibri OS

Rev

Rev 9335 | Rev 9338 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9335 Rev 9337
Line 13... Line 13...
13
from threading import Thread
13
from threading import Thread
Line 14... Line 14...
14
 
14
 
15
sys.path.append('test')
15
sys.path.append('test')
Line 16... Line 16...
16
import common
16
import common
Line 17... Line 17...
17
 
17
 
18
enable_umka = False
18
enable_umka = True
Line 19... Line 19...
19
 
19
 
Line 169... Line 169...
169
    thread = Thread(target = run_tests_serially_thread, args = (tests, root_dir))
169
    thread = Thread(target = run_tests_serially_thread, args = (tests, root_dir))
170
    thread.start()
170
    thread.start()
171
    return thread
171
    return thread
Line 172... Line 172...
172
 
172
 
173
def gcc(fin, fout):
173
def gcc(fin, fout):
174
    flags = "-m32 -std=c11 -g -O0 -masm=intel -fno-pie"
174
    flags = "-m32 -std=c11 -g -O0 -masm=intel -fno-pie -w"
175
    defines = "-D_FILE_OFFSET_BITS=64 -DNDEBUG -D_POSIX_C_SOURCE=200809L"
175
    defines = "-D_FILE_OFFSET_BITS=64 -DNDEBUG -D_POSIX_C_SOURCE=200809L"
176
    include = "-Iumka -Iumka/linux"
176
    include = "-Iumka -Iumka/linux"
177
    command = f"gcc {flags} {defines} {include} -c {fin} -o {fout}"
177
    command = f"gcc {flags} {defines} {include} -c {fin} -o {fout}"
178
    print(command)
178
    print(command)
Line 181... Line 181...
181
def build_umka_asm():
181
def build_umka_asm():
182
    include = "INCLUDE=\"../../programs/develop/libraries/libcrash/hash\""
182
    include = "INCLUDE=\"../../programs/develop/libraries/libcrash/hash\""
183
    flags = "-dUEFI=1 -dextended_primary_loader=1 -dUMKA=1"
183
    flags = "-dUEFI=1 -dextended_primary_loader=1 -dUMKA=1"
184
    files = "umka/umka.asm umka/build/umka.o -s umka/build/umka.fas"
184
    files = "umka/umka.asm umka/build/umka.o -s umka/build/umka.fas"
185
    memory = "-m 2000000"
185
    memory = "-m 2000000"
186
    os.system(f"{include} fasm {flags} {files} {memory}")
186
    command = f"{include} fasm {flags} {files} {memory}"
-
 
187
    print(command)
-
 
188
    os.system(command)
Line 187... Line 189...
187
 
189
 
188
def build_umka():
190
def build_umka():
189
    if not enable_umka:
191
    if not enable_umka:
190
        return
192
        return
Line 194... Line 196...
194
    sources = [ "umka_shell.c", 
196
    sources = [ "umka_shell.c", 
195
                "shell.c",
197
                "shell.c",
196
                "trace.c",
198
                "trace.c",
197
                "trace_lbr.c",
199
                "trace_lbr.c",
198
                "vdisk.c",
200
                "vdisk.c",
199
                "vnet.c",
-
 
200
                "lodepng.c",
201
                "lodepng.c",
201
                "linux/pci.c",
202
                "linux/pci.c",
202
                "linux/thread.c",
203
                "linux/thread.c" ]
203
                "util.c" ]
-
 
204
    sources = [f"umka/{f}" for f in sources]
204
    sources = [f"umka/{f}" for f in sources]
205
    objects = []
205
    objects = []
206
    for source in sources:
206
    for source in sources:
207
        object_path = source.replace("umka/", "umka/build/")
207
        object_path = source.replace("umka/", "umka/build/")
208
        object_path = f"{object_path}.o"
208
        object_path = f"{object_path}.o"
209
        gcc(source, object_path)
209
        gcc(source, object_path)
210
        objects.append(object_path)
210
        objects.append(object_path)
211
    build_umka_asm()
211
    build_umka_asm()
212
    objects.append("umka/build/umka.o")
212
    objects.append("umka/build/umka.o")
213
    objects = " ".join(objects)
213
    objects = " ".join(objects)
214
    os.system(f"gcc -m32 -no-pie -o umka_shell -static -T umka/umka.ld {objects}")
214
    command = f"gcc -m32 -no-pie -o umka_shell -static -T umka/umka.ld {objects}"
-
 
215
    print(command)
-
 
216
    os.system(command)
Line 215... Line 217...
215
 
217
 
216
def create_relocated(root_dir, fname):
218
def create_relocated(root_dir, fname):
217
    with open(fname, "rb") as f:
219
    with open(fname, "rb") as f:
218
        contents = f.read()
220
        contents = f.read()
Line 224... Line 226...
224
    return outname
226
    return outname
Line 225... Line 227...
225
 
227
 
226
def run_umka_test(root_dir, test_file_path):
228
def run_umka_test(root_dir, test_file_path):
227
    test = create_relocated(root_dir, test_file_path)
229
    test = create_relocated(root_dir, test_file_path)
228
    ref_log = create_relocated(root_dir, f"{test_file_path[:-2]}.ref.log")
230
    ref_log = create_relocated(root_dir, f"{test_file_path[:-2]}.ref.log")
229
    out_log = create_relocated(root_dir, f"{test_file_path[:-2]}.out.log")
231
    out_log = f"{test_file_path[:-2]}.out.log.o"
230
    os.system(f"./umka_shell < {test} > {out_log}")
232
    os.system(f"./umka_shell < {test} > {out_log}")
231
    if os.system(f"cmp {ref_log} {out_log}") != 0:
233
    if os.system(f"cmp {ref_log} {out_log}") != 0:
232
        print(f"FAILURE: {test_file_path}\n", end = "")
234
        print(f"FAILURE: {test_file_path}\n", end = "")
233
    else:
235
    else: