我正在写一个应该这样做的脚本......
chroot /chroot_dir/ su -
./startup.sh (This should run within the su environment)
Run Code Online (Sandbox Code Playgroud)
我试过这种方法:
chroot /chroot_dir /bin/bash -c " su -; ./startup.sh"
Run Code Online (Sandbox Code Playgroud)
这会尝试执行用户切换和脚本作为字符串命令来打击......但是它做什么,它是在"su - "之后"停止 "并且不执行脚本.但是,一旦我离开"su - "环境,它确实尝试运行startup.sh,但当然,它无法找到它.
基本上我需要嵌套"startup.sh"才能在"su - "环境中运行...
有任何想法吗?
非常感谢
我试图将我的测试输出记录到文件以及同时运行它们.为此,我试图使用多进程插件和xunit插件.
我知道他们不能一起工作,xunit没有记录任何东西,因为mutiprocess不直接发送输出.
https://github.com/nose-devs/nose/issues/2
我正在寻找的是允许我将输出写入文件的任何替代方案.原因是我正在运行Selenium Tests,每次我收到错误时,堆栈跟踪都非常大,以至于stdout基本上已经完全填满了.减轻的东西也可能有所帮助,关于如何配置日志输出的selenium文档非常缺乏.
我还尝试了一个非常基本的stdout重定向:
#nosetests > file.txt
Run Code Online (Sandbox Code Playgroud)
但那也不起作用.
我正在使用SBT和Play!框架.目前我们在我们的管道中有一个提交阶段,我们在其中发布我们的二进制文件.使用dist任务生成二进制文件.然后管道运行用scala编写的冒烟和验收测试.他们与sbt一起运行.
我想要做的是编译烟雾和验收测试以及二进制文件并将它们发布到artifactory.这将允许管道下载这些二进制文件(测试套件)并运行它们,而不是每次都重新编译它们,这需要很长时间.
我试过sbt test:compile生成jar,但是我找不到运行测试的方法.
我在Java中遇到了Future.get()的WEIRD问题.它总是返回一个InterruptedException,但奇怪的是,Exception的原因是null,所以我不能告诉谁打断了我..
它变得更糟,因为我在调用get()之前检查,而Future必须完成的工作已经完成.
以下是负责输出的代码.f是Future,而callable返回一个HashMap,其中Agent与其真正无关.对不起,如果有太多的印刷品,我只是想尽可能地提供信息.来自callable的调用方法现在很简单System.out.println("Hola soy agente"),正如您将看到的那样,打印出来,这意味着可调用函数不会导致异常
这是代码:
try
{
System.out.println(f.isDone()); //true
System.out.println(f.isCancelled()); //false
System.out.println(f.toString()); //FutureTask
newModdedAgents.putAll(f.get());
}catch(InterruptedException e)
{
System.out.println(f.isDone()); //true
System.out.println(f.isCancelled()); //false
System.err.println(e); //It is an interruptedException
System.err.println(e.getCause()); //???? null?
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
和输出
Hola soy agente
true
false
java.util.concurrent.FutureTask@1c4c94e5
true
false
java.lang.InterruptedException
null
java.lang.InterruptedException
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1302)
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:248)
at java.util.concurrent.FutureTask.get(FutureTask.java:111)
at com.pf.simulator.Simulation.simulateStep(Simulation.java:217)
at com.pf.gui.ButtonPanel.doWork(ButtonPanel.java:141)
at com.pf.gui.ButtonPanel$1$1.construct(ButtonPanel.java:198)
at com.pf.gui.SwingWorker$2.run(SwingWorker.java:117)
at java.lang.Thread.run(Thread.java:636)
Run Code Online (Sandbox Code Playgroud)
如果你想看到我将可调用值汇总到线程池的位置...那么这将是它的代码
for(Callable<HashMap<Integer, Agent>> c : agentCallables)
{
Future<HashMap<Integer,Agent>> future = pool.submit(c);
agentFutureSet.add(future);
}
Run Code Online (Sandbox Code Playgroud)
然后我迭代这个Set
for(Future<HashMap<Integer, Agent>> …Run Code Online (Sandbox Code Playgroud) 目前使用默认配置运行的Selenium Grid2显示它可以运行5个firefox浏览器,5个chrome浏览器和1个IE浏览器.最多同时有5个实例.
如何更改此设置以便它同时运行10个chrome实例?
我已成功使用-maxSession 10更改了节点的maxsession参数.但是,当我运行10次测试时,集线器显示5个队列正在等待执行.
我不知道这是否重要,但是中心本身显示了一个5的maxSession参数.但是这个我无法改变.
关于如何做到这一点的任何想法?
我想使用Spray将多部分表单发布到服务器.特别是我想张贴一张图片.
我遇到麻烦的是文件到多部分的编组.尽管在Spray中他们提到了默认的Marshaller,但我似乎无法将两者结合在一起.
我目前正在使用Spray 1.0-M7,因为我没有迁移到Scala 2.10,如果示例可以符合该分支,那将是非常好的.
我现在拥有的是:
val bis = new BufferedInputStream(new FileInputStream(file))
val bArray = Stream.continually(bis.read).takeWhile(-1 !=).map(_.toByte).toArray
Logger.error("About to post with spray")
pipeline(Post("/saveImageWithSpray", bArray))
Run Code Online (Sandbox Code Playgroud)
当然,我得到一个错误说:
For request 'POST /saveImageWithSpray' [Missing boundary header]
Run Code Online (Sandbox Code Playgroud)
我找到的大多数示例使用内容(作为[X])指令进行编组,但我没有使用Spray-routing,我只需要在另一个框架上构建的应用程序中使用spray-client执行post.
谢谢
编辑
我实际上设法像这样编组:
val pipeline = (
addHeader("Content-Type", "multipart/form-data")
~> sendReceive(conduit)
)
val bis = new BufferedInputStream(new FileInputStream(file, "UTF-8"))
val bArray = Stream.continually(bis.read).takeWhile(-1 !=).map(_.toByte).toArray
Logger.error("About to post with spray "+bArray.length.toString)
pipeline(Post("/saveImageWithSpray", MultipartFormData(Map(
"spray-file" -> BodyPart(
HttpEntity(Some(HttpBody(ContentType(MediaTypes.`image/gif`), bArray))),
HttpHeaders.`Content-Disposition`("form-data", Map("name" -> "spray-file","filename"->"Fuurin (Glass Wind Chime).gif"))::Nil
)
))))
Run Code Online (Sandbox Code Playgroud)
不幸的是,这仍然没有工作,数据正在转移,但服务器无法找到该文件. …
我无法以编程方式运行多个进程.
这有效......:
PYTHONPATH="/home/developer/Downloads/unittest2-0.5.1:" nosetests --processes=4
Run Code Online (Sandbox Code Playgroud)
它一次产生4个浏览器.
然而,当在eclipse中运行它时,它会逐个运行它们.
nose.run(defaultTest="",argv=['--processes=4','--verbose', '--process-timeout=30'])
Run Code Online (Sandbox Code Playgroud)
我知道这些论点正在起作用,因为我可以看到与冗长的论点有所区别.
我拥有的就是这个.
我已经在sbt中定义了我发布到artifactory的发布任务.我在Jenkins工作中运行它作为shell构建步骤.
我想要做的是包括Jenkins Artifactory插件在部署时包含的所有环境信息.我不知道我是否应该将它添加到sbt或者是否有某种方法配置插件以使用sbt但是自己发布.
我对Scala/Play 2.0和Specs有一个简单的问题.
这是我的考验
"Server" should {
"return a valid item with appropriate content type or a 404" in {
val Some(result) = routeAndCall(FakeRequest(GET, "/item/1"))
status(result) match {
case 200 => contentType(result) must beSome("application/json")
case 404 => true
case _ => throw new Exception("The Item server did not return either a 200 application/json or a 404")
}
//false --> It only compiles if I add this line!
}
}
}
Run Code Online (Sandbox Code Playgroud)
这不会编译因为以下内容:
No implicit view available from Any => org.specs2.execute.Result.
[error] "return …Run Code Online (Sandbox Code Playgroud) 这是一个我无法弄清楚的简单问题:
以下代码给出以下编译错误:
def parseJson(q: String) = Option[JsValue]{
try{
Json.parse(q)
}catch{
case e: com.codahale.jerkson.ParsingException => None
}
}
Run Code Online (Sandbox Code Playgroud)
错误
[error] found : None.type (with underlying type object None)
[error] required: play.api.libs.json.JsValue
[error] case e: com.codahale.jerkson.ParsingException => None
Run Code Online (Sandbox Code Playgroud)
为什么我不能返回没有考虑我的响应类型是Option [JsValue]?