Skip to content

oph5spdtst: add package - #30529

Open
AzulEterno wants to merge 2 commits into
openwrt:masterfrom
AzulEterno:oph5spdtst-submission
Open

AzulEterno wants to merge 2 commits into
openwrt:masterfrom
AzulEterno:oph5spdtst-submission

Conversation

@AzulEterno

@AzulEterno AzulEterno commented Sep 14, 2026

Copy link
Copy Markdown

Add oph5spdtst as an HTML5 speed-test payload service for OpenWrt. This base package installs the service and UCI configuration only; web assets are installed by the separate luci-app-oph5spdtst package.

Package details

Maintainer: @AzulEterno

Provides the payload service used by the oph5spdtst local HTML5 speed-test frontend.

Testing

  • Built and package-checked on ImmortalWrt 24.10, mediatek/mt7981.
  • Runtime verified on CMCC XR30 / CNIC XR30.
  • SDK CI builds IPK and APK variants for x86_64 and aarch64_generic.

Reviewed CONTRIBUTING.md. This PR contains no patches.

Comment thread net/oph5spdtst/Makefile
if [ -z "$${IPKG_INSTROOT}" ]; then
rm -f /tmp/oph5spdtst/payload.bin /tmp/oph5spdtst/payload.bin.tmp
rm -f /www/luci-static/resources/oph5spdtst/downloading \
/www/luci-static/resources/oph5spdtst/downloading.tmp

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be in the luci-app- package?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There will later be a luci-app-oph5spdtst package coming (Currently simply only for install framed web + Configuration plane in web ui.). The intention here is to split test payload generation logic + pure test web resource from luci web since openwrt devices might have small/slow flash memory or other types of web service. Maybe I should couple this harder with luci since it requires luci path? I can integrate this logic into luci app if you say so.

Comment thread net/oph5spdtst/Makefile Outdated
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/oph5spdtst.init $(1)/etc/init.d/oph5spdtst

$(INSTALL_DIR) $(1)/www/luci-static/resources/oph5spdtst

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise, part of luci...

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit checks

  • ed93798 "oph5spdtst: add package" — body has blank lines inserted mid-sentence ("... payload service from the" / "immutable v0.2.0 source release."); reflow it into one paragraph.

Generated by Claude Code

