diff --git a/Makefile b/Makefile index f1312b5898f97b321f4ad3cbfaad123f61f75967..23840318edf33fddc1ccae1e77387c99b64557b8 100644 --- a/Makefile +++ b/Makefile @@ -1,36 +1,26 @@ +# -*- Makefile -*- + CC = gcc -FLAGS = -Wall -g -MMD -MP +FLAGS = -Wall -g BUILD_DIR = ./build LIBS = -SRCS = main.c libs/heap/heap.c libs/workload/workload.c -OBJS = $(SRCS:%.c=$(BUILD_DIR)/%.o) -DEPS = $(OBJS:.o=.d) -EXE = $(BUILD_DIR)/main +SRCS = src/sched.c src/heap.c src/trace.c +OBJS = $(SRCS:src/%.c=$(BUILD_DIR)/%.o) +EXE = $(BUILD_DIR)/sched all: $(EXE) -run: $(EXE) - $(EXE) - -$(BUILD_DIR)/main: $(OBJS) - @echo "Building $@" +$(BUILD_DIR)/sched: $(OBJS) + @echo "Linking $@" @$(CC) -o $@ $(OBJS) $(LIBS) $(FLAGS) -$(BUILD_DIR)/%.o: %.c | $(BUILD_DIR)/libs/heap $(BUILD_DIR)/libs/workload +$(BUILD_DIR)/%.o: src/%.c | $(BUILD_DIR) @echo "Building $@" @$(CC) $(FLAGS) -c $< -o $@ $(BUILD_DIR): @mkdir -p $(BUILD_DIR) -$(BUILD_DIR)/libs/heap: - @mkdir -p $(BUILD_DIR)/libs/heap - -$(BUILD_DIR)/libs/workload: - @mkdir -p $(BUILD_DIR)/libs/workload - clean: rm -rf $(BUILD_DIR) - --include $(DEPS) diff --git a/libs/workload/workload.c b/libs/workload/workload.c deleted file mode 100644 index f64c2f5f41ffb82958e583db9fd70325f1cd2987..0000000000000000000000000000000000000000 --- a/libs/workload/workload.c +++ /dev/null @@ -1,12 +0,0 @@ -#include <stdlib.h> - - -struct workload_item_t { - int pid; //< the event id - int ppid; //< the event parent id - size_t ts; //< start date - size_t tf; //< finish date - size_t idle; //< total time the process has been idle; - char *cmd; //< the binary name - int prio; //< process priority -}; diff --git a/main.c b/main.c deleted file mode 100644 index 8cfe387f16c6ba38e6e013177b406db41a93721e..0000000000000000000000000000000000000000 --- a/main.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdio.h> - -int main() { - printf("Scheduler project\n"); - - return 0; -} \ No newline at end of file diff --git a/libs/heap/heap.c b/src/heap.c similarity index 100% rename from libs/heap/heap.c rename to src/heap.c diff --git a/libs/heap/heap.h b/src/heap.h similarity index 100% rename from libs/heap/heap.h rename to src/heap.h diff --git a/src/sched.c b/src/sched.c new file mode 100644 index 0000000000000000000000000000000000000000..4ff5b1d32f6c432df0a5fa201d46c8e0b115cbfa --- /dev/null +++ b/src/sched.c @@ -0,0 +1,175 @@ +#include <stdio.h> +#include <string.h> +#include "sched.h" +#include "trace.h" + +#define END_STEP 30 + +struct process_t { + int prio; //< priority in range [1..10] + size_t pid; //< pid assigned by the scheduler +}; +typedef struct process_t process; + + +struct workload_item_t { + int pid; //< the event id + int ppid; //< the event parent id + size_t ts; //< start date + size_t tf; //< finish date + size_t idle; //< total time the process has been idle; + char *cmd; //< the binary name + int prio; //< process priority +}; + +enum epoch { before, in, after }; //< to compare a date and a timeframe +typedef enum epoch epoch; + + + /** + * 0,init + * / \ + * 1,bash 2,bash + * / \ \ / \ + * 3,find \ \ | | + * 4,gcc \ | | + * | | | | + * 5,ld | | | + * | 6,ssh | + * | | | + * | 7,crypt | + * | 8,snake + * 9,cat + */ + + /* + workload_item workload[] = { + // pid ppid ts tf idle cmd prio + {0, -1, 0, 18, 0, "init", 10 }, + {1, 0, 1, 16, 0, "bash", 1 }, + {2, 0, 3, 16, 0, "bash", 1 }, + {3, 1, 4, 6, 0, "find", 2 }, + {4, 1, 7, 9, 0, "gcc", 5 }, + {5, 4, 8, 9, 0, "ld", 4 }, + {6, 2, 10, 13, 0, "ssh", 3 }, + {7, 6, 11, 13, 0, "crypt", 5 }, + {8, 2, 14, 16, 0, "snake", 4 }, + {9, 1, 14, 15, 0, "cat", 5 }, + }; + */ +void draw_hbar(char c, size_t width) { + char bar[width+1]; + memset(bar, c, width); + bar[width]='\0'; + printf("%s",bar); +} + +void chronogram(workload_item* workload, size_t nb_processes, size_t timesteps) { + // drw timeliine + size_t tick; + size_t freq=5; + printf("\t"); + for (tick=0; tick<timesteps; tick++) { + if (tick%freq==0) printf("|"); else printf("."); + } + printf("\n"); + // draw processes lifetime + for (size_t i=0; i<nb_processes; i++) { + printf("%s\t", workload[i].cmd); + draw_hbar(' ',workload[i].ts); + draw_hbar('X',workload[i].tf-workload[i].ts); + printf("\t\t\t (tf=%zu,idle=%zu)\n", workload[i].tf, workload[i].idle); + } +} + + +/** + * @brief count lines in file + * + * @param file assumed to be an open file + * @return the number of lines in files + */ +size_t count_lines_in_file(FILE *file) { + int lines = 0; + char ch; + // Count the number of newline characters + while ((ch = fgetc(file)) != EOF) { + if (ch == '\n') { + lines++; + } + } + // If the file is not empty and the last line doesn't end with '\n' + if (ch != '\n' && lines != 0) { + lines++; + } + rewind(file); + return lines; +} + +/** + * @brief Read the workload data + * + * @param filename the name of file, can be STDIN + * @return number of data lines read in the file + */ +size_t read_data(size_t workload_size, FILE *file) { + size_t count = 0; + char line[256]; // Buffer for each line in the file + char cmd[50]; // Buffer for command name + + while (fgets(line, sizeof(line), file) && count < workload_size) { + workload_item item; + // Parse the line into the workload_item structure + if (sscanf(line, "%d %d %zu %zu %zu %s %d", + &item.pid, &item.ppid, &item.ts, &item.tf, + &item.idle, cmd, &item.prio) == 7) { + item.cmd = strdup(cmd); // Duplicate the string for command name + workload[count++] = item; + } else { + fprintf(stderr, "Error parsing line: %s\n", line); + return false; + } + } + return count; +} + +/** + * main + */ +int main(int argc, char** argv) { + // FILE *input; + // if (argc > 1) { // if one arg, use it to read in data + // if ((input = fopen(argv[1],"r")) == NULL) { + // perror("Error reading file:"); + // exit(EXIT_FAILURE); + // } + // else + // printf("* Read from %s ...", argv[1]); + // } + // else { // no arg provided, read from stdin + // printf("* Read from stdin ..."); + // input = stdin; + // } + // // read from standard input + // fflush(stdout); + // size_t nr = count_lines_in_file(input); + + // printf(" %zu lines in data.\n", nr); + + // workload = malloc(sizeof(workload_item) * nr); + // size_t workload_size = read_data(nr, input); + // printf("* Loaded %zu lines of data.\n", nr); + // pstate **timeline = alloc_timeline(END_STEP, workload_size); + + // if (nr > 0) + // time_loop(workload_size, 0, END_STEP-1, MAX_CPU, timeline); + // else + // return EXIT_FAILURE; + + + // printf("* Chronogram === \n"); + // chronogram(workload, workload_size, END_STEP-1); + // print_timeline(END_STEP-1, workload_size, timeline); + // free(workload); + return 0; +} diff --git a/libs/workload/worklpad.h b/src/sched.h similarity index 63% rename from libs/workload/worklpad.h rename to src/sched.h index 7a9ed320c8cfd21c168cb52939dd0495baefa754..1d839f7cd4bceb1a6b2acda81de969d58f96fc56 100644 --- a/libs/workload/worklpad.h +++ b/src/sched.h @@ -1 +1,4 @@ + + typedef struct workload_item_t workload_item; +workload_item* workload; diff --git a/src/trace.c b/src/trace.c new file mode 100644 index 0000000000000000000000000000000000000000..11973b4c2ed1902799bd155555561cb7cdba1ca8 --- /dev/null +++ b/src/trace.c @@ -0,0 +1,44 @@ +#include <stdbool.h> +#include <stdlib.h> +#include <string.h> + +#include "heap.h" +#include "trace.h" +#include "sched.h" + +pstate **alloc_timeline(size_t timesteps, size_t nb_processes) { + pstate** ptl = malloc(nb_processes * sizeof(pstate *)); // processes x timesteps matrix + for (size_t p=0; p<nb_processes; p++) { + ptl[p] = malloc(timesteps*sizeof(pstate)); + for (size_t t=0; t<timesteps; t++ ) + ptl[p][t] = inactive; + } + return ptl; +} + +void record_timeline(size_t timestep, pstate **timeline, heap *run, heap *pend) { + for (size_t i=0; i< heap_size(run); i++) { + heap_item *hi = heap_get_item(run,i); + size_t pid = heap_item_get_value(hi); + timeline[pid][timestep] = running; + } + for (size_t i=0; i< heap_size(pend); i++) { + heap_item *hi = heap_get_item(pend,i); + size_t pid = heap_item_get_value(hi); + timeline[pid][timestep]= pending; + } +} + +void print_timeline(size_t timesteps, size_t nb_procs, pstate** ptl) { + printf("\n[===Results===]\n"); + for (size_t p=0; p<nb_procs; p++) { + printf("%zu\t", p); + for (size_t t=0; t<timesteps; t++ ) + switch (ptl[p][t]) { + case inactive: printf("_"); break; + case running: printf("R"); break; + case pending: printf("."); break; + } + printf("\n"); + } +} \ No newline at end of file diff --git a/src/trace.h b/src/trace.h new file mode 100644 index 0000000000000000000000000000000000000000..ddcdde36ac85a1715680140711c54a4a2b85c2bf --- /dev/null +++ b/src/trace.h @@ -0,0 +1,12 @@ +#ifndef _TRACE_H_ +#define _TRACE_H_ +#include <stdlib.h> +#include "heap.h" + +enum pstate { inactive, running, pending }; +typedef enum pstate pstate; +pstate **alloc_timeline(size_t timesteps, size_t nb_processes); +void record_timeline(size_t timesteps, pstate **timeline, heap *running_queue, heap *pending_queue); +void print_timeline(size_t timesteps, size_t nb_procs, pstate** ptl); + +#endif \ No newline at end of file diff --git a/tests/.DS_Store b/tests/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..79f7a05b97b5ac70e723a49407827ec415e6d2aa Binary files /dev/null and b/tests/.DS_Store differ diff --git a/tests/._.DS_Store b/tests/._.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a5b28df1cbc6e15bd0d35cdadd0c2e65d5131c7d Binary files /dev/null and b/tests/._.DS_Store differ diff --git a/tests/._test-sched.sh b/tests/._test-sched.sh new file mode 100755 index 0000000000000000000000000000000000000000..f67f6bd898845843f15b1bf94fc650dd72c49064 Binary files /dev/null and b/tests/._test-sched.sh differ diff --git a/tests/extract_answers.sh b/tests/extract_answers.sh new file mode 100755 index 0000000000000000000000000000000000000000..f9ab1a711226124e77e9988fc8f0e57c72b5adf5 --- /dev/null +++ b/tests/extract_answers.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +EXEC=../src/sched +TAIL=/opt/homebrew/bin/gtail + +PATTERN="===Results===" + +for testfile in test-*.txt +do + $EXEC < $testfile > $testfile.log + nl=$(grep -n $PATTERN < $testfile.log | cut -f1 -d':') + if [ -z "$nl" ]; then + echo "*Error: could not fid patern \"$PATTERN\" in $testfile.log" + exit 1 + fi + $TAIL -n +$nl < $testfile.log > $testfile.res +done + diff --git a/tests/in/._test-0.in b/tests/in/._test-0.in new file mode 100644 index 0000000000000000000000000000000000000000..6aca049dae203dea0cd302d3efc2ed184b0f549b Binary files /dev/null and b/tests/in/._test-0.in differ diff --git a/tests/in/._test-1.in b/tests/in/._test-1.in new file mode 100644 index 0000000000000000000000000000000000000000..6aca049dae203dea0cd302d3efc2ed184b0f549b Binary files /dev/null and b/tests/in/._test-1.in differ diff --git a/tests/in/._test-2.in b/tests/in/._test-2.in new file mode 100644 index 0000000000000000000000000000000000000000..6aca049dae203dea0cd302d3efc2ed184b0f549b Binary files /dev/null and b/tests/in/._test-2.in differ diff --git a/tests/in/._test-3.in b/tests/in/._test-3.in new file mode 100644 index 0000000000000000000000000000000000000000..6aca049dae203dea0cd302d3efc2ed184b0f549b Binary files /dev/null and b/tests/in/._test-3.in differ diff --git a/tests/in/._test-4.in b/tests/in/._test-4.in new file mode 100644 index 0000000000000000000000000000000000000000..05cd59cff5b50e167d059d686ffedb6dc0aca926 Binary files /dev/null and b/tests/in/._test-4.in differ diff --git a/tests/in/._test-4.in~ b/tests/in/._test-4.in~ new file mode 100644 index 0000000000000000000000000000000000000000..05cd59cff5b50e167d059d686ffedb6dc0aca926 Binary files /dev/null and b/tests/in/._test-4.in~ differ diff --git a/tests/in/._test-7.in b/tests/in/._test-7.in new file mode 100644 index 0000000000000000000000000000000000000000..6aca049dae203dea0cd302d3efc2ed184b0f549b Binary files /dev/null and b/tests/in/._test-7.in differ diff --git a/tests/in/._test-8.in b/tests/in/._test-8.in new file mode 100644 index 0000000000000000000000000000000000000000..6aca049dae203dea0cd302d3efc2ed184b0f549b Binary files /dev/null and b/tests/in/._test-8.in differ diff --git a/tests/in/._test-9.in b/tests/in/._test-9.in new file mode 100644 index 0000000000000000000000000000000000000000..6aca049dae203dea0cd302d3efc2ed184b0f549b Binary files /dev/null and b/tests/in/._test-9.in differ diff --git a/tests/in/test-0.in b/tests/in/test-0.in new file mode 100644 index 0000000000000000000000000000000000000000..6330461c7d10cfb82a2a05d1ae95fcf92280292e --- /dev/null +++ b/tests/in/test-0.in @@ -0,0 +1,2 @@ +0 -1 0 5 0 p0 1 +1 0 2 10 0 p1 20 diff --git a/tests/in/test-1.in b/tests/in/test-1.in new file mode 100644 index 0000000000000000000000000000000000000000..224098d03e0eb0d43b5ed9a4116e63485cb91c5d --- /dev/null +++ b/tests/in/test-1.in @@ -0,0 +1,2 @@ +0 -1 0 10 0 p0 20 +1 0 2 10 0 p2 1 diff --git a/tests/in/test-2.in b/tests/in/test-2.in new file mode 100644 index 0000000000000000000000000000000000000000..0f185b3690a8473cc407699be2963d88e22d12d9 --- /dev/null +++ b/tests/in/test-2.in @@ -0,0 +1,3 @@ +0 -1 0 10 0 p0 20 +1 0 2 10 0 p2 1 +2 0 12 15 0 p0 20 diff --git a/tests/in/test-3.in b/tests/in/test-3.in new file mode 100644 index 0000000000000000000000000000000000000000..8c78032b3b1d8a602141812f575864a43a7ff929 --- /dev/null +++ b/tests/in/test-3.in @@ -0,0 +1,3 @@ +0 -1 0 9 0 p0 5 +1 0 2 15 0 p1 5 +2 0 12 15 0 p2 15 diff --git a/tests/in/test-4.in b/tests/in/test-4.in new file mode 100644 index 0000000000000000000000000000000000000000..4254eb91cba71adb14a12ff828e1bbb856af2d45 --- /dev/null +++ b/tests/in/test-4.in @@ -0,0 +1,10 @@ +0 -1 0 18 0 0 0 "init" 10 +1 0 1 16 0 0 0 "bash" 1 +2 0 3 16 0 0 0 "bash" 1 +3 1 4 6 0 0 0 "find" 2 +4 1 7 9 0 0 0 "gcc" 5 +5 4 8 9 0 0 0 "id" 4 +6 2 10 13 0 0 0 "ssh" 3 +7 6 11 13 0 0 0 "crypt" 5 +8 2 14 16 0 0 0 "snake" 4 +9 1 14 15 0 0 0 "cat" 5 diff --git a/tests/in/test-4.in~ b/tests/in/test-4.in~ new file mode 100644 index 0000000000000000000000000000000000000000..7c547597420c32fe54b16d9f6ab13e199f8aad95 --- /dev/null +++ b/tests/in/test-4.in~ @@ -0,0 +1,11 @@ +0 -1 0 18 0 0 0 "init" 10 +1 0 1 16 0 0 0 "bash" 1 +2 0 3 16 0 0 0 "bash" 1 +3 1 4 6 0 0 0 "find" 2 +4 1 7 9 0 0 0 "gcc" 5 +5 4 8 9 0 0 0 "id" 4 +6 2 10 13 0 0 0 "ssh" 3 +7 6 11 13 0 0 0 "crypt" 5 +8 2 14 16 0 0 0 "snake" 4 +9 1 14 15 0 0 0 "cat" 5 + diff --git a/tests/in/test-5.in b/tests/in/test-5.in new file mode 100644 index 0000000000000000000000000000000000000000..19b8b2572dfb910fc54b830e190df4491398d743 --- /dev/null +++ b/tests/in/test-5.in @@ -0,0 +1,10 @@ +0 -1 0 18 0 init 10 +1 0 1 16 0 bash 1 +2 0 3 16 0 bash 1 +3 1 4 6 0 find 2 +4 1 7 9 0 gcc 5 +5 4 8 9 0 ld 4 +6 2 10 13 0 ssh 3 +7 6 11 13 0 crypt 5 +8 2 14 16 0 snake 4 +9 1 14 15 0 cat 5 diff --git a/tests/in/test-6.in b/tests/in/test-6.in new file mode 100644 index 0000000000000000000000000000000000000000..eb90f2b56690939de6d7377ff8c75c7bf61ab834 --- /dev/null +++ b/tests/in/test-6.in @@ -0,0 +1,10 @@ +0 -1 0 18 0 init 10 +1 0 1 16 0 bash 1 +2 0 3 16 0 bash 1 +3 1 4 6 0 find 2 +4 1 7 11 0 gcc 5 +5 4 8 9 0 ld 4 +6 2 10 13 0 ssh 3 +7 6 11 13 0 crypt 5 +8 2 14 16 0 snake 4 +9 1 14 15 0 cat 5 diff --git a/tests/in/test-7.in b/tests/in/test-7.in new file mode 100644 index 0000000000000000000000000000000000000000..ba77752cb5353ea106a2c7b67cafc9a512ae8089 --- /dev/null +++ b/tests/in/test-7.in @@ -0,0 +1,5 @@ +0 -1 0 10 0 p0 5 +1 0 2 12 0 p1 6 +2 0 4 14 0 p2 4 +3 1 6 16 0 p3 10 +4 1 6 14 0 p4 9 diff --git a/tests/in/test-8.in b/tests/in/test-8.in new file mode 100644 index 0000000000000000000000000000000000000000..c31fa13977cf8f6228dd1f59f0e6c38c00aa105e --- /dev/null +++ b/tests/in/test-8.in @@ -0,0 +1,4 @@ +0 -1 0 10 0 p0 5 +1 0 2 12 0 p1 6 +2 0 4 14 0 p2 4 +3 1 6 16 0 p3 10 diff --git a/tests/in/test-9.in b/tests/in/test-9.in new file mode 100644 index 0000000000000000000000000000000000000000..abc21b5f3ab54113a14173c4d307bf38e1ce7408 --- /dev/null +++ b/tests/in/test-9.in @@ -0,0 +1,6 @@ +0 -1 0 14 0 p0 5 +1 0 2 15 0 p1 5 +2 0 12 15 0 p2 8 +3 0 13 15 0 p3 15 +4 0 14 18 0 p4 10 +5 0 10 18 0 p5 10 diff --git a/tests/out/test-0.out b/tests/out/test-0.out new file mode 100644 index 0000000000000000000000000000000000000000..13911379294cd6915dbb55f2f4c6b93372e2b128 --- /dev/null +++ b/tests/out/test-0.out @@ -0,0 +1,129 @@ +* Read from stdin ... 3 lines in data. +* Loaded 3 lines of data. +* starting scheduling on 1 CPUs +[t=0] +> schedule pid=0 prio=1 ('p0') ... added to running queue +> CPU occupation: CPU[0]=1 +> running: [(1,0) ] +> pending: [(20,1) ] +[t=1] +> running: [(1,0) ] +> pending: [(20,1) ] +[t=2] +> schedule pid=1 prio=20 ('p1') ...can't fit. Pick process to put asleep: pid=0 prio=1 ('p0') +> CPU occupation: CPU[0]=0 + added to running queue +> CPU occupation: CPU[0]=20 +> running: [(20,1) ] +> pending: [(1,0) ] +[t=3] +> schedule pid=0 prio=1 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=1 prio=20 ('p1') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,1) ] +> pending: [(1,0) ] +[t=4] +> schedule pid=0 prio=1 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=1 prio=20 ('p1') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,1) ] +> pending: [(1,0) ] +[t=5] +> schedule pid=0 prio=1 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=1 prio=20 ('p1') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,1) ] +> pending: [(1,0) ] +[t=6] +> schedule pid=0 prio=1 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=1 prio=20 ('p1') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,1) ] +> pending: [(1,0) ] +[t=7] +> schedule pid=0 prio=1 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=1 prio=20 ('p1') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,1) ] +> pending: [(1,0) ] +[t=8] +> schedule pid=0 prio=1 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=1 prio=20 ('p1') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,1) ] +> pending: [(1,0) ] +[t=9] +> schedule pid=0 prio=1 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=1 prio=20 ('p1') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,1) ] +> pending: [(1,0) ] +[t=10] +> schedule pid=0 prio=1 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=1 prio=20 ('p1') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,1) ] +> pending: [(1,0) ] +[t=11] +> process pid=1 prio=20 ('p1') finished after time t=10 +> CPU occupation: CPU[0]=0 +> schedule pid=0 prio=1 ('p0') ... added to running queue +> CPU occupation: CPU[0]=1 +> running: [(1,0) ] +> pending: [] +[t=12] +> running: [(1,0) ] +> pending: [] +[t=13] +> running: [(1,0) ] +> pending: [] +[t=14] +> running: [(1,0) ] +> pending: [] +[t=15] +> process pid=0 prio=1 ('p0') finished after time t=14 +> CPU occupation: CPU[0]=0 +> running: [] +> pending: [] +[t=16] +> running: [] +> pending: [] +[t=17] +> running: [] +> pending: [] +[t=18] +> running: [] +> pending: [] +[t=19] +> running: [] +> pending: [] +[t=20] +> running: [] +> pending: [] +[t=21] +> running: [] +> pending: [] +[t=22] +> running: [] +> pending: [] +[t=23] +> running: [] +> pending: [] +[t=24] +> running: [] +> pending: [] +[t=25] +> running: [] +> pending: [] +[t=26] +> running: [] +> pending: [] +[t=27] +> running: [] +> pending: [] +[t=28] +> running: [] +> pending: [] +[t=29] +> running: [] +> pending: [] +* Chronogram === + |....|....|....|....|....|... +p0 XXXXXXXXXXXXXX (tf=14,idle=9) +p1 XXXXXXXX (tf=10,idle=0) + +[===Results===] +0 RR.........RRRR______________ +1 ..RRRRRRRRR__________________ diff --git a/tests/out/test-0.res b/tests/out/test-0.res new file mode 100644 index 0000000000000000000000000000000000000000..8349936a423217f0b26dc0d4d3dcee578b5c439e --- /dev/null +++ b/tests/out/test-0.res @@ -0,0 +1,3 @@ +[===Results===] +0 RR.........RRRR______________ +1 ..RRRRRRRRR__________________ diff --git a/tests/out/test-1.out b/tests/out/test-1.out new file mode 100644 index 0000000000000000000000000000000000000000..b6747d863ec2e2dab46c639eab6d0f4c9673f6c6 --- /dev/null +++ b/tests/out/test-1.out @@ -0,0 +1,127 @@ +* Read from stdin ... 3 lines in data. +* Loaded 3 lines of data. +* starting scheduling on 1 CPUs +[t=0] +> schedule pid=0 prio=20 ('p0') ... added to running queue +> CPU occupation: CPU[0]=20 +> running: [(20,0) ] +> pending: [(1,1) ] +[t=1] +> running: [(20,0) ] +> pending: [(1,1) ] +[t=2] +> schedule pid=1 prio=1 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=0 prio=20 ('p0') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,0) ] +> pending: [(1,1) ] +[t=3] +> schedule pid=1 prio=1 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=0 prio=20 ('p0') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,0) ] +> pending: [(1,1) ] +[t=4] +> schedule pid=1 prio=1 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=0 prio=20 ('p0') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,0) ] +> pending: [(1,1) ] +[t=5] +> schedule pid=1 prio=1 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=0 prio=20 ('p0') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,0) ] +> pending: [(1,1) ] +[t=6] +> schedule pid=1 prio=1 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=0 prio=20 ('p0') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,0) ] +> pending: [(1,1) ] +[t=7] +> schedule pid=1 prio=1 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=0 prio=20 ('p0') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,0) ] +> pending: [(1,1) ] +[t=8] +> schedule pid=1 prio=1 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=0 prio=20 ('p0') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,0) ] +> pending: [(1,1) ] +[t=9] +> schedule pid=1 prio=1 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=0 prio=20 ('p0') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,0) ] +> pending: [(1,1) ] +[t=10] +> schedule pid=1 prio=1 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=0 prio=20 ('p0') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,0) ] +> pending: [(1,1) ] +[t=11] +> process pid=0 prio=20 ('p0') finished after time t=10 +> CPU occupation: CPU[0]=0 +> schedule pid=1 prio=1 ('p2') ... added to running queue +> CPU occupation: CPU[0]=1 +> running: [(1,1) ] +> pending: [] +[t=12] +> running: [(1,1) ] +> pending: [] +[t=13] +> running: [(1,1) ] +> pending: [] +[t=14] +> running: [(1,1) ] +> pending: [] +[t=15] +> running: [(1,1) ] +> pending: [] +[t=16] +> running: [(1,1) ] +> pending: [] +[t=17] +> running: [(1,1) ] +> pending: [] +[t=18] +> running: [(1,1) ] +> pending: [] +[t=19] +> running: [(1,1) ] +> pending: [] +[t=20] +> process pid=1 prio=1 ('p2') finished after time t=19 +> CPU occupation: CPU[0]=0 +> running: [] +> pending: [] +[t=21] +> running: [] +> pending: [] +[t=22] +> running: [] +> pending: [] +[t=23] +> running: [] +> pending: [] +[t=24] +> running: [] +> pending: [] +[t=25] +> running: [] +> pending: [] +[t=26] +> running: [] +> pending: [] +[t=27] +> running: [] +> pending: [] +[t=28] +> running: [] +> pending: [] +[t=29] +> running: [] +> pending: [] +* Chronogram === + |....|....|....|....|....|... +p0 XXXXXXXXXX (tf=10,idle=0) +p2 XXXXXXXXXXXXXXXXX (tf=19,idle=9) + +[===Results===] +0 RRRRRRRRRRR__________________ +1 ...........RRRRRRRRR_________ diff --git a/tests/out/test-1.res b/tests/out/test-1.res new file mode 100644 index 0000000000000000000000000000000000000000..3a7a5da3951b162d51ca63404d9ca2237155849a --- /dev/null +++ b/tests/out/test-1.res @@ -0,0 +1,3 @@ +[===Results===] +0 RRRRRRRRRRR__________________ +1 ...........RRRRRRRRR_________ diff --git a/tests/out/test-2.out b/tests/out/test-2.out new file mode 100644 index 0000000000000000000000000000000000000000..c6abbb028b18fcac8993fd907b02ee2264d01ccf --- /dev/null +++ b/tests/out/test-2.out @@ -0,0 +1,143 @@ +* Read from stdin ... 4 lines in data. +* Loaded 4 lines of data. +* starting scheduling on 1 CPUs +[t=0] +> schedule pid=0 prio=20 ('p0') ... added to running queue +> CPU occupation: CPU[0]=20 +> running: [(20,0) ] +> pending: [(20,2) (1,1) ] +[t=1] +> running: [(20,0) ] +> pending: [(20,2) (1,1) ] +[t=2] +> schedule pid=1 prio=1 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=0 prio=20 ('p0') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,0) ] +> pending: [(20,2) (1,1) ] +[t=3] +> schedule pid=1 prio=1 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=0 prio=20 ('p0') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,0) ] +> pending: [(20,2) (1,1) ] +[t=4] +> schedule pid=1 prio=1 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=0 prio=20 ('p0') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,0) ] +> pending: [(20,2) (1,1) ] +[t=5] +> schedule pid=1 prio=1 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=0 prio=20 ('p0') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,0) ] +> pending: [(20,2) (1,1) ] +[t=6] +> schedule pid=1 prio=1 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=0 prio=20 ('p0') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,0) ] +> pending: [(20,2) (1,1) ] +[t=7] +> schedule pid=1 prio=1 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=0 prio=20 ('p0') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,0) ] +> pending: [(20,2) (1,1) ] +[t=8] +> schedule pid=1 prio=1 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=0 prio=20 ('p0') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,0) ] +> pending: [(20,2) (1,1) ] +[t=9] +> schedule pid=1 prio=1 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=0 prio=20 ('p0') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,0) ] +> pending: [(20,2) (1,1) ] +[t=10] +> schedule pid=1 prio=1 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=0 prio=20 ('p0') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,0) ] +> pending: [(20,2) (1,1) ] +[t=11] +> process pid=0 prio=20 ('p0') finished after time t=10 +> CPU occupation: CPU[0]=0 +> schedule pid=1 prio=1 ('p2') ... added to running queue +> CPU occupation: CPU[0]=1 +> running: [(1,1) ] +> pending: [(20,2) ] +[t=12] +> schedule pid=2 prio=20 ('p0') ...can't fit. Pick process to put asleep: pid=1 prio=1 ('p2') +> CPU occupation: CPU[0]=0 + added to running queue +> CPU occupation: CPU[0]=20 +> running: [(20,2) ] +> pending: [(1,1) ] +[t=13] +> schedule pid=1 prio=1 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=2 prio=20 ('p0') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,2) ] +> pending: [(1,1) ] +[t=14] +> schedule pid=1 prio=1 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=2 prio=20 ('p0') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,2) ] +> pending: [(1,1) ] +[t=15] +> schedule pid=1 prio=1 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=2 prio=20 ('p0') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(20,2) ] +> pending: [(1,1) ] +[t=16] +> process pid=2 prio=20 ('p0') finished after time t=15 +> CPU occupation: CPU[0]=0 +> schedule pid=1 prio=1 ('p2') ... added to running queue +> CPU occupation: CPU[0]=1 +> running: [(1,1) ] +> pending: [] +[t=17] +> running: [(1,1) ] +> pending: [] +[t=18] +> running: [(1,1) ] +> pending: [] +[t=19] +> running: [(1,1) ] +> pending: [] +[t=20] +> running: [(1,1) ] +> pending: [] +[t=21] +> running: [(1,1) ] +> pending: [] +[t=22] +> running: [(1,1) ] +> pending: [] +[t=23] +> running: [(1,1) ] +> pending: [] +[t=24] +> process pid=1 prio=1 ('p2') finished after time t=23 +> CPU occupation: CPU[0]=0 +> running: [] +> pending: [] +[t=25] +> running: [] +> pending: [] +[t=26] +> running: [] +> pending: [] +[t=27] +> running: [] +> pending: [] +[t=28] +> running: [] +> pending: [] +[t=29] +> running: [] +> pending: [] +* Chronogram === + |....|....|....|....|....|... +p0 XXXXXXXXXX (tf=10,idle=0) +p2 XXXXXXXXXXXXXXXXXXXXX (tf=23,idle=13) +p0 XXX (tf=15,idle=0) + +[===Results===] +0 RRRRRRRRRRR__________________ +1 ...........R....RRRRRRRR_____ +2 ............RRRR_____________ diff --git a/tests/out/test-2.res b/tests/out/test-2.res new file mode 100644 index 0000000000000000000000000000000000000000..0733b0a478777cf54df9b8ef44cf371dd952baf6 --- /dev/null +++ b/tests/out/test-2.res @@ -0,0 +1,4 @@ +[===Results===] +0 RRRRRRRRRRR__________________ +1 ...........R....RRRRRRRR_____ +2 ............RRRR_____________ diff --git a/tests/out/test-3.out b/tests/out/test-3.out new file mode 100644 index 0000000000000000000000000000000000000000..b396a6b35de22a26d98f4ce97819cdbcc13394a9 --- /dev/null +++ b/tests/out/test-3.out @@ -0,0 +1,115 @@ +* Read from stdin ... 4 lines in data. +* Loaded 4 lines of data. +* starting scheduling on 1 CPUs +[t=0] +> schedule pid=0 prio=5 ('p0') ... added to running queue +> CPU occupation: CPU[0]=5 +> running: [(5,0) ] +> pending: [(15,2) (5,1) ] +[t=1] +> running: [(5,0) ] +> pending: [(15,2) (5,1) ] +[t=2] +> schedule pid=1 prio=5 ('p1') ... added to running queue +> CPU occupation: CPU[0]=10 +> running: [(5,0) (5,1) ] +> pending: [(15,2) ] +[t=3] +> running: [(5,0) (5,1) ] +> pending: [(15,2) ] +[t=4] +> running: [(5,0) (5,1) ] +> pending: [(15,2) ] +[t=5] +> running: [(5,0) (5,1) ] +> pending: [(15,2) ] +[t=6] +> running: [(5,0) (5,1) ] +> pending: [(15,2) ] +[t=7] +> running: [(5,0) (5,1) ] +> pending: [(15,2) ] +[t=8] +> running: [(5,0) (5,1) ] +> pending: [(15,2) ] +[t=9] +> running: [(5,0) (5,1) ] +> pending: [(15,2) ] +[t=10] +> process pid=0 prio=5 ('p0') finished after time t=9 +> CPU occupation: CPU[0]=5 +> running: [(5,1) ] +> pending: [(15,2) ] +[t=11] +> running: [(5,1) ] +> pending: [(15,2) ] +[t=12] +> schedule pid=2 prio=15 ('p2') ... added to running queue +> CPU occupation: CPU[0]=20 +> running: [(15,2) (5,1) ] +> pending: [] +[t=13] +> running: [(15,2) (5,1) ] +> pending: [] +[t=14] +> running: [(15,2) (5,1) ] +> pending: [] +[t=15] +> running: [(15,2) (5,1) ] +> pending: [] +[t=16] +> process pid=2 prio=15 ('p2') finished after time t=15 +> CPU occupation: CPU[0]=5 +> process pid=1 prio=5 ('p1') finished after time t=15 +> CPU occupation: CPU[0]=0 +> running: [] +> pending: [] +[t=17] +> running: [] +> pending: [] +[t=18] +> running: [] +> pending: [] +[t=19] +> running: [] +> pending: [] +[t=20] +> running: [] +> pending: [] +[t=21] +> running: [] +> pending: [] +[t=22] +> running: [] +> pending: [] +[t=23] +> running: [] +> pending: [] +[t=24] +> running: [] +> pending: [] +[t=25] +> running: [] +> pending: [] +[t=26] +> running: [] +> pending: [] +[t=27] +> running: [] +> pending: [] +[t=28] +> running: [] +> pending: [] +[t=29] +> running: [] +> pending: [] +* Chronogram === + |....|....|....|....|....|... +p0 XXXXXXXXX (tf=9,idle=0) +p1 XXXXXXXXXXXXX (tf=15,idle=0) +p2 XXX (tf=15,idle=0) + +[===Results===] +0 RRRRRRRRRR___________________ +1 ..RRRRRRRRRRRRRR_____________ +2 ............RRRR_____________ diff --git a/tests/out/test-3.res b/tests/out/test-3.res new file mode 100644 index 0000000000000000000000000000000000000000..05dab0bbadcb4d162cfff22b9a51d8d11df580dd --- /dev/null +++ b/tests/out/test-3.res @@ -0,0 +1,4 @@ +[===Results===] +0 RRRRRRRRRR___________________ +1 ..RRRRRRRRRRRRRR_____________ +2 ............RRRR_____________ diff --git a/tests/out/test-4.out b/tests/out/test-4.out new file mode 100644 index 0000000000000000000000000000000000000000..a47641e347957627672597958f845aa7a0110cc0 --- /dev/null +++ b/tests/out/test-4.out @@ -0,0 +1,157 @@ +* Read from stdin ... 11 lines in data. +* Loaded 11 lines of data. +* starting scheduling on 1 CPUs +[t=0] +> schedule pid=0 prio=0 ('0') ... added to running queue +> CPU occupation: CPU[0]=0 +> running: [(0,0) ] +> pending: [(0,9) (0,8) (0,7) (0,6) (0,5) (0,4) (0,3) (0,2) (0,1) ] +[t=1] +> schedule pid=1 prio=0 ('0') ... added to running queue +> CPU occupation: CPU[0]=0 +> running: [(0,0) (0,1) ] +> pending: [(0,9) (0,2) (0,3) (0,4) (0,5) (0,6) (0,7) (0,8) ] +[t=2] +> running: [(0,0) (0,1) ] +> pending: [(0,9) (0,8) (0,7) (0,6) (0,5) (0,4) (0,3) (0,2) ] +[t=3] +> schedule pid=2 prio=0 ('0') ... added to running queue +> CPU occupation: CPU[0]=0 +> running: [(0,0) (0,1) (0,2) ] +> pending: [(0,9) (0,3) (0,4) (0,5) (0,6) (0,7) (0,8) ] +[t=4] +> schedule pid=3 prio=0 ('0') ... added to running queue +> CPU occupation: CPU[0]=0 +> running: [(0,0) (0,2) (0,1) (0,3) ] +> pending: [(0,9) (0,8) (0,7) (0,6) (0,5) (0,4) ] +[t=5] +> running: [(0,0) (0,3) (0,1) (0,2) ] +> pending: [(0,9) (0,4) (0,5) (0,6) (0,7) (0,8) ] +[t=6] +> running: [(0,0) (0,2) (0,1) (0,3) ] +> pending: [(0,9) (0,8) (0,7) (0,6) (0,5) (0,4) ] +[t=7] +> process pid=3 prio=0 ('0') finished after time t=6 +> CPU occupation: CPU[0]=0 +> schedule pid=4 prio=0 ('0') ... added to running queue +> CPU occupation: CPU[0]=0 +> running: [(0,0) (0,1) (0,2) (0,4) ] +> pending: [(0,9) (0,5) (0,6) (0,7) (0,8) ] +[t=8] +> schedule pid=5 prio=0 ('0') ... added to running queue +> CPU occupation: CPU[0]=0 +> running: [(0,0) (0,4) (0,2) (0,1) (0,5) ] +> pending: [(0,9) (0,8) (0,7) (0,6) ] +[t=9] +> running: [(0,0) (0,5) (0,1) (0,2) (0,4) ] +> pending: [(0,9) (0,6) (0,7) (0,8) ] +[t=10] +> process pid=4 prio=0 ('0') finished after time t=9 +> CPU occupation: CPU[0]=0 +> process pid=5 prio=0 ('0') finished after time t=9 +> CPU occupation: CPU[0]=0 +> schedule pid=6 prio=0 ('0') ... added to running queue +> CPU occupation: CPU[0]=0 +> running: [(0,0) (0,2) (0,1) (0,6) ] +> pending: [(0,9) (0,8) (0,7) ] +[t=11] +> schedule pid=7 prio=0 ('0') ... added to running queue +> CPU occupation: CPU[0]=0 +> running: [(0,0) (0,6) (0,1) (0,2) (0,7) ] +> pending: [(0,9) (0,8) ] +[t=12] +> running: [(0,0) (0,7) (0,2) (0,1) (0,6) ] +> pending: [(0,9) (0,8) ] +[t=13] +> running: [(0,0) (0,6) (0,1) (0,2) (0,7) ] +> pending: [(0,9) (0,8) ] +[t=14] +> process pid=7 prio=0 ('0') finished after time t=13 +> CPU occupation: CPU[0]=0 +> process pid=6 prio=0 ('0') finished after time t=13 +> CPU occupation: CPU[0]=0 +> schedule pid=9 prio=0 ('0') ... added to running queue +> CPU occupation: CPU[0]=0 +> schedule pid=8 prio=0 ('0') ... added to running queue +> CPU occupation: CPU[0]=0 +> running: [(0,0) (0,2) (0,1) (0,9) (0,8) ] +> pending: [] +[t=15] +> running: [(0,0) (0,8) (0,9) (0,1) (0,2) ] +> pending: [] +[t=16] +> process pid=9 prio=0 ('0') finished after time t=15 +> CPU occupation: CPU[0]=0 +> running: [(0,0) (0,2) (0,1) (0,8) ] +> pending: [] +[t=17] +> process pid=8 prio=0 ('0') finished after time t=16 +> CPU occupation: CPU[0]=0 +> process pid=1 prio=0 ('0') finished after time t=16 +> CPU occupation: CPU[0]=0 +> process pid=2 prio=0 ('0') finished after time t=16 +> CPU occupation: CPU[0]=0 +> running: [(0,0) ] +> pending: [] +[t=18] +> running: [(0,0) ] +> pending: [] +[t=19] +> process pid=0 prio=0 ('0') finished after time t=18 +> CPU occupation: CPU[0]=0 +> running: [] +> pending: [] +[t=20] +> running: [] +> pending: [] +[t=21] +> running: [] +> pending: [] +[t=22] +> running: [] +> pending: [] +[t=23] +> running: [] +> pending: [] +[t=24] +> running: [] +> pending: [] +[t=25] +> running: [] +> pending: [] +[t=26] +> running: [] +> pending: [] +[t=27] +> running: [] +> pending: [] +[t=28] +> running: [] +> pending: [] +[t=29] +> running: [] +> pending: [] +* Chronogram === + |....|....|....|....|....|... +0 XXXXXXXXXXXXXXXXXX (tf=18,idle=0) +0 XXXXXXXXXXXXXXX (tf=16,idle=0) +0 XXXXXXXXXXXXX (tf=16,idle=0) +0 XX (tf=6,idle=0) +0 XX (tf=9,idle=0) +0 X (tf=9,idle=0) +0 XXX (tf=13,idle=0) +0 XX (tf=13,idle=0) +0 XX (tf=16,idle=0) +0 X (tf=15,idle=0) + +[===Results===] +0 RRRRRRRRRRRRRRRRRRR__________ +1 .RRRRRRRRRRRRRRRR____________ +2 ...RRRRRRRRRRRRRR____________ +3 ....RRR______________________ +4 .......RRR___________________ +5 ........RR___________________ +6 ..........RRRR_______________ +7 ...........RRR_______________ +8 ..............RRR____________ +9 ..............RR_____________ diff --git a/tests/out/test-4.res b/tests/out/test-4.res new file mode 100644 index 0000000000000000000000000000000000000000..88529a0a6c83971f9178d6cfac77427b08e53a6a --- /dev/null +++ b/tests/out/test-4.res @@ -0,0 +1,11 @@ +[===Results===] +0 RRRRRRRRRRRRRRRRRRR__________ +1 .RRRRRRRRRRRRRRRR____________ +2 ...RRRRRRRRRRRRRR____________ +3 ....RRR______________________ +4 .......RRR___________________ +5 ........RR___________________ +6 ..........RRRR_______________ +7 ...........RRR_______________ +8 ..............RRR____________ +9 ..............RR_____________ diff --git a/tests/out/test-5.out b/tests/out/test-5.out new file mode 100644 index 0000000000000000000000000000000000000000..5d0def07b0a85cf59bf383a54fde26298c821aa6 --- /dev/null +++ b/tests/out/test-5.out @@ -0,0 +1,169 @@ +* Read from stdin ... 11 lines in data. +* Loaded 11 lines of data. +* starting scheduling on 1 CPUs +[t=0] +> schedule pid=0 prio=10 ('init') ... added to running queue +> CPU occupation: CPU[0]=10 +> running: [(10,0) ] +> pending: [(5,9) (5,7) (5,4) (4,8) (4,5) (3,6) (2,3) (1,2) (1,1) ] +[t=1] +> schedule pid=1 prio=1 ('bash') ... added to running queue +> CPU occupation: CPU[0]=11 +> running: [(10,0) (1,1) ] +> pending: [(5,9) (5,7) (5,4) (4,8) (4,5) (3,6) (2,3) (1,2) ] +[t=2] +> running: [(10,0) (1,1) ] +> pending: [(5,9) (5,7) (5,4) (4,8) (4,5) (3,6) (2,3) (1,2) ] +[t=3] +> schedule pid=2 prio=1 ('bash') ... added to running queue +> CPU occupation: CPU[0]=12 +> running: [(10,0) (1,1) (1,2) ] +> pending: [(5,9) (5,7) (5,4) (4,8) (4,5) (3,6) (2,3) ] +[t=4] +> schedule pid=3 prio=2 ('find') ... added to running queue +> CPU occupation: CPU[0]=14 +> running: [(10,0) (2,3) (1,1) (1,2) ] +> pending: [(5,9) (5,7) (5,4) (4,5) (4,8) (3,6) ] +[t=5] +> running: [(10,0) (2,3) (1,1) (1,2) ] +> pending: [(5,9) (5,7) (5,4) (4,5) (4,8) (3,6) ] +[t=6] +> running: [(10,0) (2,3) (1,1) (1,2) ] +> pending: [(5,9) (5,7) (5,4) (4,5) (4,8) (3,6) ] +[t=7] +> process pid=3 prio=2 ('find') finished after time t=6 +> CPU occupation: CPU[0]=12 +> schedule pid=4 prio=5 ('gcc') ... added to running queue +> CPU occupation: CPU[0]=17 +> running: [(10,0) (5,4) (1,2) (1,1) ] +> pending: [(5,9) (5,7) (4,5) (4,8) (3,6) ] +[t=8] +> schedule pid=5 prio=4 ('ld') ...can't fit. Pick process to put asleep: pid=2 prio=1 ('bash') +> CPU occupation: CPU[0]=16 + added to running queue +> CPU occupation: CPU[0]=20 +> running: [(10,0) (5,4) (1,1) (4,5) ] +> pending: [(5,9) (5,7) (4,8) (1,2) (3,6) ] +[t=9] +> schedule pid=2 prio=1 ('bash') ...can't fit. Pick process to put asleep: None, as min prio: pid=1 prio=1 ('bash') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(10,0) (5,4) (4,5) (1,1) ] +> pending: [(5,9) (5,7) (4,8) (3,6) (1,2) ] +[t=10] +> process pid=4 prio=5 ('gcc') finished after time t=9 +> CPU occupation: CPU[0]=15 +> process pid=5 prio=4 ('ld') finished after time t=9 +> CPU occupation: CPU[0]=11 +> schedule pid=6 prio=3 ('ssh') ... added to running queue +> CPU occupation: CPU[0]=14 +> schedule pid=2 prio=1 ('bash') ... added to running queue +> CPU occupation: CPU[0]=15 +> running: [(10,0) (1,1) (3,6) (1,2) ] +> pending: [(5,9) (5,7) (4,8) ] +[t=11] +> schedule pid=7 prio=5 ('crypt') ... added to running queue +> CPU occupation: CPU[0]=20 +> running: [(10,0) (5,7) (1,2) (1,1) (3,6) ] +> pending: [(5,9) (4,8) ] +[t=12] +> running: [(10,0) (5,7) (3,6) (1,2) (1,1) ] +> pending: [(5,9) (4,8) ] +[t=13] +> running: [(10,0) (5,7) (3,6) (1,2) (1,1) ] +> pending: [(5,9) (4,8) ] +[t=14] +> process pid=7 prio=5 ('crypt') finished after time t=13 +> CPU occupation: CPU[0]=15 +> process pid=6 prio=3 ('ssh') finished after time t=13 +> CPU occupation: CPU[0]=12 +> schedule pid=9 prio=5 ('cat') ... added to running queue +> CPU occupation: CPU[0]=17 +> schedule pid=8 prio=4 ('snake') ...can't fit. Pick process to put asleep: pid=1 prio=1 ('bash') +> CPU occupation: CPU[0]=16 + added to running queue +> CPU occupation: CPU[0]=20 +> running: [(10,0) (5,9) (1,2) (4,8) ] +> pending: [(1,1) ] +[t=15] +> schedule pid=1 prio=1 ('bash') ...can't fit. Pick process to put asleep: None, as min prio: pid=2 prio=1 ('bash') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(10,0) (5,9) (4,8) (1,2) ] +> pending: [(1,1) ] +[t=16] +> process pid=9 prio=5 ('cat') finished after time t=15 +> CPU occupation: CPU[0]=15 +> schedule pid=1 prio=1 ('bash') ... added to running queue +> CPU occupation: CPU[0]=16 +> running: [(10,0) (4,8) (1,2) (1,1) ] +> pending: [] +[t=17] +> process pid=8 prio=4 ('snake') finished after time t=16 +> CPU occupation: CPU[0]=12 +> running: [(10,0) (1,2) (1,1) ] +> pending: [] +[t=18] +> running: [(10,0) (1,1) (1,2) ] +> pending: [] +[t=19] +> process pid=0 prio=10 ('init') finished after time t=18 +> CPU occupation: CPU[0]=2 +> process pid=2 prio=1 ('bash') finished after time t=18 +> CPU occupation: CPU[0]=1 +> process pid=1 prio=1 ('bash') finished after time t=18 +> CPU occupation: CPU[0]=0 +> running: [] +> pending: [] +[t=20] +> running: [] +> pending: [] +[t=21] +> running: [] +> pending: [] +[t=22] +> running: [] +> pending: [] +[t=23] +> running: [] +> pending: [] +[t=24] +> running: [] +> pending: [] +[t=25] +> running: [] +> pending: [] +[t=26] +> running: [] +> pending: [] +[t=27] +> running: [] +> pending: [] +[t=28] +> running: [] +> pending: [] +[t=29] +> running: [] +> pending: [] +* Chronogram === + |....|....|....|....|....|... +init XXXXXXXXXXXXXXXXXX (tf=18,idle=0) +bash XXXXXXXXXXXXXXXXX (tf=18,idle=2) +bash XXXXXXXXXXXXXXX (tf=18,idle=2) +find XX (tf=6,idle=0) +gcc XX (tf=9,idle=0) +ld X (tf=9,idle=0) +ssh XXX (tf=13,idle=0) +crypt XX (tf=13,idle=0) +snake XX (tf=16,idle=0) +cat X (tf=15,idle=0) + +[===Results===] +0 RRRRRRRRRRRRRRRRRRR__________ +1 .RRRRRRRRRRRRR..RRR__________ +2 ...RRRRR..RRRRRRRRR__________ +3 ....RRR______________________ +4 .......RRR___________________ +5 ........RR___________________ +6 ..........RRRR_______________ +7 ...........RRR_______________ +8 ..............RRR____________ +9 ..............RR_____________ diff --git a/tests/out/test-5.res b/tests/out/test-5.res new file mode 100644 index 0000000000000000000000000000000000000000..d62d42c41c47f98afc086f59d1670ab9022a764c --- /dev/null +++ b/tests/out/test-5.res @@ -0,0 +1,11 @@ +[===Results===] +0 RRRRRRRRRRRRRRRRRRR__________ +1 .RRRRRRRRRRRRR..RRR__________ +2 ...RRRRR..RRRRRRRRR__________ +3 ....RRR______________________ +4 .......RRR___________________ +5 ........RR___________________ +6 ..........RRRR_______________ +7 ...........RRR_______________ +8 ..............RRR____________ +9 ..............RR_____________ diff --git a/tests/out/test-6.out b/tests/out/test-6.out new file mode 100644 index 0000000000000000000000000000000000000000..e6431de25550a5ca5d55d0754a5726d9ee93b361 --- /dev/null +++ b/tests/out/test-6.out @@ -0,0 +1,191 @@ +* Read from stdin ... 11 lines in data. +* Loaded 11 lines of data. +* starting scheduling on 1 CPUs +[t=0] +> schedule pid=0 prio=10 ('init') ... added to running queue +> CPU occupation: CPU[0]=10 +> running: [(10,0) ] +> pending: [(5,9) (5,7) (5,4) (4,8) (4,5) (3,6) (2,3) (1,2) (1,1) ] +[t=1] +> schedule pid=1 prio=1 ('bash') ... added to running queue +> CPU occupation: CPU[0]=11 +> running: [(10,0) (1,1) ] +> pending: [(5,9) (5,7) (5,4) (4,8) (4,5) (3,6) (2,3) (1,2) ] +[t=2] +> running: [(10,0) (1,1) ] +> pending: [(5,9) (5,7) (5,4) (4,8) (4,5) (3,6) (2,3) (1,2) ] +[t=3] +> schedule pid=2 prio=1 ('bash') ... added to running queue +> CPU occupation: CPU[0]=12 +> running: [(10,0) (1,1) (1,2) ] +> pending: [(5,9) (5,7) (5,4) (4,8) (4,5) (3,6) (2,3) ] +[t=4] +> schedule pid=3 prio=2 ('find') ... added to running queue +> CPU occupation: CPU[0]=14 +> running: [(10,0) (2,3) (1,1) (1,2) ] +> pending: [(5,9) (5,7) (5,4) (4,5) (4,8) (3,6) ] +[t=5] +> running: [(10,0) (2,3) (1,1) (1,2) ] +> pending: [(5,9) (5,7) (5,4) (4,5) (4,8) (3,6) ] +[t=6] +> running: [(10,0) (2,3) (1,1) (1,2) ] +> pending: [(5,9) (5,7) (5,4) (4,5) (4,8) (3,6) ] +[t=7] +> process pid=3 prio=2 ('find') finished after time t=6 +> CPU occupation: CPU[0]=12 +> schedule pid=4 prio=5 ('gcc') ... added to running queue +> CPU occupation: CPU[0]=17 +> running: [(10,0) (5,4) (1,2) (1,1) ] +> pending: [(5,9) (5,7) (4,5) (4,8) (3,6) ] +[t=8] +> schedule pid=5 prio=4 ('ld') ...can't fit. Pick process to put asleep: pid=2 prio=1 ('bash') +> CPU occupation: CPU[0]=16 + added to running queue +> CPU occupation: CPU[0]=20 +> running: [(10,0) (5,4) (1,1) (4,5) ] +> pending: [(5,9) (5,7) (4,8) (1,2) (3,6) ] +[t=9] +> schedule pid=2 prio=1 ('bash') ...can't fit. Pick process to put asleep: None, as min prio: pid=1 prio=1 ('bash') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(10,0) (5,4) (4,5) (1,1) ] +> pending: [(5,9) (5,7) (4,8) (3,6) (1,2) ] +[t=10] +> process pid=5 prio=4 ('ld') finished after time t=9 +> CPU occupation: CPU[0]=16 +> schedule pid=6 prio=3 ('ssh') ... added to running queue +> CPU occupation: CPU[0]=19 +> schedule pid=2 prio=1 ('bash') ... added to running queue +> CPU occupation: CPU[0]=20 +> running: [(10,0) (5,4) (1,1) (3,6) (1,2) ] +> pending: [(5,9) (5,7) (4,8) ] +[t=11] +> schedule pid=7 prio=5 ('crypt') ...can't fit. Pick process to put asleep: pid=1 prio=1 ('bash') +> CPU occupation: CPU[0]=19 +can't fit. Pick process to put asleep: pid=2 prio=1 ('bash') +> CPU occupation: CPU[0]=18 +can't fit. Pick process to put asleep: pid=6 prio=3 ('ssh') +> CPU occupation: CPU[0]=15 + added to running queue +> CPU occupation: CPU[0]=20 +> running: [(10,0) (5,4) (5,7) ] +> pending: [(5,9) (4,8) (1,2) (1,1) (3,6) ] +[t=12] +> process pid=4 prio=5 ('gcc') finished after time t=11 +> CPU occupation: CPU[0]=15 +> schedule pid=6 prio=3 ('ssh') ... added to running queue +> CPU occupation: CPU[0]=18 +> schedule pid=2 prio=1 ('bash') ... added to running queue +> CPU occupation: CPU[0]=19 +> schedule pid=1 prio=1 ('bash') ... added to running queue +> CPU occupation: CPU[0]=20 +> running: [(10,0) (5,7) (3,6) (1,2) (1,1) ] +> pending: [(5,9) (4,8) ] +[t=13] +> running: [(10,0) (5,7) (3,6) (1,2) (1,1) ] +> pending: [(5,9) (4,8) ] +[t=14] +> process pid=7 prio=5 ('crypt') finished after time t=13 +> CPU occupation: CPU[0]=15 +> schedule pid=9 prio=5 ('cat') ... added to running queue +> CPU occupation: CPU[0]=20 +> schedule pid=8 prio=4 ('snake') ...can't fit. Pick process to put asleep: pid=2 prio=1 ('bash') +> CPU occupation: CPU[0]=19 +can't fit. Pick process to put asleep: pid=1 prio=1 ('bash') +> CPU occupation: CPU[0]=18 +can't fit. Pick process to put asleep: pid=6 prio=3 ('ssh') +> CPU occupation: CPU[0]=15 + added to running queue +> CPU occupation: CPU[0]=19 +> running: [(10,0) (5,9) (4,8) ] +> pending: [(3,6) (1,1) (1,2) ] +[t=15] +> schedule pid=6 prio=3 ('ssh') ...can't fit. Pick process to put asleep: None, as min prio: pid=8 prio=4 ('snake') has greater or equal priority +> CPU occupation: CPU[0]=19 +> schedule pid=2 prio=1 ('bash') ... added to running queue +> CPU occupation: CPU[0]=20 +> schedule pid=1 prio=1 ('bash') ...can't fit. Pick process to put asleep: None, as min prio: pid=2 prio=1 ('bash') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(10,0) (5,9) (4,8) (1,2) ] +> pending: [(3,6) (1,1) ] +[t=16] +> process pid=9 prio=5 ('cat') finished after time t=15 +> CPU occupation: CPU[0]=15 +> schedule pid=6 prio=3 ('ssh') ... added to running queue +> CPU occupation: CPU[0]=18 +> schedule pid=1 prio=1 ('bash') ... added to running queue +> CPU occupation: CPU[0]=19 +> running: [(10,0) (4,8) (1,2) (3,6) (1,1) ] +> pending: [] +[t=17] +> process pid=8 prio=4 ('snake') finished after time t=16 +> CPU occupation: CPU[0]=15 +> process pid=6 prio=3 ('ssh') finished after time t=16 +> CPU occupation: CPU[0]=12 +> running: [(10,0) (1,2) (1,1) ] +> pending: [] +[t=18] +> running: [(10,0) (1,1) (1,2) ] +> pending: [] +[t=19] +> process pid=0 prio=10 ('init') finished after time t=18 +> CPU occupation: CPU[0]=2 +> running: [(1,2) (1,1) ] +> pending: [] +[t=20] +> process pid=1 prio=1 ('bash') finished after time t=19 +> CPU occupation: CPU[0]=1 +> running: [(1,2) ] +> pending: [] +[t=21] +> process pid=2 prio=1 ('bash') finished after time t=20 +> CPU occupation: CPU[0]=0 +> running: [] +> pending: [] +[t=22] +> running: [] +> pending: [] +[t=23] +> running: [] +> pending: [] +[t=24] +> running: [] +> pending: [] +[t=25] +> running: [] +> pending: [] +[t=26] +> running: [] +> pending: [] +[t=27] +> running: [] +> pending: [] +[t=28] +> running: [] +> pending: [] +[t=29] +> running: [] +> pending: [] +* Chronogram === + |....|....|....|....|....|... +init XXXXXXXXXXXXXXXXXX (tf=18,idle=0) +bash XXXXXXXXXXXXXXXXXX (tf=19,idle=3) +bash XXXXXXXXXXXXXXXXX (tf=20,idle=4) +find XX (tf=6,idle=0) +gcc XXXX (tf=11,idle=0) +ld X (tf=9,idle=0) +ssh XXXXXX (tf=16,idle=3) +crypt XX (tf=13,idle=0) +snake XX (tf=16,idle=0) +cat X (tf=15,idle=0) + +[===Results===] +0 RRRRRRRRRRRRRRRRRRR__________ +1 .RRRRRRRRRR.RR..RRRR_________ +2 ...RRRRR..R.RR.RRRRRR________ +3 ....RRR______________________ +4 .......RRRRR_________________ +5 ........RR___________________ +6 ..........R.RR..R____________ +7 ...........RRR_______________ +8 ..............RRR____________ +9 ..............RR_____________ diff --git a/tests/out/test-6.res b/tests/out/test-6.res new file mode 100644 index 0000000000000000000000000000000000000000..c51838a636e3e91a6383a6354bae2133f921ec8f --- /dev/null +++ b/tests/out/test-6.res @@ -0,0 +1,11 @@ +[===Results===] +0 RRRRRRRRRRRRRRRRRRR__________ +1 .RRRRRRRRRR.RR..RRRR_________ +2 ...RRRRR..R.RR.RRRRRR________ +3 ....RRR______________________ +4 .......RRRRR_________________ +5 ........RR___________________ +6 ..........R.RR..R____________ +7 ...........RRR_______________ +8 ..............RRR____________ +9 ..............RR_____________ diff --git a/tests/out/test-7.out b/tests/out/test-7.out new file mode 100644 index 0000000000000000000000000000000000000000..2eefb37c2b7910ff25593142937f84dddd037089 --- /dev/null +++ b/tests/out/test-7.out @@ -0,0 +1,195 @@ +* Read from stdin ... 6 lines in data. +* Loaded 6 lines of data. +* starting scheduling on 1 CPUs +[t=0] +> schedule pid=0 prio=5 ('p0') ... added to running queue +> CPU occupation: CPU[0]=5 +> running: [(5,0) ] +> pending: [(10,3) (9,4) (6,1) (4,2) ] +[t=1] +> running: [(5,0) ] +> pending: [(10,3) (9,4) (6,1) (4,2) ] +[t=2] +> schedule pid=1 prio=6 ('p1') ... added to running queue +> CPU occupation: CPU[0]=11 +> running: [(6,1) (5,0) ] +> pending: [(10,3) (9,4) (4,2) ] +[t=3] +> running: [(6,1) (5,0) ] +> pending: [(10,3) (9,4) (4,2) ] +[t=4] +> schedule pid=2 prio=4 ('p2') ... added to running queue +> CPU occupation: CPU[0]=15 +> running: [(6,1) (5,0) (4,2) ] +> pending: [(10,3) (9,4) ] +[t=5] +> running: [(6,1) (5,0) (4,2) ] +> pending: [(10,3) (9,4) ] +[t=6] +> schedule pid=3 prio=10 ('p3') ...can't fit. Pick process to put asleep: pid=2 prio=4 ('p2') +> CPU occupation: CPU[0]=11 +can't fit. Pick process to put asleep: pid=0 prio=5 ('p0') +> CPU occupation: CPU[0]=6 + added to running queue +> CPU occupation: CPU[0]=16 +> schedule pid=4 prio=9 ('p4') ...can't fit. Pick process to put asleep: pid=1 prio=6 ('p1') +> CPU occupation: CPU[0]=10 + added to running queue +> CPU occupation: CPU[0]=19 +> running: [(10,3) (9,4) ] +> pending: [(6,1) (4,2) (5,0) ] +[t=7] +> schedule pid=1 prio=6 ('p1') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=9 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=19 +> schedule pid=0 prio=5 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=9 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=19 +> schedule pid=2 prio=4 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=9 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=19 +> running: [(10,3) (9,4) ] +> pending: [(6,1) (5,0) (4,2) ] +[t=8] +> schedule pid=1 prio=6 ('p1') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=9 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=19 +> schedule pid=0 prio=5 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=9 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=19 +> schedule pid=2 prio=4 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=9 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=19 +> running: [(10,3) (9,4) ] +> pending: [(6,1) (5,0) (4,2) ] +[t=9] +> schedule pid=1 prio=6 ('p1') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=9 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=19 +> schedule pid=0 prio=5 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=9 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=19 +> schedule pid=2 prio=4 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=9 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=19 +> running: [(10,3) (9,4) ] +> pending: [(6,1) (5,0) (4,2) ] +[t=10] +> schedule pid=1 prio=6 ('p1') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=9 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=19 +> schedule pid=0 prio=5 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=9 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=19 +> schedule pid=2 prio=4 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=9 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=19 +> running: [(10,3) (9,4) ] +> pending: [(6,1) (5,0) (4,2) ] +[t=11] +> schedule pid=1 prio=6 ('p1') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=9 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=19 +> schedule pid=0 prio=5 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=9 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=19 +> schedule pid=2 prio=4 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=9 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=19 +> running: [(10,3) (9,4) ] +> pending: [(6,1) (5,0) (4,2) ] +[t=12] +> schedule pid=1 prio=6 ('p1') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=9 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=19 +> schedule pid=0 prio=5 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=9 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=19 +> schedule pid=2 prio=4 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=9 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=19 +> running: [(10,3) (9,4) ] +> pending: [(6,1) (5,0) (4,2) ] +[t=13] +> schedule pid=1 prio=6 ('p1') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=9 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=19 +> schedule pid=0 prio=5 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=9 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=19 +> schedule pid=2 prio=4 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=9 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=19 +> running: [(10,3) (9,4) ] +> pending: [(6,1) (5,0) (4,2) ] +[t=14] +> schedule pid=1 prio=6 ('p1') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=9 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=19 +> schedule pid=0 prio=5 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=9 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=19 +> schedule pid=2 prio=4 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=9 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=19 +> running: [(10,3) (9,4) ] +> pending: [(6,1) (5,0) (4,2) ] +[t=15] +> process pid=4 prio=9 ('p4') finished after time t=14 +> CPU occupation: CPU[0]=10 +> schedule pid=1 prio=6 ('p1') ... added to running queue +> CPU occupation: CPU[0]=16 +> schedule pid=0 prio=5 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=1 prio=6 ('p1') has greater or equal priority +> CPU occupation: CPU[0]=16 +> schedule pid=2 prio=4 ('p2') ... added to running queue +> CPU occupation: CPU[0]=20 +> running: [(10,3) (6,1) (4,2) ] +> pending: [(5,0) ] +[t=16] +> schedule pid=0 prio=5 ('p0') ...can't fit. Pick process to put asleep: pid=2 prio=4 ('p2') +> CPU occupation: CPU[0]=16 +can't fit. Pick process to put asleep: None, as min prio: pid=1 prio=6 ('p1') has greater or equal priority +> CPU occupation: CPU[0]=16 +> running: [(10,3) (6,1) ] +> pending: [(5,0) (4,2) ] +[t=17] +> process pid=3 prio=10 ('p3') finished after time t=16 +> CPU occupation: CPU[0]=6 +> schedule pid=0 prio=5 ('p0') ... added to running queue +> CPU occupation: CPU[0]=11 +> schedule pid=2 prio=4 ('p2') ... added to running queue +> CPU occupation: CPU[0]=15 +> running: [(6,1) (5,0) (4,2) ] +> pending: [] +[t=18] +> running: [(6,1) (5,0) (4,2) ] +> pending: [] +[t=19] +> running: [(6,1) (5,0) (4,2) ] +> pending: [] +[t=20] +> running: [(6,1) (5,0) (4,2) ] +> pending: [] +[t=21] +> running: [(6,1) (5,0) (4,2) ] +> pending: [] +[t=22] +> process pid=1 prio=6 ('p1') finished after time t=21 +> CPU occupation: CPU[0]=9 +> process pid=0 prio=5 ('p0') finished after time t=21 +> CPU occupation: CPU[0]=4 +> running: [(4,2) ] +> pending: [] +[t=23] +> running: [(4,2) ] +> pending: [] +[t=24] +> running: [(4,2) ] +> pending: [] +[t=25] +> process pid=2 prio=4 ('p2') finished after time t=24 +> CPU occupation: CPU[0]=0 +> running: [] +> pending: [] +[t=26] +> running: [] +> pending: [] +[t=27] +> running: [] +> pending: [] +[t=28] +> running: [] +> pending: [] +[t=29] +> running: [] +> pending: [] +* Chronogram === + |....|....|....|....|....|... +p0 XXXXXXXXXXXXXXXXXXXXX (tf=21,idle=11) +p1 XXXXXXXXXXXXXXXXXXX (tf=21,idle=9) +p2 XXXXXXXXXXXXXXXXXXXX (tf=24,idle=10) +p3 XXXXXXXXXX (tf=16,idle=0) +p4 XXXXXXXX (tf=14,idle=0) + +[===Results===] +0 RRRRRR...........RRRRR_______ +1 ..RRRR.........RRRRRRR_______ +2 ....RR.........R.RRRRRRRR____ +3 ......RRRRRRRRRRR____________ +4 ......RRRRRRRRR______________ diff --git a/tests/out/test-7.res b/tests/out/test-7.res new file mode 100644 index 0000000000000000000000000000000000000000..9890c22dc8470deedcaf31a38468900906fc9ae0 --- /dev/null +++ b/tests/out/test-7.res @@ -0,0 +1,6 @@ +[===Results===] +0 RRRRRR...........RRRRR_______ +1 ..RRRR.........RRRRRRR_______ +2 ....RR.........R.RRRRRRRR____ +3 ......RRRRRRRRRRR____________ +4 ......RRRRRRRRR______________ diff --git a/tests/out/test-8.out b/tests/out/test-8.out new file mode 100644 index 0000000000000000000000000000000000000000..91d122dba491c51641558ca3a8540cdaec5cf913 --- /dev/null +++ b/tests/out/test-8.out @@ -0,0 +1,153 @@ +* Read from stdin ... 5 lines in data. +* Loaded 5 lines of data. +* starting scheduling on 1 CPUs +[t=0] +> schedule pid=0 prio=5 ('p0') ... added to running queue +> CPU occupation: CPU[0]=5 +> running: [(5,0) ] +> pending: [(10,3) (6,1) (4,2) ] +[t=1] +> running: [(5,0) ] +> pending: [(10,3) (6,1) (4,2) ] +[t=2] +> schedule pid=1 prio=6 ('p1') ... added to running queue +> CPU occupation: CPU[0]=11 +> running: [(6,1) (5,0) ] +> pending: [(10,3) (4,2) ] +[t=3] +> running: [(6,1) (5,0) ] +> pending: [(10,3) (4,2) ] +[t=4] +> schedule pid=2 prio=4 ('p2') ... added to running queue +> CPU occupation: CPU[0]=15 +> running: [(6,1) (5,0) (4,2) ] +> pending: [(10,3) ] +[t=5] +> running: [(6,1) (5,0) (4,2) ] +> pending: [(10,3) ] +[t=6] +> schedule pid=3 prio=10 ('p3') ...can't fit. Pick process to put asleep: pid=2 prio=4 ('p2') +> CPU occupation: CPU[0]=11 +can't fit. Pick process to put asleep: pid=0 prio=5 ('p0') +> CPU occupation: CPU[0]=6 + added to running queue +> CPU occupation: CPU[0]=16 +> running: [(10,3) (6,1) ] +> pending: [(5,0) (4,2) ] +[t=7] +> schedule pid=0 prio=5 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=1 prio=6 ('p1') has greater or equal priority +> CPU occupation: CPU[0]=16 +> schedule pid=2 prio=4 ('p2') ... added to running queue +> CPU occupation: CPU[0]=20 +> running: [(10,3) (6,1) (4,2) ] +> pending: [(5,0) ] +[t=8] +> schedule pid=0 prio=5 ('p0') ...can't fit. Pick process to put asleep: pid=2 prio=4 ('p2') +> CPU occupation: CPU[0]=16 +can't fit. Pick process to put asleep: None, as min prio: pid=1 prio=6 ('p1') has greater or equal priority +> CPU occupation: CPU[0]=16 +> running: [(10,3) (6,1) ] +> pending: [(5,0) (4,2) ] +[t=9] +> schedule pid=0 prio=5 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=1 prio=6 ('p1') has greater or equal priority +> CPU occupation: CPU[0]=16 +> schedule pid=2 prio=4 ('p2') ... added to running queue +> CPU occupation: CPU[0]=20 +> running: [(10,3) (6,1) (4,2) ] +> pending: [(5,0) ] +[t=10] +> schedule pid=0 prio=5 ('p0') ...can't fit. Pick process to put asleep: pid=2 prio=4 ('p2') +> CPU occupation: CPU[0]=16 +can't fit. Pick process to put asleep: None, as min prio: pid=1 prio=6 ('p1') has greater or equal priority +> CPU occupation: CPU[0]=16 +> running: [(10,3) (6,1) ] +> pending: [(5,0) (4,2) ] +[t=11] +> schedule pid=0 prio=5 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=1 prio=6 ('p1') has greater or equal priority +> CPU occupation: CPU[0]=16 +> schedule pid=2 prio=4 ('p2') ... added to running queue +> CPU occupation: CPU[0]=20 +> running: [(10,3) (6,1) (4,2) ] +> pending: [(5,0) ] +[t=12] +> schedule pid=0 prio=5 ('p0') ...can't fit. Pick process to put asleep: pid=2 prio=4 ('p2') +> CPU occupation: CPU[0]=16 +can't fit. Pick process to put asleep: None, as min prio: pid=1 prio=6 ('p1') has greater or equal priority +> CPU occupation: CPU[0]=16 +> running: [(10,3) (6,1) ] +> pending: [(5,0) (4,2) ] +[t=13] +> process pid=1 prio=6 ('p1') finished after time t=12 +> CPU occupation: CPU[0]=10 +> schedule pid=0 prio=5 ('p0') ... added to running queue +> CPU occupation: CPU[0]=15 +> schedule pid=2 prio=4 ('p2') ... added to running queue +> CPU occupation: CPU[0]=19 +> running: [(10,3) (5,0) (4,2) ] +> pending: [] +[t=14] +> running: [(10,3) (5,0) (4,2) ] +> pending: [] +[t=15] +> running: [(10,3) (5,0) (4,2) ] +> pending: [] +[t=16] +> running: [(10,3) (5,0) (4,2) ] +> pending: [] +[t=17] +> process pid=3 prio=10 ('p3') finished after time t=16 +> CPU occupation: CPU[0]=9 +> running: [(5,0) (4,2) ] +> pending: [] +[t=18] +> process pid=0 prio=5 ('p0') finished after time t=17 +> CPU occupation: CPU[0]=4 +> running: [(4,2) ] +> pending: [] +[t=19] +> process pid=2 prio=4 ('p2') finished after time t=18 +> CPU occupation: CPU[0]=0 +> running: [] +> pending: [] +[t=20] +> running: [] +> pending: [] +[t=21] +> running: [] +> pending: [] +[t=22] +> running: [] +> pending: [] +[t=23] +> running: [] +> pending: [] +[t=24] +> running: [] +> pending: [] +[t=25] +> running: [] +> pending: [] +[t=26] +> running: [] +> pending: [] +[t=27] +> running: [] +> pending: [] +[t=28] +> running: [] +> pending: [] +[t=29] +> running: [] +> pending: [] +* Chronogram === + |....|....|....|....|....|... +p0 XXXXXXXXXXXXXXXXX (tf=17,idle=7) +p1 XXXXXXXXXX (tf=12,idle=0) +p2 XXXXXXXXXXXXXX (tf=18,idle=4) +p3 XXXXXXXXXX (tf=16,idle=0) + +[===Results===] +0 RRRRRR.......RRRRR___________ +1 ..RRRRRRRRRRR________________ +2 ....RR.R.R.R.RRRRRR__________ +3 ......RRRRRRRRRRR____________ diff --git a/tests/out/test-8.res b/tests/out/test-8.res new file mode 100644 index 0000000000000000000000000000000000000000..e6630117c49f2303311b5f9a9acf21e998fa7905 --- /dev/null +++ b/tests/out/test-8.res @@ -0,0 +1,5 @@ +[===Results===] +0 RRRRRR.......RRRRR___________ +1 ..RRRRRRRRRRR________________ +2 ....RR.R.R.R.RRRRRR__________ +3 ......RRRRRRRRRRR____________ diff --git a/tests/out/test-9.out b/tests/out/test-9.out new file mode 100644 index 0000000000000000000000000000000000000000..d0e9a47028f1b188b9362df65d3bbf8dc87f0585 --- /dev/null +++ b/tests/out/test-9.out @@ -0,0 +1,207 @@ +* Read from stdin ... 7 lines in data. +* Loaded 7 lines of data. +* starting scheduling on 1 CPUs +[t=0] +> schedule pid=0 prio=5 ('p0') ... added to running queue +> CPU occupation: CPU[0]=5 +> running: [(5,0) ] +> pending: [(15,3) (10,4) (10,5) (8,2) (5,1) ] +[t=1] +> running: [(5,0) ] +> pending: [(15,3) (10,4) (10,5) (8,2) (5,1) ] +[t=2] +> schedule pid=1 prio=5 ('p1') ... added to running queue +> CPU occupation: CPU[0]=10 +> running: [(5,0) (5,1) ] +> pending: [(15,3) (10,4) (10,5) (8,2) ] +[t=3] +> running: [(5,0) (5,1) ] +> pending: [(15,3) (10,4) (10,5) (8,2) ] +[t=4] +> running: [(5,0) (5,1) ] +> pending: [(15,3) (10,4) (10,5) (8,2) ] +[t=5] +> running: [(5,0) (5,1) ] +> pending: [(15,3) (10,4) (10,5) (8,2) ] +[t=6] +> running: [(5,0) (5,1) ] +> pending: [(15,3) (10,4) (10,5) (8,2) ] +[t=7] +> running: [(5,0) (5,1) ] +> pending: [(15,3) (10,4) (10,5) (8,2) ] +[t=8] +> running: [(5,0) (5,1) ] +> pending: [(15,3) (10,4) (10,5) (8,2) ] +[t=9] +> running: [(5,0) (5,1) ] +> pending: [(15,3) (10,4) (10,5) (8,2) ] +[t=10] +> schedule pid=5 prio=10 ('p5') ... added to running queue +> CPU occupation: CPU[0]=20 +> running: [(10,5) (5,1) (5,0) ] +> pending: [(15,3) (10,4) (8,2) ] +[t=11] +> running: [(10,5) (5,0) (5,1) ] +> pending: [(15,3) (10,4) (8,2) ] +[t=12] +> schedule pid=2 prio=8 ('p2') ...can't fit. Pick process to put asleep: pid=1 prio=5 ('p1') +> CPU occupation: CPU[0]=15 +can't fit. Pick process to put asleep: pid=0 prio=5 ('p0') +> CPU occupation: CPU[0]=10 + added to running queue +> CPU occupation: CPU[0]=18 +> running: [(10,5) (8,2) ] +> pending: [(15,3) (10,4) (5,1) (5,0) ] +[t=13] +> schedule pid=3 prio=15 ('p3') ...can't fit. Pick process to put asleep: pid=2 prio=8 ('p2') +> CPU occupation: CPU[0]=10 +can't fit. Pick process to put asleep: pid=5 prio=10 ('p5') +> CPU occupation: CPU[0]=0 + added to running queue +> CPU occupation: CPU[0]=15 +> schedule pid=1 prio=5 ('p1') ... added to running queue +> CPU occupation: CPU[0]=20 +> schedule pid=0 prio=5 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=1 prio=5 ('p1') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(15,3) (5,1) ] +> pending: [(10,5) (8,2) (10,4) (5,0) ] +[t=14] +> schedule pid=5 prio=10 ('p5') ...can't fit. Pick process to put asleep: pid=1 prio=5 ('p1') +> CPU occupation: CPU[0]=15 +can't fit. Pick process to put asleep: None, as min prio: pid=3 prio=15 ('p3') has greater or equal priority +> CPU occupation: CPU[0]=15 +> schedule pid=4 prio=10 ('p4') ...can't fit. Pick process to put asleep: None, as min prio: pid=3 prio=15 ('p3') has greater or equal priority +> CPU occupation: CPU[0]=15 +> schedule pid=2 prio=8 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=3 prio=15 ('p3') has greater or equal priority +> CPU occupation: CPU[0]=15 +> schedule pid=0 prio=5 ('p0') ... added to running queue +> CPU occupation: CPU[0]=20 +> running: [(15,3) (5,0) ] +> pending: [(10,5) (8,2) (10,4) (5,1) ] +[t=15] +> schedule pid=5 prio=10 ('p5') ...can't fit. Pick process to put asleep: pid=0 prio=5 ('p0') +> CPU occupation: CPU[0]=15 +can't fit. Pick process to put asleep: None, as min prio: pid=3 prio=15 ('p3') has greater or equal priority +> CPU occupation: CPU[0]=15 +> schedule pid=4 prio=10 ('p4') ...can't fit. Pick process to put asleep: None, as min prio: pid=3 prio=15 ('p3') has greater or equal priority +> CPU occupation: CPU[0]=15 +> schedule pid=2 prio=8 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=3 prio=15 ('p3') has greater or equal priority +> CPU occupation: CPU[0]=15 +> schedule pid=1 prio=5 ('p1') ... added to running queue +> CPU occupation: CPU[0]=20 +> running: [(15,3) (5,1) ] +> pending: [(10,5) (8,2) (10,4) (5,0) ] +[t=16] +> process pid=3 prio=15 ('p3') finished after time t=15 +> CPU occupation: CPU[0]=5 +> schedule pid=5 prio=10 ('p5') ... added to running queue +> CPU occupation: CPU[0]=15 +> schedule pid=4 prio=10 ('p4') ...can't fit. Pick process to put asleep: pid=1 prio=5 ('p1') +> CPU occupation: CPU[0]=10 + added to running queue +> CPU occupation: CPU[0]=20 +> schedule pid=2 prio=8 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=10 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=20 +> schedule pid=0 prio=5 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=10 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(10,5) (10,4) ] +> pending: [(8,2) (5,1) (5,0) ] +[t=17] +> schedule pid=2 prio=8 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=10 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=20 +> schedule pid=0 prio=5 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=10 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=20 +> schedule pid=1 prio=5 ('p1') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=10 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(10,5) (10,4) ] +> pending: [(8,2) (5,0) (5,1) ] +[t=18] +> schedule pid=2 prio=8 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=10 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=20 +> schedule pid=1 prio=5 ('p1') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=10 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=20 +> schedule pid=0 prio=5 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=10 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(10,5) (10,4) ] +> pending: [(8,2) (5,1) (5,0) ] +[t=19] +> schedule pid=2 prio=8 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=10 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=20 +> schedule pid=0 prio=5 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=10 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=20 +> schedule pid=1 prio=5 ('p1') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=10 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(10,5) (10,4) ] +> pending: [(8,2) (5,0) (5,1) ] +[t=20] +> schedule pid=2 prio=8 ('p2') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=10 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=20 +> schedule pid=1 prio=5 ('p1') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=10 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=20 +> schedule pid=0 prio=5 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=4 prio=10 ('p4') has greater or equal priority +> CPU occupation: CPU[0]=20 +> running: [(10,5) (10,4) ] +> pending: [(8,2) (5,1) (5,0) ] +[t=21] +> process pid=4 prio=10 ('p4') finished after time t=20 +> CPU occupation: CPU[0]=10 +> schedule pid=2 prio=8 ('p2') ... added to running queue +> CPU occupation: CPU[0]=18 +> schedule pid=0 prio=5 ('p0') ...can't fit. Pick process to put asleep: None, as min prio: pid=2 prio=8 ('p2') has greater or equal priority +> CPU occupation: CPU[0]=18 +> schedule pid=1 prio=5 ('p1') ...can't fit. Pick process to put asleep: None, as min prio: pid=2 prio=8 ('p2') has greater or equal priority +> CPU occupation: CPU[0]=18 +> running: [(10,5) (8,2) ] +> pending: [(5,0) (5,1) ] +[t=22] +> process pid=5 prio=10 ('p5') finished after time t=21 +> CPU occupation: CPU[0]=8 +> schedule pid=0 prio=5 ('p0') ... added to running queue +> CPU occupation: CPU[0]=13 +> schedule pid=1 prio=5 ('p1') ... added to running queue +> CPU occupation: CPU[0]=18 +> running: [(8,2) (5,0) (5,1) ] +> pending: [] +[t=23] +> running: [(8,2) (5,1) (5,0) ] +> pending: [] +[t=24] +> process pid=2 prio=8 ('p2') finished after time t=23 +> CPU occupation: CPU[0]=10 +> process pid=0 prio=5 ('p0') finished after time t=23 +> CPU occupation: CPU[0]=5 +> process pid=1 prio=5 ('p1') finished after time t=23 +> CPU occupation: CPU[0]=0 +> running: [] +> pending: [] +[t=25] +> running: [] +> pending: [] +[t=26] +> running: [] +> pending: [] +[t=27] +> running: [] +> pending: [] +[t=28] +> running: [] +> pending: [] +[t=29] +> running: [] +> pending: [] +* Chronogram === + |....|....|....|....|....|... +p0 XXXXXXXXXXXXXXXXXXXXXXX (tf=23,idle=9) +p1 XXXXXXXXXXXXXXXXXXXXX (tf=23,idle=8) +p2 XXXXXXXXXXX (tf=23,idle=8) +p3 XX (tf=15,idle=0) +p4 XXXXXX (tf=20,idle=2) +p5 XXXXXXXXXXX (tf=21,idle=3) + +[===Results===] +0 RRRRRRRRRRRR..R.......RR_____ +1 ..RRRRRRRRRR.R.R......RR_____ +2 ............R........RRR_____ +3 .............RRR_____________ +4 ................RRRRR________ +5 ..........RRR...RRRRRR_______ diff --git a/tests/out/test-9.res b/tests/out/test-9.res new file mode 100644 index 0000000000000000000000000000000000000000..d050c90f4e6a26b5ae489cebef44cf6db40b9e59 --- /dev/null +++ b/tests/out/test-9.res @@ -0,0 +1,7 @@ +[===Results===] +0 RRRRRRRRRRRR..R.......RR_____ +1 ..RRRRRRRRRR.R.R......RR_____ +2 ............R........RRR_____ +3 .............RRR_____________ +4 ................RRRRR________ +5 ..........RRR...RRRRRR_______ diff --git a/tests/ref/test-0.ref b/tests/ref/test-0.ref new file mode 100644 index 0000000000000000000000000000000000000000..8349936a423217f0b26dc0d4d3dcee578b5c439e --- /dev/null +++ b/tests/ref/test-0.ref @@ -0,0 +1,3 @@ +[===Results===] +0 RR.........RRRR______________ +1 ..RRRRRRRRR__________________ diff --git a/tests/ref/test-1.ref b/tests/ref/test-1.ref new file mode 100644 index 0000000000000000000000000000000000000000..3a7a5da3951b162d51ca63404d9ca2237155849a --- /dev/null +++ b/tests/ref/test-1.ref @@ -0,0 +1,3 @@ +[===Results===] +0 RRRRRRRRRRR__________________ +1 ...........RRRRRRRRR_________ diff --git a/tests/ref/test-2.ref b/tests/ref/test-2.ref new file mode 100644 index 0000000000000000000000000000000000000000..0733b0a478777cf54df9b8ef44cf371dd952baf6 --- /dev/null +++ b/tests/ref/test-2.ref @@ -0,0 +1,4 @@ +[===Results===] +0 RRRRRRRRRRR__________________ +1 ...........R....RRRRRRRR_____ +2 ............RRRR_____________ diff --git a/tests/ref/test-3.ref b/tests/ref/test-3.ref new file mode 100644 index 0000000000000000000000000000000000000000..05dab0bbadcb4d162cfff22b9a51d8d11df580dd --- /dev/null +++ b/tests/ref/test-3.ref @@ -0,0 +1,4 @@ +[===Results===] +0 RRRRRRRRRR___________________ +1 ..RRRRRRRRRRRRRR_____________ +2 ............RRRR_____________ diff --git a/tests/ref/test-4.ref b/tests/ref/test-4.ref new file mode 100644 index 0000000000000000000000000000000000000000..88529a0a6c83971f9178d6cfac77427b08e53a6a --- /dev/null +++ b/tests/ref/test-4.ref @@ -0,0 +1,11 @@ +[===Results===] +0 RRRRRRRRRRRRRRRRRRR__________ +1 .RRRRRRRRRRRRRRRR____________ +2 ...RRRRRRRRRRRRRR____________ +3 ....RRR______________________ +4 .......RRR___________________ +5 ........RR___________________ +6 ..........RRRR_______________ +7 ...........RRR_______________ +8 ..............RRR____________ +9 ..............RR_____________ diff --git a/tests/ref/test-5.ref b/tests/ref/test-5.ref new file mode 100644 index 0000000000000000000000000000000000000000..d62d42c41c47f98afc086f59d1670ab9022a764c --- /dev/null +++ b/tests/ref/test-5.ref @@ -0,0 +1,11 @@ +[===Results===] +0 RRRRRRRRRRRRRRRRRRR__________ +1 .RRRRRRRRRRRRR..RRR__________ +2 ...RRRRR..RRRRRRRRR__________ +3 ....RRR______________________ +4 .......RRR___________________ +5 ........RR___________________ +6 ..........RRRR_______________ +7 ...........RRR_______________ +8 ..............RRR____________ +9 ..............RR_____________ diff --git a/tests/ref/test-6.ref b/tests/ref/test-6.ref new file mode 100644 index 0000000000000000000000000000000000000000..c51838a636e3e91a6383a6354bae2133f921ec8f --- /dev/null +++ b/tests/ref/test-6.ref @@ -0,0 +1,11 @@ +[===Results===] +0 RRRRRRRRRRRRRRRRRRR__________ +1 .RRRRRRRRRR.RR..RRRR_________ +2 ...RRRRR..R.RR.RRRRRR________ +3 ....RRR______________________ +4 .......RRRRR_________________ +5 ........RR___________________ +6 ..........R.RR..R____________ +7 ...........RRR_______________ +8 ..............RRR____________ +9 ..............RR_____________ diff --git a/tests/ref/test-7.ref b/tests/ref/test-7.ref new file mode 100644 index 0000000000000000000000000000000000000000..9890c22dc8470deedcaf31a38468900906fc9ae0 --- /dev/null +++ b/tests/ref/test-7.ref @@ -0,0 +1,6 @@ +[===Results===] +0 RRRRRR...........RRRRR_______ +1 ..RRRR.........RRRRRRR_______ +2 ....RR.........R.RRRRRRRR____ +3 ......RRRRRRRRRRR____________ +4 ......RRRRRRRRR______________ diff --git a/tests/ref/test-8.ref b/tests/ref/test-8.ref new file mode 100644 index 0000000000000000000000000000000000000000..e6630117c49f2303311b5f9a9acf21e998fa7905 --- /dev/null +++ b/tests/ref/test-8.ref @@ -0,0 +1,5 @@ +[===Results===] +0 RRRRRR.......RRRRR___________ +1 ..RRRRRRRRRRR________________ +2 ....RR.R.R.R.RRRRRR__________ +3 ......RRRRRRRRRRR____________ diff --git a/tests/ref/test-9.ref b/tests/ref/test-9.ref new file mode 100644 index 0000000000000000000000000000000000000000..d050c90f4e6a26b5ae489cebef44cf6db40b9e59 --- /dev/null +++ b/tests/ref/test-9.ref @@ -0,0 +1,7 @@ +[===Results===] +0 RRRRRRRRRRRR..R.......RR_____ +1 ..RRRRRRRRRR.R.R......RR_____ +2 ............R........RRR_____ +3 .............RRR_____________ +4 ................RRRRR________ +5 ..........RRR...RRRRRR_______ diff --git a/tests/test-sched.sh b/tests/test-sched.sh new file mode 100755 index 0000000000000000000000000000000000000000..9c2fe0d5abb041832ec0c4cb60f7d4763a59bf9e --- /dev/null +++ b/tests/test-sched.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +# Change this line to your tail command from GNU (that accepts tail -n +linenumber) +#TAIL=/opt/homebrew/bin/gtail # for MacOS with brew install coreutils +TAIL=/usr/bin/tail # on Linux distribution + + +# Change this to point to your sched executable or you will have to pass it +# as 1st parameter on the command line +EXEC=../build/sched +if [ $# -eq 1 ]; then + EXEC=$1 +fi + +PATTERN="===Results===" +DATA_IN="in" +DATA_REF="ref" +DATA_OUT="out" +mkdir -p $DATA_OUT + +echo "* Using executable ${EXEC}" + + +COMMENT_CHAR="#" +RED='\033[0;31m' +GREEN='\033[0;32m' +BLUE='\033[0;34m' +YELLOW='\033[0;33m' +NC='\033[0m' # No Color + +IN_EXT=".in" +test_files=$DATA_IN/*$IN_EXT +echo $test_files + +for test_in in $test_files +do + t=$(basename $test_in $IN_EXT) + printf "* Testing $t ..." + input="$DATA_IN/$t$IN_EXT" + output="$DATA_OUT/$t.out" + output_res="$DATA_OUT/$t.res" + ref="$DATA_REF/$t.ref" + $EXEC < $input > $output + nl=$(grep -n $PATTERN < $output | cut -f1 -d':') + if [ -z "$nl" ]; then + printf " [${RED}*Error: could not fid patern \"$PATTERN\" in $output${NC}]\n" + exit 1 + fi + $TAIL -n +$nl < $output > $output_res + res_diff=$(diff -y $ref $output_res) + if [ -z "$res_diff" ]; then + printf " ${GREEN}OK${NC}\n" + else + printf "${RED}NOK${NC}\n" + printf "* diff reference you \n$res_diff${NC}\n\n" + + fi +done +exit 0 \ No newline at end of file