thesofproject / sof-test

BSD 3-Clause "New" or "Revised" License
12 stars 44 forks source link

[RFC] enable sof-test on ChromeOS #576

Open aiChaoSONG opened 3 years ago

aiChaoSONG commented 3 years ago

I can make sof-test/test-case/check-playback.sh run on ChromeOS, but there are some issues. terminal.txt

  1. the visudo configuration seems only takes effect once.
  2. there is no /var/log/kern.log file.
  3. the sudo funciton in hijack.sh report a library issue, but the file does exist on the system.
    dmesg: error while loading shared libraries: libtinfow.so.6: cannot open shared object file: No such file or directory
  4. no sudo group on ChromeOS
  5. we have to specify bash or python3 when run shell/python scripts, check https://chromium.googlesource.com/chromiumos/docs/+/master/security/noexec_shell_scripts.md
  6. journalctl require root permission

How dependencies are installed?

marc-hb commented 3 years ago

https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py instead of chromebrew?

Running everything as root should avoid sudo, at least to get things started.

fredoh9 commented 3 years ago

For python problems, installing miniconda is the solution. It will take care of python version and packages. I will summarize the procedures.

Need package manager, I found chromebrew useful. expect, graphviz pacakage can be installed https://medium.com/@dihuta/chromebrew-crew-chromeos-package-manager-a91e56a3d898

wget -q -O - https://raw.github.com/skycocker/chromebrew/master/install.sh | bash

Need to remount to add executable permission.

sudo mount -o remount exec /home
sudo mount -o remount exec /home/chronos
sudo mount -o remount exec /home/chronos/user

/var/log/kern.log error, I just did touch /var/log/kern.log but need to be fixed.

sof-logger is not found. Need to look for same version with current SOF binary

/etc/sof is missing, hence sof-{PLATFORM}.ldc is missing. need to find matching file with current SOF binary

fredoh9 commented 3 years ago

for miniconda, there is a shell script installer.

curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash "./Miniconda3-latest-Linux-x86_64.sh" -b -p /usr/local/miniconda3

#setup conda env
#export PATH="/usr/local/miniconda3/bin:$PATH"
. /usr/local/miniconda3/etc/profile.d/conda.sh

conda -V
conda init

conda update conda -y
conda create -y -n sof-test python=3.7
conda activate sof-test
pip install -r "$PATH_SOF/requirement.txt"
fredoh9 commented 3 years ago

I'm using CML Chromebook for reference ChromeOS platform, version R89-13729.1.0, dev image. Without ChromeBrew or minicodna, default python is python 3.6.5. get-pip.py works fine! pip version today i have is pip 20.3.3. I'm able to run check-playback.sh

graphviz and numpy installed fine but scipy couldn't be installed due to unknown error.

marc-hb commented 3 years ago

https://pexpect.readthedocs.io/en/stable/

Pexpect is in the spirit of Don Libes’ Expect, but Pexpect is pure Python. Unlike other Expect-like modules for Python, Pexpect does not require TCL or Expect nor does it require C extensions to be compiled. It should work on any platform that supports the standard Python pty module

marc-hb commented 3 years ago

How to turn a Chromebook device into SOF (on Zephyr) development with Crouton by @andyross https://github.com/zephyrproject-rtos/zephyr/pull/36528/commits/16456d475f4354005cb656f4d5e975ec5b098696

marc-hb commented 2 years ago

How to turn a Chromebook device into SOF (on Zephyr) development with Crouton by @andyross zephyrproject-rtos/zephyr@16456d4

This was merged some time ago in https://github.com/zephyrproject-rtos/zephyr/pull/37647

I'm listing Crouton and other Linux-on-Chromebooks options in new https://github.com/thesofproject/sof-docs/pull/379

plbossart commented 2 years ago

Can we close this @aiChaoSONG ?

aiChaoSONG commented 2 years ago

If download sof-test to /usr/local, and install dependencies with chromebrew, sof-test can run on ChromeOS

marc-hb commented 2 years ago

For convenience: https://thesofproject.github.io/latest/getting_started/intel_debug/introduction.html#chromebooks-and-sof

marc-hb commented 1 year ago

I just looked at a recent ChromeOS image developer image (less than a few weeks old) to collect some "datapoints" relevant for sof-test and it looks like none of these has changed in the last few years:

cc:

aiChaoSONG commented 1 year ago

An intern from Chrome team asked for help to migrate sof-test to chrome OS, I think it is done, but unfortunately she doesn't upstream anything. there is no journalctl on chrome, but there is an alternative tool craslog, which provide similar options to journalctl.

marc-hb commented 1 year ago

Thanks @aiChaoSONG for pointing me to http://crbug.com/1066706 "removing journald" and other useful links. Apparently ChromeOS used journalctl for a short timespan, only 1 or 2 years around 2020 and then went back to .log text files.

It's not easy to find information because the design documents like go/improve-cros-logging seem closed-source but looking at some source code and git logs it seems chromeOS now provides a croslog wrapper on top of rsyslogd that provides features that were lost when removing journalctl like for instance journalctl --boot and the ability to interleave / multiplex logs from different rsyslogd text files. This croslog front-end looks like it also provides (provided?) journalctl compatibility during the transition.

tl;dr: sof-test should very likely rely on croslog when run on ChromeOS. @aiChaoSONG I guess craslog was a typo for croslog?

https://chromium.googlesource.com/chromiumos/third_party/autotest/+/b1ec0cb83b2feb1b https://chromium.googlesource.com/chromiumos/platform2/+/3417bf876ad9c88f79c3ddfe569c3fbb32616896 https://docs.google.com/document/d/1xbC-A4zgEIzaCU6SS-XI7QiF3XjEQB5_4uw2XCqcw9M/edit#heading=h.qapfgw2vziay

kv2019i commented 1 year ago

I was not aware of this ticket (but now I am, thanks @marc-hb ). I did a test with R106 based image and results I got: Tested sof-test today on recent CrOS and...

Seems to be aligned to what has been already discussed on this ticket. The rtcwake issue might require more study, whether this is a configuration issue specific to my board/kernel, or something that will be hit more generally on CrOS.