fix(ci): fix forward function declaration in runtime.uc and harden tests for multi-call coreutils/alpine

This commit is contained in:
Dushnilin
2026-08-15 12:28:49 +03:00
parent e0828eb53a
commit d81d9fd077
7 changed files with 26 additions and 17 deletions
@@ -391,6 +391,11 @@ function run_logged(description, command) {
}
function is_apk() {
let forced = getenv("TACHYON_FORCE_PKG_MANAGER");
if (forced == "apk")
return true;
if (forced == "opkg")
return false;
return command_exists("apk");
}
+12 -12
View File
@@ -252,18 +252,6 @@ function get_wan_ip_addresses() {
return join(" ", result);
}
function dns_check_through_singbox(domain) {
let resolved = dns_check_resolve_host(domain, SB_DNS_INBOUND_ADDRESS, 3);
if (resolved != "")
return true;
let res = command_capture("nslookup " + shell_quote(domain) + " " + SB_DNS_INBOUND_ADDRESS + " 2>&1");
return (index(res.output, "Address") >= 0 || index(res.output, "name =") >= 0) &&
index(res.output, "NXDOMAIN") < 0 &&
index(res.output, "can't resolve") < 0 &&
index(res.output, "timed out") < 0;
}
function get_wan_interface() {
let iface = trim(as_string(uci_core.get(CONFIG_NAME + ".settings.output_network_interface")));
if (iface != "") return iface;
@@ -1414,6 +1402,18 @@ function dns_check_resolve_host(host, resolver, timeout_seconds) {
return "";
}
function dns_check_through_singbox(domain) {
let resolved = dns_check_resolve_host(domain, SB_DNS_INBOUND_ADDRESS, 3);
if (resolved != "")
return true;
let res = command_capture("nslookup " + shell_quote(domain) + " " + SB_DNS_INBOUND_ADDRESS + " 2>&1");
return (index(res.output, "Address") >= 0 || index(res.output, "name =") >= 0) &&
index(res.output, "NXDOMAIN") < 0 &&
index(res.output, "can't resolve") < 0 &&
index(res.output, "timed out") < 0;
}
function device_ipv4_address(interface) {
let value = replace(module_output(SINGBOX_RUNTIME_UC, [ "device-ipv4-address", interface ]), /[\r\n]+$/g, "");
if (value != "")
+1
View File
@@ -3,6 +3,7 @@ set -eo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
TACHYON_LIB="$ROOT_DIR/tachyon/files/usr/lib"
export TACHYON_LIB="$TACHYON_LIB"
WORK_DIR="$(mktemp -d)"
cleanup() {
+1 -2
View File
@@ -105,8 +105,7 @@ build_stale_uc
# A live worker is not stale.
mkdir -p "$WORK_DIR"
ln -s /bin/sleep "$WORK_DIR/component-action-worker"
"$WORK_DIR/component-action-worker" 30 &
bash -c 'while true; do sleep 1; done' component-action-worker &
worker_pid=$!
actual="$(run_stale_check "$WORK_DIR/job.json" "$worker_pid")"
[ "$actual" = "running" ] || fail "a live component-action worker was marked stale (pid $worker_pid): '$actual'"
+1
View File
@@ -267,6 +267,7 @@ chmod +x "$package_runtime_bin/opkg" "$package_runtime_bin/logger"
set +e
PATH="$package_runtime_bin:$PATH" \
TACHYON_LIB="$package_runtime_lib" \
TACHYON_FORCE_PKG_MANAGER="opkg" \
TACHYON_RUNTIME_STATE_DIR="$WORK_DIR/package-runtime" \
TACHYON_BIN="$WORK_DIR/missing-tachyon" \
TACHYON_SERVICE_INIT="$WORK_DIR/missing-init" \
+5 -1
View File
@@ -33,7 +33,11 @@ install_command() {
local force="$2"
shift 2
PATH="$WORK_DIR/$pm_dir:$PATH" command ucode -L "$TACHYON_LIB" "$ACTION_UC" \
local force_pm=""
[ "$pm_dir" = "opkg-bin" ] && force_pm="opkg"
[ "$pm_dir" = "apk-bin" ] && force_pm="apk"
TACHYON_FORCE_PKG_MANAGER="$force_pm" PATH="$WORK_DIR/$pm_dir:$PATH" command ucode -L "$TACHYON_LIB" "$ACTION_UC" \
pkg-install-files-command "$force" "$@"
}
+1 -2
View File
@@ -287,8 +287,7 @@ NODE
component_job="$TACHYON_UI_COMPONENT_ACTION_DIR/component-1.json"
mkdir -p "$TACHYON_UI_COMPONENT_ACTION_DIR"
ln -s /bin/sleep "$TACHYON_UI_COMPONENT_ACTION_DIR/component-action-worker"
"$TACHYON_UI_COMPONENT_ACTION_DIR/component-action-worker" 30 &
bash -c 'while true; do sleep 1; done' component-action-worker &
worker_pid=$!
printf '%s\n' '{"running":true,"component":"sing_box","pid":"'"$worker_pid"'","started_at":100}' >"$component_job"
ui_ucode component-action-running-for sing_box >/dev/null ||