test: move export test to CI folder

- Moved export test from _demo/embedded/export_test/ to test/export_test.go
- Converted shell-based test to Go test for better CI integration
- Test verifies that //export directive correctly exports functions with different symbol names
- Fixed test to use repository version of llgo instead of system-installed version

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
This commit is contained in:
xgopilot
2025-10-31 03:52:41 +00:00
parent 060a2dea06
commit c36ccfd9a1
3 changed files with 160 additions and 65 deletions

View File

@@ -1,22 +0,0 @@
package main
//export LPSPI2_IRQHandler
func interruptLPSPI2() {
println("LPSPI2 interrupt handled")
}
//export SysTick_Handler
func systemTickHandler() {
println("System tick")
}
//export Add
func Add(a, b int) int {
return a + b
}
func main() {
interruptLPSPI2()
systemTickHandler()
println("Add(2, 3) =", Add(2, 3))
}

View File

@@ -1,43 +0,0 @@
#!/bin/bash
set -e
echo "Testing //export with different symbol names..."
# Set LLGO_ROOT to repository root
export LLGO_ROOT=/workspace
# Build the test program
echo "Building test program..."
/workspace/llgo build -o test_export main.go || exit 1
# Check for expected symbols using nm
echo "Verifying symbols with nm..."
# Should find LPSPI2_IRQHandler (not interruptLPSPI2)
if nm test_export | grep -q "T LPSPI2_IRQHandler"; then
echo "✓ Symbol LPSPI2_IRQHandler found"
else
echo "✗ Symbol LPSPI2_IRQHandler not found"
echo "Available symbols:"
nm test_export | grep " T "
exit 1
fi
# Should find SysTick_Handler (not systemTickHandler)
if nm test_export | grep -q "T SysTick_Handler"; then
echo "✓ Symbol SysTick_Handler found"
else
echo "✗ Symbol SysTick_Handler not found"
exit 1
fi
# Should find Add (same name)
if nm test_export | grep -q "T Add"; then
echo "✓ Symbol Add found"
else
echo "✗ Symbol Add not found"
exit 1
fi
echo ""
echo "All symbol checks passed! ✓"