Repository: dotnet/runtime
File: src/tests/Common/scripts/bringup_runtest.sh (Shell)

Code before:
    if [ -d "$mscorlibDir/bin" ]; then
        cp -f -v "$mscorlibDir/artifacts/"* "$coreOverlayDir/" 2>/dev/null
    fi
    cp -f -v "$testDependenciesDir/"xunit* "$coreOverlayDir/" 2>/dev/null
    cp -n -v "$testDependenciesDir/"* "$coreOverlayDir/" 2>/dev/null
    copy_test_native_bin_to_test_root $coreOverlayDir
}

declare -a skipCrossGenFiles

function is_skip_crossgen_test {
    for skip in "${skipCrossGenFiles[@]}"; do
        if [[ "$1" == "$skip" ]]; then
            return 0
        fi
    done
    return 1
}

function precompile_overlay_assemblies {
    skipCrossGenFiles=($(read_array "$(dirname "$0")/skipCrossGenFiles.$ARCH.txt"))

    if [[ "$doCrossgen" == 1 ]]; then
        local overlayDir=$CORE_ROOT

        filesToPrecompile=$(find -L $overlayDir -iname \*.dll -not -iname \*-ms-win-\* -type f )
        for fileToPrecompile in ${filesToPrecompile}
        do
            local filename=${fileToPrecompile}
            if [[ "$jitdisasm" == 1 ]]; then
                $overlayDir/corerun $overlayDir/jit-dasm.dll --crossgen $overlayDir/crossgen --platform $overlayDir --output $testRootDir/dasm $filename
                local exitCode=$?
                if [[ "$exitCode" != 0 ]]; then
                    echo Unable to generate dasm for $filename
                fi
            else
                if is_skip_crossgen_test "$(basename $filename)"; then
                    continue
                fi
                echo Precompiling $filename
                $overlayDir/crossgen /Platform_Assemblies_Paths $overlayDir $filename 1> $filename.stdout 2>$filename.stderr
                local exitCode=$?
                if [[ $exitCode != 0 ]]; then
                    if grep -q -e '0x80131018' $filename.stderr; then
                        printf "\n\t$filename is not a managed assembly.\n\n"
                    else
                        echo Unable to precompile $filename.
                        cat $filename.stdout
                        cat $filename.stderr
                        exit $exitCode
                    fi

Review comment (suggestion):
```suggestion
        filesToPrecompile=$(find -L $overlayDir -iname \*.dll -type f )
```
More dead code

Code after:
    if [ -d "$mscorlibDir/bin" ]; then
        cp -f -v "$mscorlibDir/artifacts/"* "$coreOverlayDir/" 2>/dev/null
    fi
    cp -f -v "$testDependenciesDir/"xunit* "$coreOverlayDir/" 2>/dev/null
    cp -n -v "$testDependenciesDir/"* "$coreOverlayDir/" 2>/dev/null
    copy_test_native_bin_to_test_root $coreOverlayDir
}

declare -a skipCrossGenFiles

function is_skip_crossgen_test {
    for skip in "${skipCrossGenFiles[@]}"; do
        if [[ "$1" == "$skip" ]]; then
            return 0
        fi
    done
    return 1
}

function precompile_overlay_assemblies {
    skipCrossGenFiles=($(read_array "$(dirname "$0")/skipCrossGenFiles.$ARCH.txt"))

    if [[ "$doCrossgen" == 1 ]]; then
        local overlayDir=$CORE_ROOT

        filesToPrecompile=$(find -L $overlayDir -iname \*.dll -type f )
        for fileToPrecompile in ${filesToPrecompile}
        do
            local filename=${fileToPrecompile}
            if [[ "$jitdisasm" == 1 ]]; then
                $overlayDir/corerun $overlayDir/jit-dasm.dll --crossgen $overlayDir/crossgen --platform $overlayDir --output $testRootDir/dasm $filename
                local exitCode=$?
                if [[ "$exitCode" != 0 ]]; then
                    echo Unable to generate dasm for $filename
                fi
            else
                if is_skip_crossgen_test "$(basename $filename)"; then
                    continue
                fi
                echo Precompiling $filename
                $overlayDir/crossgen /Platform_Assemblies_Paths $overlayDir $filename 1> $filename.stdout 2>$filename.stderr
                local exitCode=$?
                if [[ $exitCode != 0 ]]; then
                    if grep -q -e '0x80131018' $filename.stderr; then
                        printf "\n\t$filename is not a managed assembly.\n\n"
                    else
                        echo Unable to precompile $filename.
                        cat $filename.stdout
                        cat $filename.stderr
                        exit $exitCode
                    fi