luarocks / luarocks/luarocks

`luarocks test`: build before running the test suite

Open
#1,836 0 comments 1 reaction 0 assignees View on GitHub
feature request
Dominant language
Lua
Stars
3.7k
Forks
479
PR merge metrics
No merged PRs in 30d

Description

## Problem

Compiled modules (e.g. written in C or built with a custom build backend) cannot be `require`d in test suites, unless one builds them first.

This leads to an unergonomic sequence:

Before running tests, I have to

1. Build the project

```bash
mkdir .luarocks
luarocks $LUAROCKS_EXTRA_ARGS make --tree=.luarocks --deps-mode=all
```

2. Add the build directory to the `package.cpath` (e. g. in a `.busted` file):

```
cpath = "./.luarocks/lib/lua/5.1/?.so",
```

3. Run `luarocks test`

## Proposed solution

It would be great if luarocks had a mechanism to build the project and set up the Lua paths (perhaps including dependencies) before running the test suite.

### Pros/cons

(+) Simpler UX
(+) This is what other package managers do (cargo, cabal, stack, gradle, ...)
(-) Extra overhead of potentially building the package more than once

The extra overhead could potentially be mitigated by caching a checksum of the source directories (and `copy_directries`?) and only rebuilding if it has changed.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the `luarocks test` entry point and compare it with the provided `luarocks ... make --tree=.luarocks --deps-mode=all` flow; inspect how `.busted` supplies `package.cpath`. Done means test runs can build the project and configure Lua paths, including dependencies, without those manual steps.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
build-system, testing, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.