Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Travis testing #1

Open
wants to merge 61 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 58 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
0527085
port the DEFUN concat of fns.c
purplejacket May 9, 2018
8882a27
port internal_self_insert to rust
db48x May 11, 2018
7e36979
minor improvements to the .gdbinit file
db48x May 11, 2018
3ac3a9f
Create syntax.rs file and add syntax-table method
nitishch May 11, 2018
09849b4
Port run hooks support (#677)
Mar 13, 2018
f35d6fc
Update travis to get builds working
shaleh May 11, 2018
3deae56
Perform apt update
shaleh May 11, 2018
db17791
apt update for cerrors stage as well
db48x May 11, 2018
c5f1c9b
try allowing osx to fail without blocking merges
db48x May 11, 2018
ca22c38
Merge pull request #734 from db48x/minor-improvement-to-the-gdbinit
Wilfred May 12, 2018
ea17df7
Rust port of system-users from dired.c
May 13, 2018
8e8572f
Rust port of system-users from dired.c (fix imports ordering)
May 13, 2018
9e44d76
Merge remote-tracking branch 'origin' into port_concat
purplejacket May 13, 2018
197d6c3
Merge branch 'port-internal-self-insert'
db48x May 14, 2018
75fd134
new appveyor configuration. (#736)
May 14, 2018
6ca13ef
port char-equal (#690)
brotzeit May 14, 2018
63d355d
update function in README (#741)
brotzeit May 14, 2018
684dcc3
Rust's ranges are exclusive of the last value (#743)
db48x May 15, 2018
a577ac8
port process-exit-status
brotzeit Dec 2, 2017
6c4ed66
Add tools for git bisect (#748)
May 15, 2018
19003df
Merge pull request #515 from brotzeit/process-exit-status
brotzeit May 16, 2018
6c1b0d5
Merge Lisp_Object and LispObject into a new LispObject type. (#730)
pipcet May 16, 2018
be8896f
Added scan-lists and also fixed documentation jumping to functions de…
nitishch May 17, 2018
9337439
Rust port of system-users from dired.c (post code review)
May 17, 2018
a92f87a
Merge branch 'master' into rust_dired_systemusers_v2
May 17, 2018
5ba1469
Ported set-syntax-table
nitishch May 18, 2018
bbe960a
Pulled from master
nitishch May 18, 2018
bd93990
Added a comment explaining per_buffer_var_idx
nitishch May 18, 2018
2bdeac5
Formatted the imports properly
nitishch May 18, 2018
7f65c0a
Addressed review comments
nitishch May 18, 2018
4e5dbba
Rust port of system-users from dired.c (Lisp_Object obsoleted)
May 18, 2018
1d22c22
Rust port of system-users from dired.c (fix Windows build warnings)
May 21, 2018
8b37257
Adjust documentation for Lisp*Object merge (#756)
pipcet May 21, 2018
9a3f5eb
Rust port of system-users from dired.c (rustfmt)
May 22, 2018
8dac4a0
Merge branch 'master' into rust_dired_systemusers_v2
May 22, 2018
a451fea
Fix obarray checks in intern and mapatoms
Wilfred May 16, 2018
6e1955b
Give preference to functions whose name is declared in lisp_fn
nitishch May 23, 2018
e4a2af9
Merge pull request #753 from Wilfred/fix_intern
Wilfred May 23, 2018
1487c19
The symbol passed to run-hooks may contain a local function value too
nitishch May 23, 2018
37991c8
Cleaned the comments
nitishch May 23, 2018
bfc2037
Merge pull request #760 from nitishch/run-hooks-fix
db48x May 23, 2018
b9d2447
Replaced emacs_abort with panic!
nitishch May 24, 2018
4c54f46
Rust port of system-users from dired.c (code review and new test)
May 25, 2018
564b9b1
Merge pull request #755 from nitishch/syntax_introduction
brotzeit May 26, 2018
83c735e
Merge pull request #738 from gaak99/rust_dired_systemusers_v2
brotzeit May 28, 2018
b8c7945
port set_marker_internal
brotzeit May 28, 2018
8e00e7b
Merge pull request #666 from brotzeit/set_marker_internal
brotzeit May 28, 2018
cffb311
Start porting "casefiddle.c" (case conversion functions). (#762)
rocky May 28, 2018
be4f0e0
Remove LispObject::from_raw
Wilfred May 22, 2018
0f752cb
Merge pull request #768 from Wilfred/remove_from_raw
Wilfred May 31, 2018
785d425
Fix current mode line height. (#767)
May 31, 2018
617f06e
Add checks for eassert and emacs_abort in pre-commit hook (#766)
nitishch May 31, 2018
9e841ed
Basic travis testing
nitishch Jun 4, 2018
1c9726c
Add Travis Webhooks
nitishch Jun 5, 2018
c09bde7
Add a negative case
nitishch Jun 5, 2018
ceb4fed
One more a negative case
nitishch Jun 5, 2018
3909721
One more more
nitishch Jun 5, 2018
6ae80ba
Don't POST on job cancel
nitishch Jun 5, 2018
9c1bfb5
One more test commit
nitishch Jun 5, 2018
c002e1e
Checking again
nitishch Jun 6, 2018
b2d3108
Small change in Contributing again
nitishch Jun 6, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 0 additions & 76 deletions .appveyor.bat

This file was deleted.

16 changes: 15 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
sudo: required
dist: trusty
group: deprecated-2017Q4
language: rust
cache:
cargo: true
Expand Down Expand Up @@ -32,6 +31,7 @@ jobs:
- CARGO_FLAGS="--features 'strict'"
os: linux
before_script:
- sudo apt update
- sudo apt install -y texinfo libgif-dev libxpm-dev
- travis_wait rustup install $(cat rust-toolchain)
script:
Expand Down Expand Up @@ -70,6 +70,7 @@ jobs:
- stage: cerrors
os: linux # No need to run this everywhere
before_script:
- sudo apt update
- sudo apt install -y texinfo libgif-dev libxpm-dev
- travis_wait rustup install $(cat rust-toolchain)
- ./autogen.sh && ./configure --without-makeinfo --with-x=no --with-ns=no --without-gconf --without-gsettings --with-gif=no
Expand All @@ -80,3 +81,16 @@ jobs:
notifications:
fast_finish: true
email: false
webhooks:
urls:
- https://remacs-rustfmt-check.herokuapp.com/verify-results
on_failure: always
on_success: never
on_start: never
on_cancel: never
on_error: always

matrix:
fast_finish: true
allow_failures:
- os: osx
23 changes: 16 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ Thank you for contributing to Remacs!
you have the correct version by using rustup (it will use the
correct version based on our [toolchain
file](https://github.com/rust-lang-nursery/rustup.rs#the-toolchain-file))
and running `rustup component add rustfmt-preview`
and running `rustup component add rustfmt-preview`. See
[Helpful Hooks](#helpful-hooks) for help to automatate this verification.
* Add docstrings to your Rust functions `/// This function does ...`
* _Really_ great PRs include tests. See
[Writing Tests](#writing-tests) for more information.
Expand Down Expand Up @@ -52,6 +53,20 @@ would belong in `test/rust_src/src/keyboard-tests.el`. If you wrote
the tests in `test/src/` while porting just copy the code over to the
equivalent file in `test/rust_src/src` before submitting the PR.

## Helpful Hooks

The script `rust_src/src/admin/pre-commit` performs some basic checks
to see if any style rule is violated. To run it automatically before
every commit, go to the git root level and run the following commands:

```sh
cd .git/hooks
ln -s ../../rust_src/admin/pre-commit pre-commit
```

Among other things, the script will ensure that the code is formatted
properly in line with the project's guidelines.

## Getting your PRs merged

* Your PR needs to be reviewed by a collaborator. See the !(CONTRIBUTORS)
Expand Down Expand Up @@ -106,11 +121,5 @@ guidelines:

Below are a list of common mistakes we catch in code review.

* Lisp_Object v. LispObject. The name `Lisp_Object` is from C code and
it represents an `int`. It will be a 64bit number on 64bit systems
and 32bit on 32bit systems. `LispObject` is a Rust wrapper which
provides methods. C functions need the C representation. Rust
functions usually take `LispObject` but sometimes they use
`Lisp_Object` instead.
* Prefer `EmacsInt::from(foo)` over `foo as EmacsInt`. The compiler will
be able to warn you if the conversion is lossy.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ handles these definitions for us:

/// Return t if OBJECT is a number.
#[lisp_fn]
fn numberp(object: LispObject) -> LispObject {
LispObject::from_bool(object.is_number())
fn numberp(object: LispObject) -> bool {
object.is_number()
}
```

Expand Down Expand Up @@ -515,3 +515,4 @@ impl LispObject {
}
}
```
<!-- Just testing -->
51 changes: 40 additions & 11 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,43 @@
version: 1.0.{build}
os:
- Visual Studio 2017
clone_depth: 1
platform:
- x64
environment:
global:
PROJECT_NAME: remacs
matrix:
- TOOLCHAIN_VERSION: 14.0
RUST: nightly
init:
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- TARGET: x86_64-pc-windows-gnu

build_script: .appveyor.bat
image: Visual Studio 2015

# Install Rust and Cargo
# (Based on from https://github.com/rust-lang/libc/blob/master/appveyor.yml)
install:
- set /p REMACS_RUST_VERSION=<rust-toolchain
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
- rustup-init.exe --default-host %TARGET% --default-toolchain %REMACS_RUST_VERSION% -y
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin;C:\msys64\usr\bin
- rustc -Vv
- cargo -V
- set MSYSTEM=MINGW64
- C:\msys64\usr\bin\bash --login -c "pacman -Syy"
- C:\msys64\usr\bin\bash --login -c "pacman -Syu --noconfirm base-devel"
- C:\msys64\usr\bin\bash --login -c "pacman -Syu --noconfirm mingw-w64-x86_64-toolchain"
- C:\msys64\usr\bin\bash --login -c "pacman -Syu --noconfirm mingw-w64-x86_64-xpm-nox mingw-w64-x86_64-libtiff"
- C:\msys64\usr\bin\bash --login -c "pacman -Syu --noconfirm mingw-w64-x86_64-giflib mingw-w64-x86_64-jbigkit"
- C:\msys64\usr\bin\bash --login -c "pacman -Syu --noconfirm mingw-w64-x86_64-libpng mingw-w64-x86_64-libjpeg-turbo"
- C:\msys64\usr\bin\bash --login -c "pacman -Syu --noconfirm mingw-w64-x86_64-librsvg mingw-w64-x86_64-libxml2"
- C:\msys64\usr\bin\bash --login -c "pacman -Syu --noconfirm mingw-w64-x86_64-gnutls"

# test_script takes care of building for us, so disable Appveyor's
# build stage. This prevents the "directory does not contain a project
# or solution file" error. source:
# https://github.com/starkat99/appveyor-rust/blob/master/appveyor.yml#L113
build: false

# Equivalent to Travis's `script` phase
test_script:
- C:\msys64\usr\bin\bash --login -c "cd /c/projects/remacs && ./autogen.sh"
- C:\msys64\usr\bin\bash --login -c "cd /c/projects/remacs && PKG_CONFIG_PATH=/mingw64/lib/pkgconfig ./configure --without-imagemagick"
- C:\msys64\usr\bin\bash --login -c "cd /c/projects/remacs && make"
- C:\msys64\usr\bin\bash --login -c "cd /c/projects/remacs && make check"

branches:
only:
- master
12 changes: 8 additions & 4 deletions lisp/emacs-lisp/find-func.el
Original file line number Diff line number Diff line change
Expand Up @@ -297,13 +297,17 @@ TYPE should be nil to find a function, or `defvar' to find a variable."
(indirect-function
(find-function-advised-original identifier))))))
(rust-fname (replace-regexp-in-string "-" "_" fname))
;; XXX: also find #[lisp_fn(name = "fname")]
(regex (rx-to-string
`(and "fn" (+ space) ,rust-fname "("))))
`(and "fn" (+ space) ,rust-fname "(")))
(lisp-fn-name-regex (rx-to-string
`(and "#[" (* space) "lisp_fn" (* space)
"(" (* space) "name" (* space) "="
(* space) "\"" ,fname))))
(with-current-buffer (find-file-noselect file)
(goto-char (point-min))
(unless (re-search-forward regex nil t)
(error "Can't find source for %s" identifier))
(unless (re-search-forward lisp-fn-name-regex nil t)
(unless (re-search-forward regex nil t)
(error "Can't find source for %s" identifier)))
(cons (current-buffer) (match-beginning 0))))))


Expand Down
2 changes: 1 addition & 1 deletion rust_src/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version = "0.1.0"
build = "build.rs"

[dependencies]
remacs-lib = { version = "0.1.0", path = "remacs-lib/" }
remacs-lib = { version = "0.1.0", path = "remacs-lib" }
remacs-macros = { version = "0.1.0", path = "remacs-macros" }
base64 = "0.9"
clippy = { version = "*", optional = true }
Expand Down
10 changes: 5 additions & 5 deletions rust_src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ In order to use `make_float` in the Rust code, the "foreign function" needs to b

```rust
extern "C" {
pub fn make_float(float_value: c_double) -> Lisp_Object;
pub fn make_float(float_value: c_double) -> LispObject;
}
```

There are two remaining unknowns:
1. `c_double`
2. `Lisp_Object`
2. `LispObject`

First, `c_double` is a type representing a C `double`. It is defined in the [`libc`](https://doc.rust-lang.org/book/first-edition/ffi.html#a-note-about-libc) crate and imported in Remacs as follows:

Expand All @@ -48,10 +48,10 @@ use libc::{c_double, /* ... */ };
// ...
```

Second, `Lisp_Object` is a struct containing an EmacsInt:
Second, `LispObject` is a struct containing an EmacsInt:

```rust
pub struct Lisp_Object(EmacsInt);
pub struct LispObject(EmacsInt);
```

The later is a type generated at build time (cf. [build.rs](http://doc.crates.io/build-script.html)) to mimic how they are in C:
Expand All @@ -61,7 +61,7 @@ Now everything is defined, `make_float` can be used in Rust. For example in `rem
```rust
#[inline]
pub fn from_float(v: EmacsDouble) -> LispObject {
LispObject::from_raw(unsafe { make_float(v) })
unsafe { make_float(v) }
}
```

Expand Down
21 changes: 21 additions & 0 deletions rust_src/admin/build-and-run-remacs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

trap handler SIGINT

handler() {
# Sane resume
echo "Ctrl-c caught"
}

set -e

# Instead of make clean at top level which also recompiles all of the elisp
(cd src && make clean)
(cd rust_src && cargo clean)

# Build with full debug possibilities
CFLAGS='-O0 -g3' ./configure --enable-checking='yes,glyphs' --enable-check-lisp-object-type
make -j8 # If j8 is too aggressive for your system adjust accordingly.

# This eval ensures that escaped parameters remain escaped.
eval "src/remacs $@"
21 changes: 21 additions & 0 deletions rust_src/admin/did-it-work.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

echo "Testing build and compile of remacs with arguments: $@"

rust_src/admin/build-and-run-remacs.sh "$@"

result=$?

if [ $? -ne 0 ]; then
exit $result
fi

read -r -p "Did it work? [Ny]" work
case "$work" in
Y|y)
exit 0
;;
*)
exit 1
;;
esac
31 changes: 28 additions & 3 deletions rust_src/admin/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,38 @@ if [ -z "$stripped_diff" ]; then
echo -e "success."
else
echo -e "FAIL!"
echo "$diff"
echo -e "Following code is not formatted with rustfmt. Make sure to run 'make rustfmt' from git root.\n"
echo -e "$diff\n"
errors=1
fi


# Check if emacs_abort is used
EMACS_ABORT_PATTERN='\+.*emacs_abort'
if [ "$(git diff --cached --diff-filter=ACM | grep $EMACS_ABORT_PATTERN)" != "" ]; then
cat <<EOF
Some files use emacs_abort. Use panic! with a string explaining cause instead. See $GIT_TOPLEVEL/rust_src/src/buffers.rs for examples.

EOF
errors=1
fi

# Check if eassert is used
EASSERT_PATTERN='\+.*eassert'
# Check for eassert
if [ "$(git diff --cached --diff-filter=ACM | grep $EASSERT_PATTERN)" != "" ]; then
cat <<EOF
Some files use eassert. Use debug_assert! instead. See $GIT_TOPLEVEL/rust_src/lisp.rs for examples.

EOF
errors=1
fi


if [ "$errors" != 0 ]; then
echo "Failed"
exit 1
echo "pre-commit checks failed"
echo "To commit anyway, pass --no-verify to git commit."
exit 1
else
echo "OK"
fi
Loading