Comment thread net/oph5spdtst/files/oph5spdtst.init Outdated
Comment on lines +86 to +88
stop() {
remove_payloads
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In flash mode $FILE_SRC_LINK_PATH is the real 5 MiB payload, not a symlink, and remove_payloads deletes it unconditionally — so every shutdown (STOP=10 runs the K link) and every restart wipes it and start() rewrites 5 MiB to flash on the next boot. That defeats use_flash_stored_payload and adds avoidable flash wear. Load the config in stop() and skip the flash file, or only unlink when [ -L "$FILE_SRC_LINK_PATH" ].


Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

Comment thread net/oph5spdtst/Makefile Outdated
Comment on lines +6 to +7
PKG_SOURCE:=v$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/AzulEterno/oph5spdtst/archive/refs/tags/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v0.2.0.tar.gz is a generic filename in the shared dl/ directory and collides with any other package fetching a v<version> GitHub tag archive. The feed's convention is $(PKG_NAME)-$(PKG_VERSION).tar.gz plus the codeload URL (244 Makefiles use codeload.github.com vs 10 using archive/refs/tags); the tarball bytes are the same, so PKG_HASH stays valid.

Suggested change
PKG_SOURCE:=v$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/AzulEterno/oph5spdtst/archive/refs/tags/
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/AzulEterno/oph5spdtst/tar.gz/v$(PKG_VERSION)?

Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solved by dropping the tarball download entirely, thanks


Generated by Claude Code

Comment thread net/oph5spdtst/Makefile Outdated
PKG_LICENSE:=Apache-2.0 MIT
PKG_LICENSE_FILES:=src/LICENSE src/www/luci-static/resources/oph5spdtst/License.md

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: byte-for-byte the default from include/package.mk:11; drop the line.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

Comment thread net/oph5spdtst/files/oph5spdtst.init Outdated
Comment on lines +3 to +4
START=99
STOP=10

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Init scripts in this feed are expected to be procd-based: add USE_PROCD=1 and use start_service() / stop_service(). Even for a one-shot that buys you service_triggers, so editing /etc/config/oph5spdtst re-runs the payload setup instead of requiring a manual restart.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

Comment thread net/oph5spdtst/files/oph5spdtst.init Outdated

mkdir -p "$dir" || return 1
rm -f "$tmp"
dd if=/dev/urandom of="$tmp" bs="$FILE_SIZE" count=1 >/dev/null 2>&1 || {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this is one 5 MiB read, and a short read from /dev/urandom still exits 0, so a truncated payload gets mv'd into place and only fails payload_is_valid on the next start. Use bs=1M count=5, or verify the size before the mv.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

create_payload "$SPDTST_FILE_PATH" "$SPDTST_TMP_PATH" "$SPDTST_FILE_DIR" || return 1
fi

ln -s "$SPDTST_FILE_PATH" "$FILE_SRC_LINK_PATH"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With uhttpd's option no_symlinks 1 the request path goes through realpath() and is then rejected by the /* check whether found path is within docroot */ test in uhttpd's file.c, so this link resolves outside /www and the download 404s. Default config is unaffected — is that a documented limitation, or should the payload live under the docroot (bind mount / real file) instead?


Generated by Claude Code

Add the payload service and UCI configuration for the oph5spdtst web frontend.

Web assets are installed by the separate LuCI package.

Signed-off-by: Azul Eterno <jay2236419527@gmail.com>

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 new commit.


Generated by Claude Code

Comment on lines +77 to +79
if ! payload_is_valid "$FILE_SRC_LINK_PATH"; then
create_payload "$FILE_SRC_LINK_PATH" "$FILE_SRC_TMP_PATH" "$FILE_SRC_DIR"
fi

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create_payload's exit status is discarded, so a failed flash write leaves start_service returning 0 with no payload in place; the tmp branch at oph5spdtst.init:64 propagates it.

Suggested change
if ! payload_is_valid "$FILE_SRC_LINK_PATH"; then
create_payload "$FILE_SRC_LINK_PATH" "$FILE_SRC_TMP_PATH" "$FILE_SRC_DIR"
fi
if ! payload_is_valid "$FILE_SRC_LINK_PATH"; then
create_payload "$FILE_SRC_LINK_PATH" "$FILE_SRC_TMP_PATH" "$FILE_SRC_DIR" || return 1
fi

Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

Comment thread net/oph5spdtst/files/oph5spdtst.init Outdated
Comment on lines +12 to +13
FILE_SIZE_MB=5
FILE_SIZE_BYTES=5242880

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: two constants that have to be kept in sync by hand — change one and payload_is_valid rejects every payload forever, so each start rewrites the file. Derive the byte count instead.

Suggested change
FILE_SIZE_MB=5
FILE_SIZE_BYTES=5242880
FILE_SIZE_MB=5
FILE_SIZE_BYTES=$((FILE_SIZE_MB * 1024 * 1024))

Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

Comment thread net/oph5spdtst/Makefile
endef

define Package/oph5spdtst/description
Provides a payload service for the oph5spdtst web frontend.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the PR body still states the package "installs the web assets, UCI configuration, and payload service from the immutable v0.2.0 release" — neither the web assets nor the tarball download exist in this revision. Please bring the PR description in line with this description block.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solved by rewriting the PR description, thanks


Generated by Claude Code

Add the payload service and UCI configuration for the oph5spdtst web frontend.

Web assets are installed by the separate LuCI package.

Signed-off-by: Azul Eterno <jay2236419527@gmail.com>

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit checks

  • 111a660 "oph5spdtst: add package" — repeats 28b6767's full "add package" message but only tweaks two lines in oph5spdtst.init; squash it into 28b6767 so the package is added in a single commit.

Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants