@@ -1118,6 +1118,151 @@ jobs:
11181118 env :
11191119 RUST_BACKTRACE : " 1"
11201120
1121+ l10n_cargo_install_regression_test :
1122+ name : L10n/Cargo Install Regression Test
1123+ runs-on : ubuntu-latest
1124+ env :
1125+ SCCACHE_GHA_ENABLED : " true"
1126+ RUSTC_WRAPPER : " sccache"
1127+ steps :
1128+ - uses : actions/checkout@v5
1129+ with :
1130+ persist-credentials : false
1131+ - uses : dtolnay/rust-toolchain@stable
1132+ - uses : Swatinem/rust-cache@v2
1133+ - name : Run sccache-cache
1134+ uses : mozilla-actions/sccache-action@v0.0.9
1135+ - name : Install/setup prerequisites
1136+ shell : bash
1137+ run : |
1138+ ## Install/setup prerequisites
1139+ sudo apt-get -y update ; sudo apt-get -y install libselinux1-dev build-essential
1140+ - name : Test cargo install locale functionality for individual utilities
1141+ shell : bash
1142+ run : |
1143+ ## Test that individual utilities installed via cargo install have proper locale support
1144+ echo "Testing cargo install locale functionality regression..."
1145+
1146+ # Create temporary install directory
1147+ INSTALL_DIR="$(pwd)/test-install-dir"
1148+ mkdir -p "$INSTALL_DIR"
1149+
1150+ # Test specific utilities that are representative of different patterns
1151+ utilities_to_test=("cp" "mv" "ln" "tr" "cut" "yes")
1152+
1153+ echo "Testing ${#utilities_to_test[@]} utilities with locales: ${utilities_to_test[*]}"
1154+
1155+ # Test each utility
1156+ for util in "${utilities_to_test[@]}"; do
1157+ # Skip if utility doesn't have locales
1158+ if [ ! -d "src/uu/$util/locales" ]; then
1159+ echo "Skipping $util (no locales directory)"
1160+ continue
1161+ fi
1162+
1163+ echo "Testing cargo install for $util..."
1164+
1165+ # Install the utility
1166+ cargo install --path "src/uu/$util" --root "$INSTALL_DIR" --force --quiet
1167+
1168+ # Test that the binary exists and runs
1169+ binary_path="$INSTALL_DIR/bin/$util"
1170+ if [ -f "$binary_path" ]; then
1171+ echo "✓ $util binary installed successfully"
1172+
1173+ # Test --help doesn't show locale errors
1174+ help_output=$("$binary_path" --help 2>&1)
1175+ help_exit_code=$?
1176+
1177+ if [ $help_exit_code -eq 0 ]; then
1178+ echo "✓ $util --help executes successfully"
1179+
1180+ # Check for locale error messages that indicate regression
1181+ if echo "$help_output" | grep -q "Could not init the localization system"; then
1182+ echo "✗ ERROR: $util shows locale initialization error - this is a REGRESSION"
1183+ echo "Help output: $help_output"
1184+ exit 1
1185+ elif echo "$help_output" | grep -q "Locales directory not found"; then
1186+ echo "✗ ERROR: $util shows locale directory error - this is a REGRESSION"
1187+ echo "Help output: $help_output"
1188+ exit 1
1189+ else
1190+ echo "✓ $util locale functionality working (no error messages)"
1191+ fi
1192+
1193+ # For utilities we know work well, check for proper English text
1194+ case "$util" in
1195+ "yes")
1196+ if echo "$help_output" | grep -q "Repeatedly display a line with STRING"; then
1197+ echo "✓ $util shows proper English help text"
1198+ else
1199+ echo "⚠ $util help text may not be fully localized, but no errors detected"
1200+ fi
1201+ ;;
1202+ "touch")
1203+ if echo "$help_output" | grep -q -E "(Update|change) .* access.* modifi"; then
1204+ echo "✓ $util shows proper English help text"
1205+ else
1206+ echo "⚠ $util help text may not be fully localized, but no errors detected"
1207+ fi
1208+ ;;
1209+ *)
1210+ echo "✓ $util executed without locale errors (content not validated)"
1211+ ;;
1212+ esac
1213+ else
1214+ echo "✗ ERROR: $util --help failed with exit code $help_exit_code"
1215+ echo "Help output: $help_output"
1216+ exit 1
1217+ fi
1218+
1219+ # Test basic functionality
1220+ case "$util" in
1221+ "yes")
1222+ # Test that yes produces output
1223+ yes_output=$(timeout 1s "$binary_path" test 2>/dev/null || true)
1224+ if echo "$yes_output" | grep -q "test"; then
1225+ echo "✓ $util basic functionality works"
1226+ else
1227+ echo "✗ ERROR: $util basic functionality failed"
1228+ exit 1
1229+ fi
1230+ ;;
1231+ "touch")
1232+ # Test that touch can create a file
1233+ temp_file="$(mktemp)"
1234+ rm -f "$temp_file"
1235+ if "$binary_path" "$temp_file" && [ -f "$temp_file" ]; then
1236+ echo "✓ $util basic functionality works"
1237+ rm -f "$temp_file"
1238+ else
1239+ echo "✗ ERROR: $util basic functionality failed"
1240+ exit 1
1241+ fi
1242+ ;;
1243+ *)
1244+ # For other utilities, just test --version
1245+ if "$binary_path" --version >/dev/null 2>&1; then
1246+ echo "✓ $util --version works"
1247+ else
1248+ echo "✗ ERROR: $util --version failed"
1249+ exit 1
1250+ fi
1251+ ;;
1252+ esac
1253+ else
1254+ echo "✗ ERROR: $util binary not found after cargo install"
1255+ exit 1
1256+ fi
1257+ echo
1258+ done
1259+
1260+ echo "✓ All cargo install locale functionality tests passed"
1261+ echo "This confirms that individual utilities can be installed via cargo install without locale regression"
1262+
1263+ # Clean up
1264+ rm -rf "$INSTALL_DIR"
1265+
11211266 l10n_locale_embedding_regression_test :
11221267 name : L10n/Locale Embedding Regression Test
11231268 runs-on : ubuntu-latest
0 commit comments