Repository navigation
travis: add and run script which checks if listed files contain "unwrap". Should fix #10446. - #10448
Conversation
|
@bors-servo try |
|
⌛ Trying commit b7257e1 with merge 9a1a9e6... |
travis: add and run script which checks if listed files contain "unwrap". Should fix #10446. Unfortunately there is a lot of python code in tidy.py that I don't understand yet, so I simply wrote a bash script to do the job and hooked it up in travis.yml. Tests are expected to fail: ```` components/compositing/compositor.rs:758: self.pipeline_details.get_mut(&pipeline_id).unwrap() components/compositing/compositor.rs:2194: RgbImage::from_raw(width as u32, height as u32, pixels).unwrap() components/compositing/pipeline.rs:130: let (paint_shutdown_chan, paint_shutdown_port) = ipc::channel().unwrap(); components/compositing/pipeline.rs:131: let (layout_shutdown_chan, layout_shutdown_port) = ipc::channel().unwrap(); components/compositing/pipeline.rs:132: let (pipeline_chan, pipeline_port) = ipc::channel().unwrap(); components/compositing/pipeline.rs:133: let (script_to_compositor_chan, script_to_compositor_port) = ipc::channel().unwrap(); components/compositing/pipeline.rs:151: let (script_to_devtools_chan, script_to_devtools_port) = ipc::channel().unwrap(); components/compositing/pipeline.rs:154: let message: ScriptToDevtoolsControlMsg = message.to().unwrap(); components/compositing/pipeline.rs:155: devtools_chan.send(DevtoolsControlMsg::FromScript(message)).unwrap() components/compositing/pipeline.rs:161: ipc::channel().unwrap(); components/compositing/pipeline.rs:174: pipeline_port: mem::replace(&mut pipeline_port, None).unwrap(), components/compositing/pipeline.rs:180: .unwrap(); components/compositing/pipeline.rs:184: let (script_chan, script_port) = ipc::channel().unwrap(); components/compositing/pipeline.rs:190: ipc::channel().unwrap(); components/compositing/pipeline.rs:298: let (sender, receiver) = ipc::channel().unwrap(); components/compositing/pipeline.rs:300: receiver.recv().unwrap(); components/compositing/pipeline.rs:315: let _ = self.script_chan.send(ConstellationControlMsg::Freeze(self.id)).unwrap(); components/compositing/pipeline.rs:319: let _ = self.script_chan.send(ConstellationControlMsg::Thaw(self.id)).unwrap(); components/compositing/pipeline.rs:323: let _ = self.script_chan.send(ConstellationControlMsg::ExitPipeline(self.id)).unwrap(); components/compositing/pipeline.rs:326: let _ = layout_channel.send(LayoutControlMsg::ExitNow).unwrap(); components/compositing/pipeline.rs:343: let index = self.children.iter().position(|id| *id == frame_id).unwrap(); components/compositing/pipeline.rs:355: self.script_chan.send(event).unwrap(); components/compositing/pipeline.rs:402: control_port: mem::replace(&mut self.script_port, None).unwrap(), components/compositing/pipeline.rs:423: self.pipeline_port.unwrap(), components/compositing/pipeline.rs:437: self.script_content_process_shutdown_port.recv().unwrap(); components/compositing/pipeline.rs:438: self.layout_content_process_shutdown_port.recv().unwrap(); components/compositing/constellation.rs:464: IpcOneShotServer::<IpcSender<UnprivilegedPipelineContent>>::new().unwrap(); components/compositing/constellation.rs:468: let mut command = sandbox::Command::me().unwrap(); components/compositing/constellation.rs:474: let path_to_self = env::current_exe().unwrap(); components/compositing/constellation.rs:478: ChildProcess::Unsandboxed(child_process.spawn().unwrap()) components/compositing/constellation.rs:482: let (_receiver, sender) = server.accept().unwrap(); components/compositing/constellation.rs:835: stderr.write_all("Pipeline failed in hard-fail mode. Crashing!\n".as_bytes()).unwrap(); components/compositing/constellation.rs:1621: let (sender, receiver) = ipc::channel().unwrap(); components/compositing/constellation.rs:1657: let (sender, receiver) = ipc::channel().unwrap(); components/compositing/constellation.rs:1659: layout_chan.send(LayoutControlMsg::GetCurrentEpoch(sender)).unwrap(); components/compositing/constellation.rs:1660: let layout_thread_epoch = receiver.recv().unwrap(); components/compositing/constellation.rs:1838: let (chan, port) = ipc::channel().unwrap(); ```` <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10448) <!-- Reviewable:end -->
|
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt |
|
Will need to wait for #10423. |
|
I'd prefer a tidy.py solution, or even a compiler plugin, so that devs can easily check whether their code conforms to this rule. |
| # Make sure listed files do not contain "unwrap" | ||
| set -e | ||
|
|
||
| cd `git rev-parse --show-toplevel` # cd into repo root so make sure paths works in any case |
There was a problem hiding this comment.
Please use $(git rev-parse --show-toplevel) instead of backticks for process substitution.
|
Thanks for the feedback, done. |
|
There's only 1 changed file in this PR? |
|
Ooops, yes, I forgot to re-add the file after squashing. |
|
|
||
| # files that should not contain "unwrap" | ||
| FILES=("components/compositing/compositor.rs" | ||
| "components/compositing/pipeline.rs" |
There was a problem hiding this comment.
Sorry, looks like markdown messed up the indentation here - can you line up all of the starting quotes?
|
r? @aneeshusa |
|
This looks great aside from the indentation nit - @matthiaskrgr once you take care of that then r=me. |
|
I took a deeper look at the Travis failure and unfortunately we need a more complicated lint. There are some
Open to suggestions here. |
|
I've been replacing unavoidable uses of |
|
Great, I completely forgot about |
|
📌 Commit dc4fe7e has been approved by |
travis: add and run script which checks if listed files contain "unwrap". Should fix #10446. Unfortunately there is a lot of python code in tidy.py that I don't understand yet, so I simply wrote a bash script to do the job and hooked it up in travis.yml. Tests are expected to fail: ```` components/compositing/compositor.rs:758: self.pipeline_details.get_mut(&pipeline_id).unwrap() components/compositing/compositor.rs:2194: RgbImage::from_raw(width as u32, height as u32, pixels).unwrap() components/compositing/pipeline.rs:130: let (paint_shutdown_chan, paint_shutdown_port) = ipc::channel().unwrap(); components/compositing/pipeline.rs:131: let (layout_shutdown_chan, layout_shutdown_port) = ipc::channel().unwrap(); components/compositing/pipeline.rs:132: let (pipeline_chan, pipeline_port) = ipc::channel().unwrap(); components/compositing/pipeline.rs:133: let (script_to_compositor_chan, script_to_compositor_port) = ipc::channel().unwrap(); components/compositing/pipeline.rs:151: let (script_to_devtools_chan, script_to_devtools_port) = ipc::channel().unwrap(); components/compositing/pipeline.rs:154: let message: ScriptToDevtoolsControlMsg = message.to().unwrap(); components/compositing/pipeline.rs:155: devtools_chan.send(DevtoolsControlMsg::FromScript(message)).unwrap() components/compositing/pipeline.rs:161: ipc::channel().unwrap(); components/compositing/pipeline.rs:174: pipeline_port: mem::replace(&mut pipeline_port, None).unwrap(), components/compositing/pipeline.rs:180: .unwrap(); components/compositing/pipeline.rs:184: let (script_chan, script_port) = ipc::channel().unwrap(); components/compositing/pipeline.rs:190: ipc::channel().unwrap(); components/compositing/pipeline.rs:298: let (sender, receiver) = ipc::channel().unwrap(); components/compositing/pipeline.rs:300: receiver.recv().unwrap(); components/compositing/pipeline.rs:315: let _ = self.script_chan.send(ConstellationControlMsg::Freeze(self.id)).unwrap(); components/compositing/pipeline.rs:319: let _ = self.script_chan.send(ConstellationControlMsg::Thaw(self.id)).unwrap(); components/compositing/pipeline.rs:323: let _ = self.script_chan.send(ConstellationControlMsg::ExitPipeline(self.id)).unwrap(); components/compositing/pipeline.rs:326: let _ = layout_channel.send(LayoutControlMsg::ExitNow).unwrap(); components/compositing/pipeline.rs:343: let index = self.children.iter().position(|id| *id == frame_id).unwrap(); components/compositing/pipeline.rs:355: self.script_chan.send(event).unwrap(); components/compositing/pipeline.rs:402: control_port: mem::replace(&mut self.script_port, None).unwrap(), components/compositing/pipeline.rs:423: self.pipeline_port.unwrap(), components/compositing/pipeline.rs:437: self.script_content_process_shutdown_port.recv().unwrap(); components/compositing/pipeline.rs:438: self.layout_content_process_shutdown_port.recv().unwrap(); components/compositing/constellation.rs:464: IpcOneShotServer::<IpcSender<UnprivilegedPipelineContent>>::new().unwrap(); components/compositing/constellation.rs:468: let mut command = sandbox::Command::me().unwrap(); components/compositing/constellation.rs:474: let path_to_self = env::current_exe().unwrap(); components/compositing/constellation.rs:478: ChildProcess::Unsandboxed(child_process.spawn().unwrap()) components/compositing/constellation.rs:482: let (_receiver, sender) = server.accept().unwrap(); components/compositing/constellation.rs:835: stderr.write_all("Pipeline failed in hard-fail mode. Crashing!\n".as_bytes()).unwrap(); components/compositing/constellation.rs:1621: let (sender, receiver) = ipc::channel().unwrap(); components/compositing/constellation.rs:1657: let (sender, receiver) = ipc::channel().unwrap(); components/compositing/constellation.rs:1659: layout_chan.send(LayoutControlMsg::GetCurrentEpoch(sender)).unwrap(); components/compositing/constellation.rs:1660: let layout_thread_epoch = receiver.recv().unwrap(); components/compositing/constellation.rs:1838: let (chan, port) = ipc::channel().unwrap(); ```` <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10448) <!-- Reviewable:end -->
|
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt |
|
Thanks @matthiaskrgr! In order to enforce this, we need to add a step running this to our saltfs configurations, specifically in the Buildbot master configuration - do you want to work on a PR for this? |
|
Neither do I have experience regarding buildbot configuration nor a local buildbotsetup to test changes on, so I guess I'll have to pass on that one. |
|
Travis seems to fail with |
|
Yes, as I said at the very beginning of the pull request, tests are expected to fail. |
…KiChjang Removed etc/ci/check_no_unwrap.sh from .travis.yml Temporarily disable #10448 until all the uses of unwrap are removed from the constellation/compositor. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10495) <!-- Reviewable:end -->
Unfortunately there is a lot of python code in tidy.py that I don't understand yet, so I simply wrote a bash script to do the job and hooked it up in travis.yml.
Tests are expected to fail:
This change is