2

我正在使用 Flex 开发一个项目,直到现在我们使用 Windows 为需要 flex 环境的模块/工件运行 flex 单元测试。由于给定的依赖关系,很难自动化任何事情,因为在运行这些 maven 测试时我必须在 linux/windows 之间切换。

我努力尝试让 flex 单元测试在 linux 上运行,但还没有成功。这是 maven clean test -X 在 flex 项目上的一小部分堆栈跟踪。

[INFO] Flexmojos 3.8
[INFO]   Apache License - Version 2.0 (NO WARRANTY) - See COPYRIGHT file
[INFO] Running tests /root/trunk/flex-project/flex-surface/flex-surface-common/flex-surface-common-flex/target/test-classes/TestRunner.swf
[DEBUG] [org.sonatype.flexmojos.test.monitor.AsVmPing] opened server socket on port 13540
[DEBUG] [org.sonatype.flexmojos.test.monitor.ResultHandler] opened server socket on port 13539
[DEBUG] [LAUNCHER] ASVmLauncher starting
[DEBUG] [LAUNCHER] exec: /usr/bin/flashplayer - /root/trunk/flex-project/flex-project-arbeidsflate/flex-surface-common/flex-surface-common-flex/target/test-classes/TestRunner.swf
[DEBUG] [LAUNCHER] Creating process
[WARNING] [LAUNCHER] Using xvfb-run to launch headless tests
[DEBUG] [LAUNCHER] Process created java.lang.UNIXProcess@1a6c088
[DEBUG] [MOJO] launcher RUNNING
[DEBUG] [MOJO] pinger STARTED
[DEBUG] [MOJO] resultHandler STARTED
[DEBUG] [LAUNCHER] Output pumpers ON
[DEBUG] [LAUNCHER] Waiting for flashplayer termination
[DEBUG] [LAUNCHER] Flashplayer closed
[DEBUG] [LAUNCHER] Unexpected return code 1
[DEBUG] [SYSERR]: mktemp: cannot create temp file /tmp/Xauthority: File exists
[DEBUG] [MOJO] launcher ERROR
[DEBUG] [MOJO] pinger STARTED
[DEBUG] [MOJO] resultHandler STARTED
[INFO] ------------------------------------------------------------------------
[INFO] Tests run: 0, Failures: 0, Errors: 0, Time Elapsed: 0 sec
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:

我需要帮助找出问题所在。如果你们中的任何人知道在 linux 上运行 flex 单元测试的任何其他方式,而不是通过 JENKINS/HUDSON,我将非常感激。

4

1 回答 1

2

首先,只需按照以下站点上的 linux 部分说明进行操作:运行单元测试 - FlexMojos。下载 flashplayer 并将其解压到适当的位置,并将绝对目录路径放入 PATH 变量中。

下载 xvfb-run 脚本并更改以下 'fi'

# If the user did not specify an X authorization file to use, set up a temporary
# directory to house one.
if [ -z "$AUTHFILE" ]; then
  XVFB_RUN_TMPDIR="${TMPDIR:-/tmp}/$PROGNAME.$$"
  if ! mkdir -p -m 700 "$XVFB_RUN_TMPDIR"; then
    error "temporary directory $XVFB_RUN_TMPDIR already exists"
    exit 4
  fi
  AUTHFILE=$(mktemp -p "$XVFB_RUN_TMPDIR" Xauthority)
fi

# If the user did not specify an X authorization file to use, set up a temporary
# directory to house one.
if [ -z "$AUTHFILE" ]; then
   XVFB_RUN_TMPDIR=$(mktemp -d)
   if ! mkdir -p -m 700 "$XVFB_RUN_TMPDIR"; then
     error "temporary directory $XVFB_RUN_TMPDIR already exists"
     exit 4
   fi
   AUTHFILE=$(mktemp "$XVFB_RUN_TMPDIR/Xauthority")
 fi

我解决了我的问题,希望你也一样。祝你好运。

于 2013-01-11T12:47:11.190 回答