@@ -58,10 +58,10 @@ jobs:
5858 brew install coreutils
5959 ;;
6060 esac
61- - name : Build with l10n
61+ - name : Build with platform features
6262 shell : bash
6363 run : |
64- ## Build with l10n
64+ ## Build with platform-specific features to enable l10n functionality
6565 cargo build --features ${{ matrix.job.features }}
6666 - name : Test l10n functionality
6767 shell : bash
@@ -96,14 +96,14 @@ jobs:
9696 # Check if any .ftl files exist
9797 fluent_files=$(find . -name "*.ftl" -type f 2>/dev/null || true)
9898
99- if [ -z "$fluent_files" ]; then
99+ if [ -n "$fluent_files" ]; then
100+ echo "Found Fluent files:"
101+ echo "$fluent_files"
102+ else
100103 echo "::notice::No Fluent (.ftl) files found in the repository"
101104 exit 0
102105 fi
103106
104- echo "Found Fluent files:"
105- echo "$fluent_files"
106-
107107 # Use Mozilla Fluent Linter for comprehensive validation
108108 echo "Running Mozilla Fluent Linter..."
109109
@@ -952,3 +952,147 @@ jobs:
952952 echo "✓ All locale-specific functionality tests passed"
953953 env :
954954 RUST_BACKTRACE : " 1"
955+
956+ l10n_locale_embedding_regression_test :
957+ name : L10n/Locale Embedding Regression Test
958+ runs-on : ubuntu-latest
959+ env :
960+ SCCACHE_GHA_ENABLED : " true"
961+ RUSTC_WRAPPER : " sccache"
962+ steps :
963+ - uses : actions/checkout@v4
964+ with :
965+ persist-credentials : false
966+ - uses : dtolnay/rust-toolchain@stable
967+ - uses : Swatinem/rust-cache@v2
968+ - name : Run sccache-cache
969+ uses :
mozilla-actions/[email protected] 970+ - name : Install/setup prerequisites
971+ shell : bash
972+ run : |
973+ ## Install/setup prerequisites
974+ sudo apt-get -y update ; sudo apt-get -y install libselinux1-dev build-essential
975+ - name : Build binaries for locale embedding test
976+ shell : bash
977+ run : |
978+ ## Build individual utilities and multicall binary for locale embedding test
979+ echo "Building binaries with different locale embedding configurations..."
980+ mkdir -p target
981+
982+ # Build cat utility with targeted locale embedding
983+ echo "Building cat utility with targeted locale embedding..."
984+ echo "cat" > target/uucore_target_util.txt
985+ cargo build -p uu_cat --release
986+
987+ # Build ls utility with targeted locale embedding
988+ echo "Building ls utility with targeted locale embedding..."
989+ echo "ls" > target/uucore_target_util.txt
990+ cargo build -p uu_ls --release
991+
992+ # Build multicall binary (should have all locales)
993+ echo "Building multicall binary (should have all locales)..."
994+ echo "multicall" > target/uucore_target_util.txt
995+ cargo build --release
996+
997+ echo "✓ All binaries built successfully"
998+ env :
999+ RUST_BACKTRACE : " 1"
1000+
1001+ - name : Analyze embedded locale files
1002+ shell : bash
1003+ run : |
1004+ ## Extract and analyze .ftl files embedded in each binary
1005+ echo "=== Embedded Locale File Analysis ==="
1006+
1007+ # Analyze cat binary
1008+ echo "--- cat binary embedded .ftl files ---"
1009+ cat_ftl_files=$(strings target/release/cat | grep -o "[a-z_][a-z_]*/en-US\.ftl" | sort | uniq)
1010+ cat_locales=$(echo "$cat_ftl_files" | wc -l)
1011+ if [ -n "$cat_ftl_files" ]; then
1012+ echo "$cat_ftl_files"
1013+ else
1014+ echo "(no locale keys found)"
1015+ fi
1016+ echo "Total: $cat_locales files"
1017+ echo
1018+
1019+ # Analyze ls binary
1020+ echo "--- ls binary embedded .ftl files ---"
1021+ ls_ftl_files=$(strings target/release/ls | grep -o "[a-z_][a-z_]*/en-US\.ftl" | sort | uniq)
1022+ ls_locales=$(echo "$ls_ftl_files" | wc -l)
1023+ if [ -n "$ls_ftl_files" ]; then
1024+ echo "$ls_ftl_files"
1025+ else
1026+ echo "(no locale keys found)"
1027+ fi
1028+ echo "Total: $ls_locales files"
1029+ echo
1030+
1031+ # Analyze multicall binary
1032+ echo "--- multicall binary embedded .ftl files (first 10) ---"
1033+ multi_ftl_files=$(strings target/release/coreutils | grep -o "[a-z_][a-z_]*/en-US\.ftl" | sort | uniq)
1034+ multi_locales=$(echo "$multi_ftl_files" | wc -l)
1035+ if [ -n "$multi_ftl_files" ]; then
1036+ echo "$multi_ftl_files" | head -10
1037+ echo "... (showing first 10 of $multi_locales total files)"
1038+ else
1039+ echo "(no locale keys found)"
1040+ fi
1041+ echo
1042+
1043+ # Store counts for validation step
1044+ echo "cat_locales=$cat_locales" >> $GITHUB_ENV
1045+ echo "ls_locales=$ls_locales" >> $GITHUB_ENV
1046+ echo "multi_locales=$multi_locales" >> $GITHUB_ENV
1047+
1048+ - name : Validate cat binary locale embedding
1049+ shell : bash
1050+ run : |
1051+ ## Validate that cat binary only embeds its own locale files
1052+ echo "Validating cat binary locale embedding..."
1053+ if [ "$cat_locales" -le 5 ]; then
1054+ echo "✓ SUCCESS: cat binary uses targeted locale embedding ($cat_locales files)"
1055+ else
1056+ echo "✗ FAILURE: cat binary has too many embedded locale files ($cat_locales). Expected ≤ 5."
1057+ echo "This indicates LOCALE EMBEDDING REGRESSION - all locales are being embedded instead of just the target utility's locale."
1058+ echo "The optimization is not working correctly!"
1059+ exit 1
1060+ fi
1061+
1062+ - name : Validate ls binary locale embedding
1063+ shell : bash
1064+ run : |
1065+ ## Validate that ls binary only embeds its own locale files
1066+ echo "Validating ls binary locale embedding..."
1067+ if [ "$ls_locales" -le 5 ]; then
1068+ echo "✓ SUCCESS: ls binary uses targeted locale embedding ($ls_locales files)"
1069+ else
1070+ echo "✗ FAILURE: ls binary has too many embedded locale files ($ls_locales). Expected ≤ 5."
1071+ echo "This indicates LOCALE EMBEDDING REGRESSION - all locales are being embedded instead of just the target utility's locale."
1072+ echo "The optimization is not working correctly!"
1073+ exit 1
1074+ fi
1075+
1076+ - name : Validate multicall binary locale embedding
1077+ shell : bash
1078+ run : |
1079+ ## Validate that multicall binary embeds all utility locale files
1080+ echo "Validating multicall binary locale embedding..."
1081+ if [ "$multi_locales" -ge 80 ]; then
1082+ echo "✓ SUCCESS: multicall binary has all locales ($multi_locales files)"
1083+ else
1084+ echo "✗ FAILURE: multicall binary has too few embedded locale files ($multi_locales). Expected ≥ 80."
1085+ echo "This indicates the multicall binary is not getting all required locales."
1086+ exit 1
1087+ fi
1088+
1089+ - name : Finalize locale embedding tests
1090+ shell : bash
1091+ run : |
1092+ ## Clean up and report overall test results
1093+ rm -f test.txt target/uucore_target_util.txt
1094+ echo "✓ All locale embedding regression tests passed"
1095+ echo "Summary:"
1096+ echo " - cat binary: $cat_locales locale files (targeted embedding)"
1097+ echo " - ls binary: $ls_locales locale files (targeted embedding)"
1098+ echo " - multicall binary: $multi_locales locale files (full embedding)"
0 commit comments