test: add automated test bash script and test cases
Build system / Check kernel codestyle (pull_request) Successful in 1m34s
Build system / Build (pull_request) Successful in 11m17s

- add comprehensive suite of XML inputs covering standard payloads and
  edge cases
- add corresponding '.expected' files as reference output
This commit is contained in:
2026-05-13 18:51:45 +02:00
parent f43da4a635
commit 228ac4554d
19 changed files with 243 additions and 0 deletions
+70
View File
@@ -0,0 +1,70 @@
#!/bin/bash
fasm test.asm ./tests/feedflow_test
echo "Starting Test Suite..."
echo "========================================"
for expected_path in ./tests/*.expected; do
test_name=$(basename "$expected_path" .expected)
if [ "$test_name" == "test_no_params" ]; then
cmd_args='""'
elif [ "$test_name" == "test_does_not_exist" ]; then
cmd_args="/hd0/1/fake_file.xml"
else
cmd_args="/hd0/1/${test_name}.xml"
fi
cat <<EOF | sed 's/$/\r/' > ./autorun.dat
# Syntaxis is: <Program_Name> <Parameter(s)> <Delay_Time>
# Use "parameter value" for parameters with spaces. Use "" if no parameter is required.
# Delay time means how much the system should wait, before running the next line. It is measured in 1/100 seconds.
# If delay is negative, wait for termination of the spawned process. Otherwise, simply wait
#
#/SYS/CROPFLAT "XS800 YS480" 1 # set limits of screen
#/SYS/LOADDRV COMMOUSE 1 # serial mouse driver
#/SYS/DEVELOP/BOARD "" 0 # Load DEBUG board
/SYS/SETUP BOOT 0 # Load device settings
/SYS/LOADDRV RDC 0 # videodriver for RDC M2010/M2012
/SYS/@TASKBAR "" 0 # Start taskbar
/SYS/ESKIN "" 0 # Set style
/SYS/@ICON "" 0 # Multithread desktop icons
/SYS/TMPDISK A0 0 # Add virtual RAM disk /tmp0/1
/SYS/@RESHARE "" 0 # Shared resources
/SYS/LOADDRV SDHCI 0 # Start SDHCI driver
/SYS/@DOCKY "" 0 # Start docky
/SYS/NETWORK/NETCFG A 0 # Init network driver
/SYS/NETWORK/@ZEROCONF "" 0 # Network configuration
/SYS/@SS ASSM 0 # Screensaver
/SYS/@VOLUME "" 0 # Start volume daemon
/SYS/SEARCHAP "" 0 # Search and mount additional system directory
/SYS/@HA "" 0 # Start Hot Angles
### Hello, ASM World! ###
/hd0/1/feedflow_test $cmd_args 0
EOF
# flush the file to the physical disk immediately
sync
mdel -i kolibri.img ::settings/autorun.dat 2>/dev/null || true
mcopy -i kolibri.img ./autorun.dat ::settings/autorun.dat
qemu-system-i386 -m 2048 -display none -boot a \
-drive file=kolibri.img,format=raw,if=floppy \
-drive file=fat:rw:tests,format=raw
if diff -q "./tests/output.txt" "$expected_path" > /dev/null; then
echo "✅ PASS: $test_name"
else
echo "❌ FAIL: $test_name"
diff "./tests/output.txt" "$expected_path"
fi
done
echo "========================================"
echo "Testing Complete!"
rm -rf ./autorun.dat
@@ -0,0 +1,10 @@
The Noisy Feed
http://kolibrios.org/noisy
Testing alien tags
en-us
The Alien Item
http://example.com/alien
This item is surrounded by unknown tags.
Thu, 15 May 2026 10:00:00 GMT
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>The Noisy Feed</title>
<link>http://kolibrios.org/noisy</link>
<description>Testing alien tags</description>
<language>en-us</language>
<copyright>Copyright 2026</copyright>
<managingEditor>editor@example.com</managingEditor>
<image>
<url>http://kolibrios.org/logo.png</url>
<title>Logo</title>
<link>http://kolibrios.org</link>
</image>
<item>
<title>The Alien Item</title>
<author>johndoe@example.com</author>
<category domain="tech">Operating Systems</category>
<link>http://example.com/alien</link>
<description>This item is surrounded by unknown tags.</description>
<guid isPermaLink="true">http://example.com/alien/12345</guid>
<comments>http://example.com/alien/comments</comments>
<source url="http://example.com/rss">Example Source</source>
<pubDate>Thu, 15 May 2026 10:00:00 GMT</pubDate>
</item>
</channel>
</rss>
@@ -0,0 +1 @@
Error: XML Parsing Failed
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>Corrupted Feed</title>
<description>This tag never closes properly
<item>
<title>Good Title</wrongtag>
<link>http://example.com</link>
</item>
</chanel> </rss>
@@ -0,0 +1 @@
Error: Could not load the RSS file
@@ -0,0 +1 @@
No Content Found In The RSS Feed
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
</rss>
@@ -0,0 +1,7 @@
Incomplete Feed
Item with only a title
http://example.com/orphan-link
Item with no title or date.
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>Incomplete Feed</title>
<item>
<title>Item with only a title</title>
</item>
<item>
<link>http://example.com/orphan-link</link>
<description>Item with no title or date.</description>
</item>
</channel>
</rss>
@@ -0,0 +1,5 @@
KolibriOS Empty Feed
http://kolibrios.org
There are no news items today.
en-us
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>KolibriOS Empty Feed</title>
<link>http://kolibrios.org</link>
<description>There are no news items today.</description>
<language>en-us</language>
</channel>
</rss>
@@ -0,0 +1 @@
Test Error: No Parameters Provided
@@ -0,0 +1,10 @@
Scrambled Feed
http://kolibrios.org/scrambled
Testing order independence
en-us
The Out of Order Item
http://example.com/chaos
This item has its tags in completely random order.
Wed, 14 May 2026 09:00:00 GMT
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<language>en-us</language>
<description>Testing order independence</description>
<title>Scrambled Feed</title>
<link>http://kolibrios.org/scrambled</link>
<item>
<pubDate>Wed, 14 May 2026 09:00:00 GMT</pubDate>
<description>This item has its tags in completely random order.</description>
<link>http://example.com/chaos</link>
<title>The Out of Order Item</title>
</item>
</channel>
</rss>
@@ -0,0 +1,15 @@
KolibriOS Test Feed
http://kolibrios.org
Testing the RSS Feed Parser
en-us
First Test Item
http://example.com/1
This is the first test description.
Mon, 12 May 2026 12:00:00 GMT
Second Test Item
http://example.com/2
This is the second test description.
Tue, 13 May 2026 14:30:00 GMT
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>KolibriOS Test Feed</title>
<link>http://kolibrios.org</link>
<description>Testing the RSS Feed Parser</description>
<language>en-us</language>
<item>
<title>First Test Item</title>
<link>http://example.com/1</link>
<description>This is the first test description.</description>
<pubDate>Mon, 12 May 2026 12:00:00 GMT</pubDate>
</item>
<item>
<title>Second Test Item</title>
<link>http://example.com/2</link>
<description>This is the second test description.</description>
<pubDate>Tue, 13 May 2026 14:30:00 GMT</pubDate>
</item>
</channel>
</rss>
@@ -0,0 +1 @@
Error: XML Parsing Failed
@@ -0,0 +1,2 @@