diff --git a/ASST1/basic/condition-variable-sy3 b/ASST1/basic/condition-variable-sy3 new file mode 100644 index 0000000000000000000000000000000000000000..0534e493a2c3eb8269c98f8a5d55ab9f1e394197 --- /dev/null +++ b/ASST1/basic/condition-variable-sy3 @@ -0,0 +1 @@ +sy3;q diff --git a/ASST1/basic/locktest-sy2 b/ASST1/basic/locktest-sy2 new file mode 100644 index 0000000000000000000000000000000000000000..bf7ee4ff1b18fa670d7c8701fa5b747ab4c0afd8 --- /dev/null +++ b/ASST1/basic/locktest-sy2 @@ -0,0 +1 @@ +sy2;q diff --git a/ASST1/basic/locktest-uw1 b/ASST1/basic/locktest-uw1 new file mode 100644 index 0000000000000000000000000000000000000000..e64ff9400a20a210dba3f2010f4c9cc753fe917f --- /dev/null +++ b/ASST1/basic/locktest-uw1 @@ -0,0 +1 @@ +uw1;q diff --git a/ASST1/custom.conf b/ASST1/custom.conf new file mode 100644 index 0000000000000000000000000000000000000000..06b08c6711a0eee6a32ebe72d2c22f617fcfba2e --- /dev/null +++ b/ASST1/custom.conf @@ -0,0 +1,135 @@ +# Sample sys161.conf file +# +# This file tells System/161 what devices to use. +# +# There are 32 LAMEbus slots on the System/161 motherboard. There may +# be only one bus controller card, and it must go in slot 31. Other +# than that, you can put in whatever devices you want. +# +# The syntax is simple: one slot per line; the slot number goes first, +# then the expansion card name, then any arguments. Some of the devices +# have required arguments. +# +# The devices are: +# +# mainboard The multiprocessor LAMEbus controller card. Must go in +# slot 31, and only in slot 31. Required argument +# "ramsize=NUMBER" specifies the amount of physical RAM in +# the system. This amount must be a multiple of the +# hardware page size (which is probably 4096 or 8192.) The +# maximum amount of RAM allowed is 16M; this restriction +# is meant as a sanity check and can be altered by +# recompiling System/161. The argument "cpus=NUMBER" +# selects the number of CPUs; the default is 1 and the +# maximum 32. +# +# oldmainboard The uniprocessor LAMEbus controller card, fully +# backwards compatible with OS/161 1.x. In general, +# uniprocessor kernels should nonetheless work on the +# multiprocessor mainboard; therefore this device will +# probably be removed in the future. Configuration is the +# same as the multiprocessor mainboard, except that the +# "cpus" argument is not accepted. The OS/161 1.x name +# "busctl" is an alias for "oldmainboard". +# +# trace The System/161 trace controller device. This can be used +# by software for various debugging purposes. You can have +# more than one trace card, but they all manipulate the +# same internal state. No arguments. +# +# timer Countdown timer. The timer card also contains a real-time +# clock and a small speaker for beeping. Most configurations +# will include at least one timer. No arguments. +# +# serial Serial port. This is connected to the standard input and +# standard output of the System/161 process, and serves as +# the system console. Most configurations need this. There +# is no support at present for more than one serial port. +# No arguments. +# +# screen Full-screen memory-mapped text video card. This is +# connected to the standard input and standard output of +# the System/161 process, and serves as the system console. +# There is no support at present for more than one screen. +# Likewise, at present you may not use "screen" and "serial" +# together. No arguments. NOTE: not presently implemented. +# +# random (Pseudo-)random number generator. This accesses the +# randomizer state within System/161; thus, while you can +# add multiple random cards, they all return values from the +# same pseudorandom sequence. The random seed is set by +# using either the "seed=NUMBER" argument, which sets the +# random seed to a specified value, or the "autoseed" +# argument, which sets the random seed based on the host +# system clock. If neither argument is given or no random +# device is used, the seed is set to 0. Note that the seed +# affects various randomized behavior of the system as well +# as the values provided by the random device. +# +# disk Fixed disk. The options are as follows: +# rpm=NUMBER Set spin rate of disk. +# sectors=NUMBER Set disk size. Each sector is 512 bytes. +# file=PATH Specify file to use as storage for disk. +# paranoid Set paranoid mode. +# +# The "file=PATH" argument must be supplied. The size must be +# at least 128 sectors (64k), and the RPM setting must be a +# multiple of 60. +# +# The "paranoid" argument, if given, causes fsync() to be +# called on every disk write to make sure the data written +# reaches actual stable storage. This will make things very +# slow. +# +# You can have as many disks as you want (until you run out +# of slots) but each should have a distinct file to use for +# storage. Most common setups will use two separate disks, +# one for filesystem storage and one for swapping. +# +# nic Network card. This allows communication among multiple +# simultaneously-running copies of System/161. The arguments +# are: +# hub=PATH Give the path to the hub socket. +# hwaddr=NUMBER Specify the hardware-level card address. +# +# The hub socket path should be the argument supplied to the +# hub161 program. The default is ".sockets/hub". +# +# The hardware address should be unique among the systems +# connected to the same hub. It should be an integer between +# 1 and 65534. Values 0 and 65535 are reserved for special +# purposes. This argument is required. +# +# NOTE: disable (comment out) nic devices if you aren't +# actively using them, to avoid unnecessary overhead. +# +# emufs Emulator filesystem. This provides access *within* +# System/161 to the filesystem that System/161 is running +# in. There is one optional argument, "dir=PATH". The path +# specified is used as the root of the filesystem provided +# by emufs. (Note that it is possible to access the real +# parent of this root and thus any other directory; this +# argument does not restrict access.) The default path is +# ".", meaning System/161's own current directory. +# + +# +# Here is a suggested default configuration: 512k RAM, two 5M disks. +# + +0 serial +#0 screen + +1 emufs + +2 disk rpm=7200 sectors=10240 file=DISK1.img +3 disk rpm=7200 sectors=10240 file=DISK2.img + +#27 nic hwaddr=1 + +28 random autoseed +29 timer +30 trace +31 mainboard ramsize=4194304 cpus=1 +#31 mainboard ramsize=524288 cpus=2 +#31 mainboard ramsize=524288 cpus=4 diff --git a/ASST1/custom_0.conf b/ASST1/custom_0.conf new file mode 100644 index 0000000000000000000000000000000000000000..06b08c6711a0eee6a32ebe72d2c22f617fcfba2e --- /dev/null +++ b/ASST1/custom_0.conf @@ -0,0 +1,135 @@ +# Sample sys161.conf file +# +# This file tells System/161 what devices to use. +# +# There are 32 LAMEbus slots on the System/161 motherboard. There may +# be only one bus controller card, and it must go in slot 31. Other +# than that, you can put in whatever devices you want. +# +# The syntax is simple: one slot per line; the slot number goes first, +# then the expansion card name, then any arguments. Some of the devices +# have required arguments. +# +# The devices are: +# +# mainboard The multiprocessor LAMEbus controller card. Must go in +# slot 31, and only in slot 31. Required argument +# "ramsize=NUMBER" specifies the amount of physical RAM in +# the system. This amount must be a multiple of the +# hardware page size (which is probably 4096 or 8192.) The +# maximum amount of RAM allowed is 16M; this restriction +# is meant as a sanity check and can be altered by +# recompiling System/161. The argument "cpus=NUMBER" +# selects the number of CPUs; the default is 1 and the +# maximum 32. +# +# oldmainboard The uniprocessor LAMEbus controller card, fully +# backwards compatible with OS/161 1.x. In general, +# uniprocessor kernels should nonetheless work on the +# multiprocessor mainboard; therefore this device will +# probably be removed in the future. Configuration is the +# same as the multiprocessor mainboard, except that the +# "cpus" argument is not accepted. The OS/161 1.x name +# "busctl" is an alias for "oldmainboard". +# +# trace The System/161 trace controller device. This can be used +# by software for various debugging purposes. You can have +# more than one trace card, but they all manipulate the +# same internal state. No arguments. +# +# timer Countdown timer. The timer card also contains a real-time +# clock and a small speaker for beeping. Most configurations +# will include at least one timer. No arguments. +# +# serial Serial port. This is connected to the standard input and +# standard output of the System/161 process, and serves as +# the system console. Most configurations need this. There +# is no support at present for more than one serial port. +# No arguments. +# +# screen Full-screen memory-mapped text video card. This is +# connected to the standard input and standard output of +# the System/161 process, and serves as the system console. +# There is no support at present for more than one screen. +# Likewise, at present you may not use "screen" and "serial" +# together. No arguments. NOTE: not presently implemented. +# +# random (Pseudo-)random number generator. This accesses the +# randomizer state within System/161; thus, while you can +# add multiple random cards, they all return values from the +# same pseudorandom sequence. The random seed is set by +# using either the "seed=NUMBER" argument, which sets the +# random seed to a specified value, or the "autoseed" +# argument, which sets the random seed based on the host +# system clock. If neither argument is given or no random +# device is used, the seed is set to 0. Note that the seed +# affects various randomized behavior of the system as well +# as the values provided by the random device. +# +# disk Fixed disk. The options are as follows: +# rpm=NUMBER Set spin rate of disk. +# sectors=NUMBER Set disk size. Each sector is 512 bytes. +# file=PATH Specify file to use as storage for disk. +# paranoid Set paranoid mode. +# +# The "file=PATH" argument must be supplied. The size must be +# at least 128 sectors (64k), and the RPM setting must be a +# multiple of 60. +# +# The "paranoid" argument, if given, causes fsync() to be +# called on every disk write to make sure the data written +# reaches actual stable storage. This will make things very +# slow. +# +# You can have as many disks as you want (until you run out +# of slots) but each should have a distinct file to use for +# storage. Most common setups will use two separate disks, +# one for filesystem storage and one for swapping. +# +# nic Network card. This allows communication among multiple +# simultaneously-running copies of System/161. The arguments +# are: +# hub=PATH Give the path to the hub socket. +# hwaddr=NUMBER Specify the hardware-level card address. +# +# The hub socket path should be the argument supplied to the +# hub161 program. The default is ".sockets/hub". +# +# The hardware address should be unique among the systems +# connected to the same hub. It should be an integer between +# 1 and 65534. Values 0 and 65535 are reserved for special +# purposes. This argument is required. +# +# NOTE: disable (comment out) nic devices if you aren't +# actively using them, to avoid unnecessary overhead. +# +# emufs Emulator filesystem. This provides access *within* +# System/161 to the filesystem that System/161 is running +# in. There is one optional argument, "dir=PATH". The path +# specified is used as the root of the filesystem provided +# by emufs. (Note that it is possible to access the real +# parent of this root and thus any other directory; this +# argument does not restrict access.) The default path is +# ".", meaning System/161's own current directory. +# + +# +# Here is a suggested default configuration: 512k RAM, two 5M disks. +# + +0 serial +#0 screen + +1 emufs + +2 disk rpm=7200 sectors=10240 file=DISK1.img +3 disk rpm=7200 sectors=10240 file=DISK2.img + +#27 nic hwaddr=1 + +28 random autoseed +29 timer +30 trace +31 mainboard ramsize=4194304 cpus=1 +#31 mainboard ramsize=524288 cpus=2 +#31 mainboard ramsize=524288 cpus=4 diff --git a/ASST1/custom_1.conf b/ASST1/custom_1.conf new file mode 100644 index 0000000000000000000000000000000000000000..10b9c6410b0da0c1a89abeb604c18d05177d2997 --- /dev/null +++ b/ASST1/custom_1.conf @@ -0,0 +1,135 @@ +# Sample sys161.conf file +# +# This file tells System/161 what devices to use. +# +# There are 32 LAMEbus slots on the System/161 motherboard. There may +# be only one bus controller card, and it must go in slot 31. Other +# than that, you can put in whatever devices you want. +# +# The syntax is simple: one slot per line; the slot number goes first, +# then the expansion card name, then any arguments. Some of the devices +# have required arguments. +# +# The devices are: +# +# mainboard The multiprocessor LAMEbus controller card. Must go in +# slot 31, and only in slot 31. Required argument +# "ramsize=NUMBER" specifies the amount of physical RAM in +# the system. This amount must be a multiple of the +# hardware page size (which is probably 4096 or 8192.) The +# maximum amount of RAM allowed is 16M; this restriction +# is meant as a sanity check and can be altered by +# recompiling System/161. The argument "cpus=NUMBER" +# selects the number of CPUs; the default is 1 and the +# maximum 32. +# +# oldmainboard The uniprocessor LAMEbus controller card, fully +# backwards compatible with OS/161 1.x. In general, +# uniprocessor kernels should nonetheless work on the +# multiprocessor mainboard; therefore this device will +# probably be removed in the future. Configuration is the +# same as the multiprocessor mainboard, except that the +# "cpus" argument is not accepted. The OS/161 1.x name +# "busctl" is an alias for "oldmainboard". +# +# trace The System/161 trace controller device. This can be used +# by software for various debugging purposes. You can have +# more than one trace card, but they all manipulate the +# same internal state. No arguments. +# +# timer Countdown timer. The timer card also contains a real-time +# clock and a small speaker for beeping. Most configurations +# will include at least one timer. No arguments. +# +# serial Serial port. This is connected to the standard input and +# standard output of the System/161 process, and serves as +# the system console. Most configurations need this. There +# is no support at present for more than one serial port. +# No arguments. +# +# screen Full-screen memory-mapped text video card. This is +# connected to the standard input and standard output of +# the System/161 process, and serves as the system console. +# There is no support at present for more than one screen. +# Likewise, at present you may not use "screen" and "serial" +# together. No arguments. NOTE: not presently implemented. +# +# random (Pseudo-)random number generator. This accesses the +# randomizer state within System/161; thus, while you can +# add multiple random cards, they all return values from the +# same pseudorandom sequence. The random seed is set by +# using either the "seed=NUMBER" argument, which sets the +# random seed to a specified value, or the "autoseed" +# argument, which sets the random seed based on the host +# system clock. If neither argument is given or no random +# device is used, the seed is set to 0. Note that the seed +# affects various randomized behavior of the system as well +# as the values provided by the random device. +# +# disk Fixed disk. The options are as follows: +# rpm=NUMBER Set spin rate of disk. +# sectors=NUMBER Set disk size. Each sector is 512 bytes. +# file=PATH Specify file to use as storage for disk. +# paranoid Set paranoid mode. +# +# The "file=PATH" argument must be supplied. The size must be +# at least 128 sectors (64k), and the RPM setting must be a +# multiple of 60. +# +# The "paranoid" argument, if given, causes fsync() to be +# called on every disk write to make sure the data written +# reaches actual stable storage. This will make things very +# slow. +# +# You can have as many disks as you want (until you run out +# of slots) but each should have a distinct file to use for +# storage. Most common setups will use two separate disks, +# one for filesystem storage and one for swapping. +# +# nic Network card. This allows communication among multiple +# simultaneously-running copies of System/161. The arguments +# are: +# hub=PATH Give the path to the hub socket. +# hwaddr=NUMBER Specify the hardware-level card address. +# +# The hub socket path should be the argument supplied to the +# hub161 program. The default is ".sockets/hub". +# +# The hardware address should be unique among the systems +# connected to the same hub. It should be an integer between +# 1 and 65534. Values 0 and 65535 are reserved for special +# purposes. This argument is required. +# +# NOTE: disable (comment out) nic devices if you aren't +# actively using them, to avoid unnecessary overhead. +# +# emufs Emulator filesystem. This provides access *within* +# System/161 to the filesystem that System/161 is running +# in. There is one optional argument, "dir=PATH". The path +# specified is used as the root of the filesystem provided +# by emufs. (Note that it is possible to access the real +# parent of this root and thus any other directory; this +# argument does not restrict access.) The default path is +# ".", meaning System/161's own current directory. +# + +# +# Here is a suggested default configuration: 512k RAM, two 5M disks. +# + +0 serial +#0 screen + +1 emufs + +2 disk rpm=7200 sectors=10240 file=DISK1.img +3 disk rpm=7200 sectors=10240 file=DISK2.img + +#27 nic hwaddr=1 + +28 random autoseed +29 timer +30 trace +31 mainboard ramsize=4194304 cpus=2 +#31 mainboard ramsize=524288 cpus=2 +#31 mainboard ramsize=524288 cpus=4 diff --git a/ASST1/custom_2.conf b/ASST1/custom_2.conf new file mode 100644 index 0000000000000000000000000000000000000000..b0b70dd09c849759fa473f48f195cad322011aa1 --- /dev/null +++ b/ASST1/custom_2.conf @@ -0,0 +1,135 @@ +# Sample sys161.conf file +# +# This file tells System/161 what devices to use. +# +# There are 32 LAMEbus slots on the System/161 motherboard. There may +# be only one bus controller card, and it must go in slot 31. Other +# than that, you can put in whatever devices you want. +# +# The syntax is simple: one slot per line; the slot number goes first, +# then the expansion card name, then any arguments. Some of the devices +# have required arguments. +# +# The devices are: +# +# mainboard The multiprocessor LAMEbus controller card. Must go in +# slot 31, and only in slot 31. Required argument +# "ramsize=NUMBER" specifies the amount of physical RAM in +# the system. This amount must be a multiple of the +# hardware page size (which is probably 4096 or 8192.) The +# maximum amount of RAM allowed is 16M; this restriction +# is meant as a sanity check and can be altered by +# recompiling System/161. The argument "cpus=NUMBER" +# selects the number of CPUs; the default is 1 and the +# maximum 32. +# +# oldmainboard The uniprocessor LAMEbus controller card, fully +# backwards compatible with OS/161 1.x. In general, +# uniprocessor kernels should nonetheless work on the +# multiprocessor mainboard; therefore this device will +# probably be removed in the future. Configuration is the +# same as the multiprocessor mainboard, except that the +# "cpus" argument is not accepted. The OS/161 1.x name +# "busctl" is an alias for "oldmainboard". +# +# trace The System/161 trace controller device. This can be used +# by software for various debugging purposes. You can have +# more than one trace card, but they all manipulate the +# same internal state. No arguments. +# +# timer Countdown timer. The timer card also contains a real-time +# clock and a small speaker for beeping. Most configurations +# will include at least one timer. No arguments. +# +# serial Serial port. This is connected to the standard input and +# standard output of the System/161 process, and serves as +# the system console. Most configurations need this. There +# is no support at present for more than one serial port. +# No arguments. +# +# screen Full-screen memory-mapped text video card. This is +# connected to the standard input and standard output of +# the System/161 process, and serves as the system console. +# There is no support at present for more than one screen. +# Likewise, at present you may not use "screen" and "serial" +# together. No arguments. NOTE: not presently implemented. +# +# random (Pseudo-)random number generator. This accesses the +# randomizer state within System/161; thus, while you can +# add multiple random cards, they all return values from the +# same pseudorandom sequence. The random seed is set by +# using either the "seed=NUMBER" argument, which sets the +# random seed to a specified value, or the "autoseed" +# argument, which sets the random seed based on the host +# system clock. If neither argument is given or no random +# device is used, the seed is set to 0. Note that the seed +# affects various randomized behavior of the system as well +# as the values provided by the random device. +# +# disk Fixed disk. The options are as follows: +# rpm=NUMBER Set spin rate of disk. +# sectors=NUMBER Set disk size. Each sector is 512 bytes. +# file=PATH Specify file to use as storage for disk. +# paranoid Set paranoid mode. +# +# The "file=PATH" argument must be supplied. The size must be +# at least 128 sectors (64k), and the RPM setting must be a +# multiple of 60. +# +# The "paranoid" argument, if given, causes fsync() to be +# called on every disk write to make sure the data written +# reaches actual stable storage. This will make things very +# slow. +# +# You can have as many disks as you want (until you run out +# of slots) but each should have a distinct file to use for +# storage. Most common setups will use two separate disks, +# one for filesystem storage and one for swapping. +# +# nic Network card. This allows communication among multiple +# simultaneously-running copies of System/161. The arguments +# are: +# hub=PATH Give the path to the hub socket. +# hwaddr=NUMBER Specify the hardware-level card address. +# +# The hub socket path should be the argument supplied to the +# hub161 program. The default is ".sockets/hub". +# +# The hardware address should be unique among the systems +# connected to the same hub. It should be an integer between +# 1 and 65534. Values 0 and 65535 are reserved for special +# purposes. This argument is required. +# +# NOTE: disable (comment out) nic devices if you aren't +# actively using them, to avoid unnecessary overhead. +# +# emufs Emulator filesystem. This provides access *within* +# System/161 to the filesystem that System/161 is running +# in. There is one optional argument, "dir=PATH". The path +# specified is used as the root of the filesystem provided +# by emufs. (Note that it is possible to access the real +# parent of this root and thus any other directory; this +# argument does not restrict access.) The default path is +# ".", meaning System/161's own current directory. +# + +# +# Here is a suggested default configuration: 512k RAM, two 5M disks. +# + +0 serial +#0 screen + +1 emufs + +2 disk rpm=7200 sectors=10240 file=DISK1.img +3 disk rpm=7200 sectors=10240 file=DISK2.img + +#27 nic hwaddr=1 + +28 random autoseed +29 timer +30 trace +31 mainboard ramsize=4194304 cpus=4 +#31 mainboard ramsize=524288 cpus=2 +#31 mainboard ramsize=524288 cpus=4 diff --git a/ASST1/hidden b/ASST1/hidden new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/ASST1/public b/ASST1/public new file mode 100644 index 0000000000000000000000000000000000000000..a33764e0c569d67189d2ff15d573785fc965325c --- /dev/null +++ b/ASST1/public @@ -0,0 +1 @@ +p uw-testbin/pidcheck;q diff --git a/ASST1/run.sh b/ASST1/run.sh new file mode 100755 index 0000000000000000000000000000000000000000..d08c342eb576a83030ee667d0fd1477fa070ae79 --- /dev/null +++ b/ASST1/run.sh @@ -0,0 +1,45 @@ +#!/bin/bash +source /helpers.sh + +LOG=$LOGS/test_public.log +COMPILE=$LOGS/compile.log +ASSIGNMENTDIR=/assignments/ASST1/ + +touch $COMPILE +truncate -s 0 $COMPILE + +if [ ! -d /kernel ]; +then + unpack_kernel >> $COMPILE 2>> $COMPILE +fi + +echo "[CS350] Building Kernel" + +build_kernel ASST1 >> $COMPILE 2>> $COMPILE + +touch $LOG +truncate -s 0 $LOG + +cd /os-compile +echo "[CS350] Testing ASST1" + +for c in $ASSIGNMENTDIR/custom_*.conf +do + for f in $ASSIGNMENTDIR/basic/* + do + echo ">SPLIT<" >> $LOG + cname=$(basename -s .conf $c) + fname=$(basename $f) + echo ">TEST=${fname}_${cname}<" >> $LOG + echo ">Program Output<" >> $LOG + P=$(cat $f) + timeout --foreground 60s sys161 -c $c kernel "$P" >> $LOG 2>> $LOG + #timeout --foreground 60s sys161 -c $ASSIGNMENTDIR/custom.conf kernel "$P" >> $LOG 2>> $LOG + if [ $? -eq 124 ]; + then + echo "$P has timed out after 60s, this should not occur. Most likely a deadlock" + fi + done +done + +exit 0 diff --git a/ASST1/verify.py b/ASST1/verify.py new file mode 100644 index 0000000000000000000000000000000000000000..6a2b9fbbae75e793c3a4d4b0c989856bb651d2bc --- /dev/null +++ b/ASST1/verify.py @@ -0,0 +1,91 @@ +def sy2(tests, helpers): + grade = 0 + cmts = set() + mytests = [t for t in tests if "sy2" in t.name] + assert len(mytests) == 3 + for test in mytests: + try: + res = test.results().split('\n') + i = res.index("OS/161 kernel: sy2") + + if "Operation took" in res[i+1]: + cmts.add("The output of sy2 is empty.") + + elif "Operation took" in res[i+4]: + if "lock test done" in str(res[i+3]).lower(): + grade += 2 + else: + cmts.add("The output of sy2 is wrong:") + cmts.add(res[i+1]) + else: + cmts.add("The output of sy2 is too long or incorrect.") + except Exception as e: + cmts.add("Cannot parse assignment log - likely an error in your assignment") + + return ("Test sy2", grade, ",".join(cmts)) + +def sy3(tests, helpers): + grade = 0 + cmts = set() + mytests = [t for t in tests if "sy3" in t.name] + assert len(mytests) == 3 + for test in mytests: + try: + res = test.results().split('\n') + i = res.index("OS/161 kernel: sy3") + end = res.index("CV test done") + + if "Operation took" in res[i+1]: + cmts.add("The output of sy3 is empty.") + + elif "CV test done" in res: + counter = 31 + iterations = 5 + for entry in res[i+3:end-1]: + if int(entry.lower().split()[1]) == counter: + counter-=1 + + if counter == 0: + counter = 31 + iterations-=1 + + if iterations == 0: + grade+=2 + else: + cmts.add("The output of sy3 is incorrect.") + + except Exception as e: + cmts.add("Cannot parse assignment log - likely an error in your assignment") + + return ("Test sy3", grade, ",".join(cmts)) + +def uw1(tests, helpers): + grade = 0 + cmts = set() + mytests = [t for t in tests if "uw1" in t.name] + assert len(mytests) == 3 + for test in mytests: + try: + res = test.results().split('\n') + i = res.index("OS/161 kernel: uw1") + + if "Operation took" in res[i+1]: + cmts.add("The output of uw1 is empty.") + elif "Operation took" in res[i+6]: + if "test succeeded" in str(res[i+3]).lower(): + grade += 2 + else: + cmts.add("The output of uw1 is wrong:") + else: + cmts.add("The output of uw1 is too long or incorrect.") + + except Exception as e: + cmts.add("Cannot parse assignment log - likely an error in your assignment") + + return ("Test uw1", grade, ",".join(cmts)) + +RUBRIC = { + sy2: 6, + sy3: 6, + uw1: 6, +} diff --git a/ASSTUSER2/basic/a1q1.py b/ASSTUSER2/basic/a1q1.py new file mode 100644 index 0000000000000000000000000000000000000000..1089695a76123b95e8ce3fa17a56d4434f4dc3f1 --- /dev/null +++ b/ASSTUSER2/basic/a1q1.py @@ -0,0 +1,96 @@ +import sys +import random +import os + +#get the first argument as input +inputFileName = sys.argv[1] + +#contains the sumtotal +sumTotal = 0 + +#contains the number of articles and threads to generate +numarticles = [20, 30, 40] +numThreads = [4, 8] + +#make the files +#os.system("make > /dev/null") + +checks = 0 + +#get current path +#systemPath = "/".join(inputFileName.split("/")[0:-1]) + +#open the temp file +file = open("temp.txt", 'w+') + +#check if the file being called exists +if not os.path.exists(inputFileName) : + print("ERROR: the file %s does not exist" % inputFileName) +#END IF + +output = [] + +#for the number of articles and threads to test +for article in numarticles : + for thread in numThreads : + + #save the seed generated + seed = str(random.randint(1, 100)) + + #run the command and capture stderr output + resultValue = os.system(inputFileName + " " + str(article) + " " + seed + " " + str(thread) + " 2> temp.txt > /dev/null") + + #check if the resulting funnction fails + if resultValue != 0 : + buffer = "Test: article (%d), seed (%s), thread (%d) fails" % (article, seed, thread) + continue + else : + checks += 1 + #END IF + + #counts the number of iterations in the check + iteration = 0 + + #set default success message + buffer = "Test: article (%d), seed (%s), thread (%d) passes" % (article, seed, thread) + + #for each line of error code + for line in file : + #iterate the counter + iteration += 1 + + #if we are at the final line of the output + if iteration == 3 : + #if the multithreaded segment fails + if line.strip() == "ERROR: Please fix any bottlenecks in the code." : + checks -= 0.5 + buffer = "Test: article (%d), seed (%s), thread (%d) fails multithreading test" % (article, seed, thread) + #if the single threaded segment fails + elif line.strip() == "ERROR: Please check for race conditions or other bugs." : + checks -= 1 + buffer = "Test: article (%d), seed (%s), thread (%d) fails single threaded test" % (article, seed, thread) + #END IF + #END IF + #END FOR + + #append the data to the buffer + output.append(buffer) + + #close the file + file.close() + + #destroy the temp file + os.system("rm temp.txt") + + #open the temp file + file = open("temp.txt", 'w+') + #END FOR +#END FOR + +#output the final score +output.append("Total Score is as follows: %d/6" % checks) + +#output the results table +for element in output : + print(element) +#END FOR diff --git a/ASSTUSER2/basic/a1q2.py b/ASSTUSER2/basic/a1q2.py new file mode 100644 index 0000000000000000000000000000000000000000..9111e580535fd4d719c0e7d3446a7ea117aadbef --- /dev/null +++ b/ASSTUSER2/basic/a1q2.py @@ -0,0 +1,88 @@ +import sys +import random +import os + +#get the first argument as input +inputFileName = sys.argv[1] + +#contains the sumtotal +sumTotal = 0 + +#contains the number of articals and threads to generate +numConsumers = [10, 20] +numProducers = [5, 10] +numRatio = [4] + +#make the files +#os.system("make > /dev/null") +checks = 0 + +#get current path +systemPath = "/".join(inputFileName.split("/")[0:-1]) + +#open the temp file +file = open(systemPath + "/temp.txt", 'w+') + +output = [] + +#check if the file being called exists +if not os.path.exists(inputFileName) : + print("ERROR: the file %s does not exist" % inputFileName) +#END IF + +#for the number of articals and threads to test +for consumer in numConsumers : + for producer in numProducers : + for ratio in numRatio : + #run the command and capture stderr output + resultValue = os.system(inputFileName + " " + str(consumer) + " " + str(producer) + " " + str(ratio) + " 2> temp.txt > /dev/null") + + #check if the resulting funnction fails + if resultValue != 0 : + buffer = "Test: consumers (%d), producers (%d), ratio (%d) fails" % (consumer, producer, ratio) + continue + else : + checks += 1.5 + #END IF + + #counts the number of iterations in the check + iteration = 0 + + #set default success message + buffer = "Test: consumers (%d), producers (%d), ratio (%d) passes" % (consumer, producer, ratio) + + #for each line of error code + for line in file : + #if the multithreaded segment fails + if line.strip() == "Failed to acquire resource" : + checks -= 1.5 + buffer = "Test: consumers (%d), producers (%d), ratio (%d) fails resource setup" % (consumer, producer, ratio) + #if the single threaded segment fails + elif line.strip() == "Failed to set up threads" : + checks -= 0.75 + buffer = "Test: consumers (%d), producers (%d), ratio (%d) fails threaded setup" % (consumer, producer, ratio) + #END IF + #END FOR + + #append the data to the buffer + output.append(buffer) + + #close the file + file.close() + + #destroy the temp file + os.system("rm temp.txt") + + #open the temp file + file = open(systemPath + "temp.txt", 'w+') + #END FOR + #END FOR +#END FOR + +#output the final score +output.append("Total Score is as follows: %d/6" % checks) + +#output the results table +for element in output : + print(element) +#END FOR diff --git a/ASSTUSER2/run.sh b/ASSTUSER2/run.sh new file mode 100755 index 0000000000000000000000000000000000000000..91448df6ba0ea6771a86eb3e1575e6a22f427291 --- /dev/null +++ b/ASSTUSER2/run.sh @@ -0,0 +1,43 @@ +#!/bin/bash +source /helpers.sh + +LOG=$LOGS/test_public.log +ASSIGNMENTDIR=/assignments/ASSTUSER2/ + +if [ ! -d /kernel ]; +then + unpack_kernel +fi + +echo "Building assignment (if no other message occurs this means it fails)" +cd /kernel +COMPILE=$LOGS/compile.log +touch $COMPILE +truncate -s 0 $COMPILE + +# Compile the assignment +(cd a1q1 && make) +(cd a1q2 && make) + +touch $LOG +truncate -s 0 $LOG +touch output.txt +truncate -s 0 output.txt +touch error.txt +truncate -s 0 error.txt + +# Go through basic tests +# In each of these we are essentially only testing commands with output to stdout +echo "Testing..." +for f in $ASSIGNMENTDIR/basic/* +do + echo ">SPLIT<" >> $LOG + cname=$(basename -s .py $f) + bname=$(basename $f) + + echo ">TEST=$bname<" >> $LOG + echo ">Program Output<" >> $LOG + python3 $f ./$cname/a.out >> $LOG 2>> $LOG +done + +exit 0 diff --git a/ASSTUSER2/verify.py b/ASSTUSER2/verify.py new file mode 100644 index 0000000000000000000000000000000000000000..257e35f582599c29b509524a4819beb4ab3fc9ac --- /dev/null +++ b/ASSTUSER2/verify.py @@ -0,0 +1,36 @@ +def a1q1(tests, helpers): + try: + grade = 0 + cmts = set() + tests = [t for t in tests if "a1q1" in t.name] + for t in tests: + # get the lines from the output + l = t.results().split("\n") + + grade = int(l[-1].split("/")[1]) + + except: + cmts.add("Cannot parse assignment log - likely an error in your assignment.") + + return ("a1q1 Tests", grade, ",".join(cmts)) + +def a1q2(tests, helpers): + try: + grade = 0 + cmts = set() + tests = [t for t in tests if "a1q2" in t.name] + for t in tests: + # get the lines from the output + l = t.results().split("\n") + + grade = int(l[-1].split("/")[1]) + + except: + cmts.add("Cannot parse assignment log - likely an error in your assignment.") + + return ("a1q2 Tests", grade, ",".join(cmts)) + +RUBRIC = { + a1q1: 6, + a1q2: 6 +}