在ubuntu trusty上配置dart content_shell

时间:2016-06-17 15:09:57

标签: ubuntu dart chromium dartium

我正在尝试在Ubuntu Trusty上运行xvfb-run -s '-screen 0 1024x768x24' pub run test -p content-shell

Dart和内容shell按以下方式安装:

# Install Dart
curl https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --import --no-default-keyring --keyring /etc/apt/trusted.gpg.d/google.gpg
curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list
apt-get update
apt-get install --assume-yes  dart=1.15.0-1

# Content shell and dartium
curl https://storage.googleapis.com/dart-archive/channels/stable/release/1.15.0/dartium/dartium-linux-x64-release.zip> /dartium-linux-x64-release.zip && \
    unzip /dartium-linux-x64-release.zip -d /opt/google && \
    mv /opt/google/dartium-* /opt/google/dartium && \
    chmod -R 755 /opt/google/dartium

curl http://storage.googleapis.com/dart-archive/channels/stable/release/1.15.0/dartium/content_shell-linux-x64-release.zip > /content_shell-linux-x64-release.zip && \
    unzip /content_shell-linux-x64-release.zip -d /opt/google && \
    mv /opt/google/drt-* /opt/google/content_shell && \
    chmod -R 755 /opt/google/content_shell

/opt/google/content_shell包含在我的PATH变量中。

# which content_shell
/opt/google/content_shell/content_shell

然而,当我运行该测试尝试时:

# xvfb-run -s '-screen 0 1024x768x24' pub run  test -p content-shell

我收到的错误如下:

Failed to run Content Shell: Content Shell failed with exit code 1..
  dart:async                              Future.Future.error
  package:async/src/result/error.dart 30  ErrorResult.asFuture
  package:async/src/result.dart 93        Result.release.<fn>
  ===== asynchronous gap ===========================
  dart:async                              _Future.then
  package:async/src/result.dart 93        Result.release

我没有看到更多信息。我不确定这是否应该引起关注,虽然它看起来很不祥:

# content_shell --version
[1114:1114:0617/150811:9471556647:ERROR:browser_main_loop.cc(189)] Running without the SUID sandbox! See https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on.
[1116:1116:0100/000000:9471568304:ERROR:zygote_linux.cc(612)] write: Broken pipe

我的问题是如何配置内容shell以便正确安装,以便它将使用pub run test -p content-shell运行测试?

1 个答案:

答案 0 :(得分:4)

就我而言,我需要一些字体。

您可以通过查看日志文件来查看contentshell有哪些错误,对于我的安装位置,这是:

cat /opt/google/content_shell/content_shell.log

这表明我错过了一堆字体,导致内容无声地失败。

我必须安装的那些(或hack my way around,因为很多字体包很大,而且因为这是一个Docker容器,我想减少膨胀):

apt-get update && apt-get install fonts-tlwg-garuda

# fix dart content shell
mkdir /usr/share/fonts/truetype/kochi
cd /usr/share/fonts/truetype/kochi
ln -s ../dejavu/DejaVuSans-Bold.ttf kochi-gothic.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf kochi-mincho.ttf

mkdir /usr/share/fonts/truetype/ttf-indic-fonts-core/
cd /usr/share/fonts/truetype/ttf-indic-fonts-core/
ln -s ../dejavu/DejaVuSans-Bold.ttf lohit_hi.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf lohit_ta.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf MuktiNarrow.ttf

mkdir /usr/share/fonts/truetype/ttf-punjabi-fonts/
cd /usr/share/fonts/truetype/ttf-punjabi-fonts/
ln -s ../dejavu/DejaVuSans-Bold.ttf lohit_pa.ttf
ln -s dejavu/ ttf-dejavu
cd /usr/share/fonts/truetype
ln -s dejavu/ ttf-dejavu

mkdir /usr/share/fonts/truetype/msttcorefonts/
cd /usr/share/fonts/truetype/msttcorefonts/
ln -s ../dejavu/DejaVuSans-Bold.ttf Arial.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Arial_Bold.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Arial_Bold_Italic.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Arial_Italic.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Comic_Sans_MS.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Comic_Sans_MS_Bold.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Courier_New.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Courier_New_Bold.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Courier_New_Bold_Italic.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Courier_New_Italic.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Georgia.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Georgia_Bold.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Georgia_Bold_Italic.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Georgia_Italic.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Impact.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Trebuchet_MS.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Trebuchet_MS_Bold.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Trebuchet_MS_Bold_Italic.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Trebuchet_MS_Italic.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Times_New_Roman.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Times_New_Roman_Bold.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Times_New_Roman_Bold_Italic.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Times_New_Roman_Italic.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Verdana.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Verdana_Bold.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Verdana_Bold_Italic.ttf
ln -s ../dejavu/DejaVuSans-Bold.ttf Verdana_Italic.ttf

其中大多数来自this source code验证。找到它首先验证的列表而不是运行命令并看到下一个命令一百万次就容易得多。

您可能希望实际安装此软件包。