Skip to content
This repository was archived by the owner on May 11, 2023. It is now read-only.

Commit c3147d2

Browse files
authored
Replace row/column based Location with byte-offsets. (#4)
1 parent 23fee27 commit c3147d2

File tree

134 files changed

+3130
-16634
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+3130
-16634
lines changed

.github/workflows/ci.yaml

+5-179
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,10 @@ concurrency:
1515
cancel-in-progress: true
1616

1717
env:
18-
CARGO_ARGS: --no-default-features --features stdlib,zlib,importlib,encodings,ssl,jit
1918
NON_WASM_PACKAGES: >-
2019
-p rustpython-common
2120
-p rustpython-compiler-core
22-
-p rustpython-compiler
23-
-p rustpython-codegen
2421
-p rustpython-parser
25-
-p rustpython-vm
26-
-p rustpython-stdlib
27-
-p rustpython-jit
28-
-p rustpython-derive
29-
-p rustpython
3022
PLATFORM_INDEPENDENT_TESTS: >-
3123
test_argparse
3224
test_array
@@ -137,12 +129,7 @@ jobs:
137129
run: cargo clippy ${{ env.CARGO_ARGS }} ${{ env.NON_WASM_PACKAGES }} -- -Dwarnings
138130

139131
- name: run rust tests
140-
run: cargo test --workspace --exclude rustpython_wasm --verbose --features threading ${{ env.CARGO_ARGS }} ${{ env.NON_WASM_PACKAGES }}
141-
if: runner.os != 'macOS'
142-
# temp skip ssl linking for Mac to avoid CI failure
143-
- name: run rust tests (MacOS no ssl)
144-
run: cargo test --workspace --exclude rustpython_wasm --verbose --no-default-features --features threading,stdlib,zlib,importlib,encodings,jit ${{ env.NON_WASM_PACKAGES }}
145-
if: runner.os == 'macOS'
132+
run: cargo test --workspace --verbose --features threading ${{ env.CARGO_ARGS }} ${{ env.NON_WASM_PACKAGES }}
146133

147134
- name: check compilation without threading
148135
run: cargo check ${{ env.CARGO_ARGS }}
@@ -221,7 +208,7 @@ jobs:
221208
target: wasm32-unknown-unknown
222209

223210
- name: Check compilation for wasm32
224-
run: cargo check --target wasm32-unknown-unknown --no-default-features
211+
run: cargo check --target wasm32-unknown-unknown
225212

226213
- uses: dtolnay/rust-toolchain@stable
227214
with:
@@ -237,85 +224,6 @@ jobs:
237224
with:
238225
command: check
239226

240-
snippets_cpython:
241-
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
242-
needs: lalrpop
243-
env:
244-
RUST_BACKTRACE: full
245-
name: Run snippets and cpython tests
246-
runs-on: ${{ matrix.os }}
247-
strategy:
248-
matrix:
249-
os: [macos-latest, ubuntu-latest, windows-latest]
250-
fail-fast: false
251-
steps:
252-
- uses: actions/checkout@v3
253-
- name: Cache generated parser
254-
uses: actions/cache@v3
255-
with:
256-
path: compiler/parser/python.rs
257-
key: lalrpop-${{ hashFiles('compiler/parser/python.lalrpop') }}
258-
259-
- uses: dtolnay/rust-toolchain@stable
260-
- uses: actions/setup-python@v4
261-
with:
262-
python-version: "3.11"
263-
- name: Set up the Windows environment
264-
shell: bash
265-
run: |
266-
choco install llvm openssl --no-progress
267-
echo "OPENSSL_DIR=C:\Program Files\OpenSSL" >>$GITHUB_ENV
268-
if: runner.os == 'Windows'
269-
- name: Set up the Mac environment
270-
run: brew install autoconf automake libtool openssl@3
271-
if: runner.os == 'macOS'
272-
273-
- uses: Swatinem/rust-cache@v2
274-
- name: build rustpython
275-
run: cargo build --release --verbose --features=threading ${{ env.CARGO_ARGS }}
276-
- uses: actions/setup-python@v4
277-
with:
278-
python-version: "3.11"
279-
- name: run snippets
280-
run: python -m pip install -r requirements.txt && pytest -v
281-
working-directory: ./extra_tests
282-
- if: runner.os == 'Linux'
283-
name: run cpython platform-independent tests
284-
run:
285-
target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed -v ${{ env.PLATFORM_INDEPENDENT_TESTS }}
286-
- if: runner.os != 'Windows'
287-
name: run cpython platform-dependent tests
288-
run: target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }}
289-
- if: runner.os == 'Windows'
290-
name: run cpython platform-dependent tests (windows partial - fixme)
291-
run:
292-
target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }}
293-
test_glob
294-
test_importlib
295-
test_io
296-
test_os
297-
test_pathlib
298-
test_posixpath
299-
test_shutil
300-
test_venv
301-
- if: runner.os != 'Windows'
302-
name: check that --install-pip succeeds
303-
run: |
304-
mkdir site-packages
305-
target/release/rustpython --install-pip ensurepip --user
306-
- if: runner.os != 'Windows'
307-
name: Check that ensurepip succeeds.
308-
run: |
309-
target/release/rustpython -m ensurepip
310-
target/release/rustpython -c "import pip"
311-
- if: runner.os != 'Windows'
312-
name: Check if pip inside venv is functional
313-
run: |
314-
target/release/rustpython -m venv testvenv
315-
testvenv/bin/rustpython -m pip install wheel
316-
- name: Check whats_left is not broken
317-
run: python -I whats_left.py
318-
319227
lalrpop:
320228
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
321229
name: Generate parser with lalrpop
@@ -365,8 +273,8 @@ jobs:
365273
components: rustfmt, clippy
366274
- name: run rustfmt
367275
run: cargo fmt --all -- --check
368-
- name: run clippy on wasm
369-
run: cargo clippy --manifest-path=wasm/lib/Cargo.toml -- -Dwarnings
276+
# - name: run clippy on wasm
277+
# run: cargo clippy --manifest-path=wasm/lib/Cargo.toml -- -Dwarnings
370278
- uses: actions/setup-python@v4
371279
with:
372280
python-version: "3.11"
@@ -401,86 +309,4 @@ jobs:
401309

