Add an iso9660 test, sync with the upstream

This commit is contained in:
2025-01-10 22:46:33 +00:00
parent 78db00fef9
commit 4068524e00
19 changed files with 54123 additions and 8 deletions

1
.gitignore vendored
View File

@@ -51,3 +51,4 @@ apps/loader
apps/asciivju
apps/justawindow
runtests
cov_t*.*

View File

@@ -1030,6 +1030,52 @@ fat16_s05k.qcow2 () {
rm $img_raw
}
iso9660_s2k_dir_all.qcow2 () {
local img=$FUNCNAME
local img_raw=$(basename $img .qcow2).raw
sudo chown $USER $TEMP_DIR -R
mkdir $TEMP_DIR/dir_ls_a
mkdir $TEMP_DIR/dir_ls_b
$MKDIRRANGE $TEMP_DIR/dir_ls_b 0 3 0 2
mkdir $TEMP_DIR/dir_ls_c
$MKDIRRANGE $TEMP_DIR/dir_ls_c 0 5 201 43
mkdir $TEMP_DIR/dir_ls_d
$MKDIRRANGE $TEMP_DIR/dir_ls_d 0 50 201 43
mkdir $TEMP_DIR/dir_ls_e
$MKDIRRANGE $TEMP_DIR/dir_ls_e 0 1000 201 43
mkdir $TEMP_DIR/dir_ls_f
$MKDIRRANGE $TEMP_DIR/dir_ls_f 0 5000 231 13
mkdir $TEMP_DIR/dir_ls_g
$MKDIRRANGE $TEMP_DIR/dir_ls_g 0 46656 231 13
mkdir $TEMP_DIR/dir_stat_a
mkdir $TEMP_DIR/dir_stat_b
$MKDOUBLEDIRS $TEMP_DIR/dir_stat_b d 3
mkdir $TEMP_DIR/dir_stat_c
$MKDOUBLEDIRS $TEMP_DIR/dir_stat_c d 100
mkdir $TEMP_DIR/dir_stat_d
$MKDOUBLEDIRS $TEMP_DIR/dir_stat_d d 5000
mkdir $TEMP_DIR/dir_stat_e
$MKDOUBLEDIRS $TEMP_DIR/dir_stat_e d 3861
mkisofs -J -R -v -T -V 'KolibriOS' $TEMP_DIR > $img_raw
rm $TEMP_DIR/* -rf
qemu-img convert -m 2 -O qcow2 -o $QCOW2_OPTS $img_raw $img
rm $img_raw
}
images=(gpt_large.qcow2 gpt_partitions_s05k.qcow2 gpt_partitions_s4k.qcow2
kolibri.raw jfs.qcow2 xfs_lookup_v4.qcow2 xfs_lookup_v5.qcow2
xfs_nrext64.qcow2 xfs_bigtime.qcow2 xfs_borg_bit.qcow2
@@ -1041,7 +1087,7 @@ images=(gpt_large.qcow2 gpt_partitions_s05k.qcow2 gpt_partitions_s4k.qcow2
xfs_v5_files_s05k_b4k_n8k.qcow2 fat32_test0.raw
exfat_s05k_c16k_b16k.qcow2 exfat_s05k_c8k_b8k.qcow2
xfs_samehash_s05k.raw ext2_s05k.qcow2 ext4_s05k.qcow2 fat12_s05k.qcow2
fat16_s05k.qcow2)
fat16_s05k.qcow2 iso9660_s2k_dir_all.qcow2)
TEMP_DIR=$(mktemp -d)
LOOP_DEV=$(losetup --find)

View File

@@ -3,7 +3,7 @@ ifndef KOLIBRIOS
endif
FASM_EXE ?= fasm
FASM_FLAGS=-dUEFI=1 -dextended_primary_loader=1 -dUMKA=1 -dHOST=$(HOST) -m 2000000
FASM_FLAGS=-dUEFI=1 -dextended_primary_loader=1 -dUMKA=1 -dHOST=$(HOST) -m 2000000 -dlang=en_US
HOST ?= linux
CC ?= gcc

View File

@@ -831,6 +831,8 @@ disk_list_partitions(struct shell_ctx *ctx, disk_t *d) {
fsname = "exfat";
} else if (p->fs_user_functions == ntfs_user_functions) {
fsname = "ntfs";
} else if (p->fs_user_functions == iso9660_user_functions) {
fsname = "iso9660";
} else {
fsname = "???";
}
@@ -4430,7 +4432,7 @@ run_test(struct shell_ctx *ctx) {
pthread_mutex_lock(&ctx->cmd_mutex);
int is_tty = isatty(fileno(stdin));
char **argv = (char**)calloc(sizeof(char*), (MAX_COMMAND_ARGS + 1));
char **argv = (char**)calloc(MAX_COMMAND_ARGS + 1, sizeof(char*));
ic_set_default_completer(completer, NULL);
ic_set_default_highlighter(highlighter, NULL);
ic_enable_auto_tab(1);

View File

@@ -1 +1 @@
45s
55s

53991
test/t068/ref.log Normal file

File diff suppressed because it is too large Load Diff

62
test/t068/run.us Normal file
View File

@@ -0,0 +1,62 @@
umka_boot
disk_add ../../img/iso9660_s2k_dir_all.qcow2 hd0 -c 524288
ls70 /hd0/1/dir_ls_a
ls70 /hd0/1/dir_ls_b
ls70 /hd0/1/dir_ls_c
ls70 /hd0/1/dir_ls_d
ls70 /hd0/1/dir_ls_e
ls70 /hd0/1/dir_ls_f
ls70 /hd0/1/dir_ls_g
ls70 /hd0/1/dir_ls_g -f 0 -c 1
ls70 /hd0/1/dir_ls_g -f 1 -c 1
ls70 /hd0/1/dir_ls_g -f 2 -c 1
ls70 /hd0/1/dir_ls_g -f 3 -c 1
ls70 /hd0/1/dir_ls_g -f 4 -c 1
ls70 /hd0/1/dir_ls_g -f 46651 -c 10
ls70 /hd0/1/dir_ls_g -f 46658 -c 10
ls70 /hd0/1/dir_ls_g -f 46659 -c 10
ls70 /hd0/1/dir_ls_g -f 46660 -c 10
ls70 /hd0/1/dir_ls_g -f 46661 -c 10
ls70 /hd0/1/dir_ls_g -f 46662 -c 10
ls70 /hd0/1/dir_ls_g -f 0 -c 0
ls70 /hd0/1/dir_ls_g -f 1 -c 0
ls70 /hd0/1/dir_ls_g -f 2 -c 0
ls70 /hd0/1/dir_ls_g -f 3 -c 0
ls70 /hd0/1/dir_ls_g -f 4 -c 0
ls70 /hd0/1/dir_ls_g -f 0 -c 1
ls70 /hd0/1/dir_ls_g -f 1 -c 1
ls70 /hd0/1/dir_ls_g -f 2 -c 1
ls70 /hd0/1/dir_ls_g -f 3 -c 1
ls70 /hd0/1/dir_ls_g -f 4 -c 1
ls70 /hd0/1/dir_ls_g -f 0 -c 2
ls70 /hd0/1/dir_ls_g -f 1 -c 2
ls70 /hd0/1/dir_ls_g -f 2 -c 2
ls70 /hd0/1/dir_ls_g -f 3 -c 2
ls70 /hd0/1/dir_ls_g -f 4 -c 2
ls70 /hd0/1/dir_ls_g -f 0 -c 3
ls70 /hd0/1/dir_ls_g -f 1 -c 3
ls70 /hd0/1/dir_ls_g -f 2 -c 3
ls70 /hd0/1/dir_ls_g -f 3 -c 3
ls70 /hd0/1/dir_ls_g -f 4 -c 3
ls70 /hd0/1/dir_ls_g -f 0 -c 4
ls70 /hd0/1/dir_ls_g -f 1 -c 4
ls70 /hd0/1/dir_ls_g -f 2 -c 4
ls70 /hd0/1/dir_ls_g -f 3 -c 4
ls70 /hd0/1/dir_ls_g -f 4 -c 4
stat70 /hd0/1/dir_stat_a
ls70 /hd0/1/dir_stat_a
stat70 /hd0/1/dir_stat_b
ls70 /hd0/1/dir_stat_a
stat70 /hd0/1/dir_stat_c
ls70 /hd0/1/dir_stat_a
stat70 /hd0/1/dir_stat_d
ls70 /hd0/1/dir_stat_a
stat70 /hd0/1/dir_stat_e
ls70 /hd0/1/dir_stat_a
stat70 /hd0/1/dir_stat_f
stat70 /hd0/1/dir_stat_g
disk_del hd0

2
test/t068/tags.txt Normal file
View File

@@ -0,0 +1,2 @@
fs: iso9660
iso9660:

1
test/t068/timeout.txt Normal file
View File

@@ -0,0 +1 @@
30s

View File

@@ -124,6 +124,7 @@ pubsym ext_user_functions
pubsym fat_user_functions
pubsym exFAT_user_functions, 'exfat_user_functions'
pubsym ntfs_user_functions
pubsym iso9660_user_functions
pubsym i40, no_mangle
@@ -231,8 +232,6 @@ macro sti {
iretd equ retd
iret equ ret
lang fix en
macro int n {
if n eq 0x40
call i40

3
umka.h
View File

@@ -265,6 +265,7 @@ typedef struct {
uint32_t flags;
uint32_t sector_size;
uint64_t capacity; // in sectors
uint32_t last_session_sector;
} diskmediainfo_t;
typedef struct {
@@ -297,6 +298,7 @@ typedef struct {
STDCALL int (*flush)(void *userdata);
STDCALL unsigned int (*adjust_cache_size)(void *userdata,
size_t suggested_size);
STDCALL int (*loadtray)(void *userdata, int flags);
} diskfunc_t;
struct disk_t {
@@ -603,6 +605,7 @@ extern uint8_t ext_user_functions[];
extern uint8_t fat_user_functions[];
extern uint8_t exfat_user_functions[];
extern uint8_t ntfs_user_functions[];
extern uint8_t iso9660_user_functions[];
extern char kos_ramdisk[RAMDISK_MAX_LEN];

View File

@@ -45,10 +45,13 @@ vdisk_init(const char *fname, const int adjust_cache_size,
const size_t cache_size, const void *io) {
size_t fname_len = strlen(fname);
size_t dot_raw_len = strlen(RAW_SUFFIX);
size_t dot_iso_len = strlen(ISO_SUFFIX);
size_t dot_qcow2_len = strlen(QCOW2_SUFFIX);
struct vdisk *disk;
if (fname_len > dot_raw_len
&& !strcmp(fname + fname_len - dot_raw_len, RAW_SUFFIX)) {
if ((fname_len > dot_raw_len
&& !strcmp(fname + fname_len - dot_raw_len, RAW_SUFFIX))
|| (fname_len > dot_iso_len
&& !strcmp(fname + fname_len - dot_iso_len, ISO_SUFFIX))) {
disk = (struct vdisk*)vdisk_init_raw(fname, io);
} else if (fname_len > dot_qcow2_len
&& !strcmp(fname + fname_len - dot_qcow2_len, QCOW2_SUFFIX)) {

View File

@@ -222,6 +222,8 @@ vdisk_init_qcow2(const char *fname, const struct umka_io *io) {
d->vdisk.sect_size = 512;
if (strstr(fname, "s4096") != NULL || strstr(fname, "s4k") != NULL) {
d->vdisk.sect_size = 4096;
} else if (strstr(fname, "s2048") != NULL || strstr(fname, "s2k") != NULL) {
d->vdisk.sect_size = 2048;
}
struct qcow2_header header;

View File

@@ -65,6 +65,8 @@ vdisk_init_raw(const char *fname, const struct umka_io *io) {
size_t sect_size = 512;
if (strstr(fname, "s4096") != NULL || strstr(fname, "s4k") != NULL) {
sect_size = 4096;
} else if (strstr(fname, "s2048") != NULL || strstr(fname, "s2k") != NULL) {
sect_size = 2048;
}
struct vdisk_raw *disk = (struct vdisk_raw*)malloc(sizeof(struct vdisk_raw));
*disk = (struct vdisk_raw){

View File

@@ -15,6 +15,7 @@
#include "umkaio.h"
#define RAW_SUFFIX ".raw"
#define ISO_SUFFIX ".iso"
struct vdisk*
vdisk_init_raw(const char *fname, const struct umka_io *io);