You are not logged in.

#1 2023-12-27 00:13:11

leouscin
Member
Registered: 2022-11-25
Posts: 15

Powershell install failing on test ConsoleHost.Tests.ps1 [Solved]

I am trying to install powershell from the AUR to later install ILSpy from https://github.com/icsharpcode/ILSpy/tree/master.
The installation of ILSpy is failing due the missing pwsh command which is missing because the powershell installation is failing.
The powershell installation is failing with the error:

TEST FAILURES
Description: Starts as a login shell with '-' prepended to name
Name:        ConsoleHost unit tests.-Login pwsh switch.Starts as a login shell with '-' prepended to name
message:
Expected exactly f9448206-1d68-4043-bdc7-c5ba84cef552, but got @('checking dependencies...', <empty>, 'Packages (1) inetutils-2.4-2', <empty>, 'Total Removed Size:  1.06 MiB', <empty>, 'f9448206-1d68-4043-bdc7-c5ba84cef552').
stack-trace:
at <ScriptBlock>, /home/leouscin/.cache/yay/powershell/src/PowerShell-7.4.0/test/powershell/Host/ConsoleHost.Tests.ps1: line 335
335:             $result | Should -BeExactly $guid
Exception: 1 tests in test/powershell failed
==> ERROR: A failure occurred in check().
    Aborting...

I have done the following:
- I asked ChatGPT what the problem could be and all he suggested was to update the system... duh
- I downloaded the git repo for powershell manually and tried to build it like that -> same error
- I accessed the ConsoleHost.Tests.ps1 file in the .cache to see why it was failing, it's 1180 lines long so obviously I won't be able to figure it out myself. I fed its code to ChatGPT for analysis and this is the summary:

ChatGPT wrote:

Before running the test, a GUID is generated and written to a temporary profile script (~/.profile) with an environment variable assignment.
The test then runs PowerShell with the -Login switch, which is supposed to trigger the profile script execution.
The PowerShell command executed is supposed to return the value of the environment variable set in the profile script.
The expected output is just the GUID, but the actual output includes other text related to package management operations (checking dependencies..., Packages (1) inetutils-2.4-2, etc.), which indicates that the profile script might be outputting additional information or there's an interaction with your package manager that shouldn't occur.
The profile script is outputting additional text beyond just setting the environment variable. This could be due to package management operations that occur in your profile script.

However, deleting the .profile script and therefore removing any additional output that woul occur, doesn't fix the problem.

Any help would be appreciated.
Thanks in advance

Last edited by leouscin (2023-12-27 13:37:50)

Offline

#2 2023-12-27 12:50:51

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: Powershell install failing on test ConsoleHost.Tests.ps1 [Solved]

It builds fine for me:

PS /home/empty> pacman -Q powershell
powershell 7.4.0-1
PS /home/empty>

Are you using an AUR helper? Try plain makepkg instead.

And don't ask ChatGPT, it's full of shit.

Offline

#3 2023-12-27 13:17:43

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,896
Website

Re: Powershell install failing on test ConsoleHost.Tests.ps1 [Solved]

Mod note: Moving to AUR Issues.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Online

#4 2023-12-27 13:19:45

leouscin
Member
Registered: 2022-11-25
Posts: 15

Re: Powershell install failing on test ConsoleHost.Tests.ps1 [Solved]

Head_on_a_Stick wrote:

Are you using an AUR helper? Try plain makepkg instead.

I don't know what AUR helper is and what do you mean with plain makepkg?

Offline

#5 2023-12-27 13:21:02

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,594

Re: Powershell install failing on test ConsoleHost.Tests.ps1 [Solved]

How did you install yay?

Offline

#6 2023-12-27 13:37:31

leouscin
Member
Registered: 2022-11-25
Posts: 15

Re: Powershell install failing on test ConsoleHost.Tests.ps1 [Solved]

Scimmia wrote:

How did you install yay?

Cloned the git repo and built the package. If this is what you mean by plain makepkg then please recognize that I explicity wrote:

I downloaded the git repo for powershell manually and tried to build it like that -> same error

Anyway, yesterday I wasted many more hours trying to fix the issue after I posted for help and finally something worked.
The core of the problem is this failing test:

Expected exactly f9448206-1d68-4043-bdc7-c5ba84cef552, but got @('checking dependencies...', <empty>, 'Packages (1) inetutils-2.4-2', <empty>, 'Total Removed Size:  1.06 MiB', <empty>, 'f9448206-1d68-4043-bdc7-c5ba84cef552').

It shows that during the test the output both includes the expected string "f9448206-1d68-4043-bdc7-c5ba84cef552" as well as some other trash that gets fed into the stream during the installation. This trash is the installation log of some dependency that is required for the installation namely "inetutils". In order to not get the additional installation log I statically installed the dependency inetutils using pacman before trying to install powershell again and now it found the dependency during the installation so it didn't log the additional dependency installation into the stream of the test output. It seems like such an easy fix for a problem which took way too many hours to understand. Anyway, thanks guys for trying to help.

Offline

Board footer

Powered by FluxBB