402310
- uses: Swatinem/rust-cache@v2
403311
- name: Run tests under miri
404-
# miri-ignore-leaks because the type-object circular reference means that there will always be
405-
# a memory leak, at least until we have proper cyclic gc
406-
run: MIRIFLAGS='-Zmiri-ignore-leaks' cargo +nightly miri test -p rustpython-vm -- miri_test
407-
408-
wasm:
409-
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
410-
name: Check the WASM package and demo
411-
needs: lalrpop
412-
runs-on: ubuntu-latest
413-
steps:
414-
- uses: actions/checkout@v3
415-
- name: Cache generated parser
416-
uses: actions/cache@v3
417-
with:
418-
path: compiler/parser/python.rs
419-
key: lalrpop-${{ hashFiles('compiler/parser/python.lalrpop') }}
420-
- uses: dtolnay/rust-toolchain@stable
421-
422-
- uses: Swatinem/rust-cache@v2
423-
- name: install wasm-pack
424-
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
425-
- name: install geckodriver
426-
run: |
427-
wget https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz
428-
mkdir geckodriver
429-
tar -xzf geckodriver-v0.30.0-linux64.tar.gz -C geckodriver
430-
- uses: actions/setup-python@v4
431-
with:
432-
python-version: "3.11"
433-
- run: python -m pip install -r requirements.txt
434-
working-directory: ./wasm/tests
435-
- uses: actions/setup-node@v3
436-
- name: run test
437-
run: |
438-
export PATH=$PATH:`pwd`/../../geckodriver
439-
npm install
440-
npm run test
441-
env:
442-
NODE_OPTIONS: "--openssl-legacy-provider"
443-
working-directory: ./wasm/demo
444-
- name: build notebook demo
445-
if: github.ref == 'refs/heads/release'
446-
run: |
447-
npm install
448-
npm run dist
449-
mv dist ../demo/dist/notebook
450-
env:
451-
NODE_OPTIONS: "--openssl-legacy-provider"
452-
working-directory: ./wasm/notebook
453-
- name: Deploy demo to Github Pages
454-
if: success() && github.ref == 'refs/heads/release'
455-
uses: peaceiris/actions-gh-pages@v2
456-
env:
457-
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEMO_DEPLOY_KEY }}
458-
PUBLISH_DIR: ./wasm/demo/dist
459-
EXTERNAL_REPOSITORY: RustPython/demo
460-
PUBLISH_BRANCH: master
461-
462-
wasm-wasi:
463-
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
464-
name: Run snippets and cpython tests on wasm-wasi
465-
needs: lalrpop
466-
runs-on: ubuntu-latest
467-
steps:
468-
- uses: actions/checkout@v3
469-
- name: Cache generated parser
470-
uses: actions/cache@v3
471-
with:
472-
path: compiler/parser/python.rs
473-
key: lalrpop-${{ hashFiles('compiler/parser/python.lalrpop') }}
474-
- uses: dtolnay/rust-toolchain@stable
475-
with:
476-
target: wasm32-wasi
477-
478-
- uses: Swatinem/rust-cache@v2
479-
- name: Setup Wasmer
480-
uses: wasmerio/setup-wasmer@v2
481-
- name: Install clang
482-
run: sudo apt-get update && sudo apt-get install clang -y
483-
- name: build rustpython
484-
run: cargo build --release --target wasm32-wasi --features freeze-stdlib,stdlib --verbose
485-
- name: run snippets
486-
run: wasmer run --dir . target/wasm32-wasi/release/rustpython.wasm -- extra_tests/snippets/stdlib_random.py
312+
run: cargo +nightly miri test -p rustpython-parser -- miri_test

0 commit comments

Comments
 (0)